Mercurial > octave-nkf
diff liboctave/CNDArray.cc @ 4543:79df15d4470c
[project @ 2003-10-18 03:53:52 by jwe]
author | jwe |
---|---|
date | Sat, 18 Oct 2003 03:53:53 +0000 |
parents | 01ee68d18069 |
children | 773a21e4fce8 |
line wrap: on
line diff
--- a/liboctave/CNDArray.cc Fri Oct 17 04:41:36 2003 +0000 +++ b/liboctave/CNDArray.cc Sat Oct 18 03:53:53 2003 +0000 @@ -35,6 +35,43 @@ #include "ArrayN-inline.h" +// XXX FIXME XXX -- could we use a templated mixed-type copy function +// here? + +ComplexNDArray::ComplexNDArray (const NDArray& a) + : MArrayN<Complex> (a.dims ()) +{ + for (int i = 0; i < a.length (); i++) + elem (i) = a.elem (i); +} + +ComplexNDArray::ComplexNDArray (const boolNDArray& a) + : MArrayN<Complex> (a.dims ()) +{ + for (int i = 0; i < a.length (); i++) + elem (i) = a.elem (i); +} + +ComplexNDArray::ComplexNDArray (const charNDArray& a) + : MArrayN<Complex> (a.dims ()) +{ + for (int i = 0; i < a.length (); i++) + elem (i) = a.elem (i); +} + +// unary operations + +boolNDArray +ComplexNDArray::operator ! (void) const +{ + boolNDArray b (dims ()); + + for (int i = 0; i < length (); i++) + b.elem (i) = elem (i) != 0.0; + + return b; +} + // XXX FIXME XXX -- this is not quite the right thing. boolMatrix @@ -106,6 +143,15 @@ ::increment_index (ra_idx, dimensions, start_dimension); } +NDS_CMP_OPS(ComplexNDArray, real, Complex, real) +NDS_BOOL_OPS(ComplexNDArray, Complex, 0.0) + +SND_CMP_OPS(Complex, real, ComplexNDArray, real) +SND_BOOL_OPS(Complex, ComplexNDArray, 0.0) + +NDND_CMP_OPS(ComplexNDArray, real, ComplexNDArray, real) +NDND_BOOL_OPS(ComplexNDArray, ComplexNDArray, 0.0) + /* ;;; Local Variables: *** ;;; mode: C++ ***