Mercurial > hg > octave-nkf
diff liboctave/CNDArray.cc @ 9546:1beb23d2b892
optimize op= in common cases
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 19 Aug 2009 13:47:59 +0200 |
parents | 0ce82753dd72 |
children | 3d6a9aea2aea |
line wrap: on
line diff
--- a/liboctave/CNDArray.cc +++ b/liboctave/CNDArray.cc @@ -36,6 +36,7 @@ #include "functor.h" #include "lo-ieee.h" #include "lo-mappers.h" +#include "MArray-defs.h" #include "mx-base.h" #include "mx-op-defs.h" #include "oct-fftw.h" @@ -1083,6 +1084,22 @@ NDND_CMP_OPS(ComplexNDArray, std::real, ComplexNDArray, std::real) NDND_BOOL_OPS(ComplexNDArray, ComplexNDArray, 0.0) +ComplexNDArray& operator *= (ComplexNDArray& a, double s) +{ + if (a.is_shared ()) + return a = a * s; + DO_VS_OP2 (Complex, a, *=, s) + return a; +} + +ComplexNDArray& operator /= (ComplexNDArray& a, double s) +{ + if (a.is_shared ()) + return a = a / s; + DO_VS_OP2 (Complex, a, /=, s) + return a; +} + /* ;;; Local Variables: *** ;;; mode: C++ ***