Mercurial > hg > octave-lyh
comparison liboctave/CNDArray.h @ 10350:12884915a8e4
merge MArray classes & improve Array interface
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sat, 23 Jan 2010 21:41:03 +0100 |
parents | 83fa590b8a09 |
children | 96ed7c629bbd |
comparison
equal
deleted
inserted
replaced
10349:d4d13389c957 | 10350:12884915a8e4 |
---|---|
21 */ | 21 */ |
22 | 22 |
23 #if !defined (octave_ComplexNDArray_h) | 23 #if !defined (octave_ComplexNDArray_h) |
24 #define octave_ComplexNDArray_h 1 | 24 #define octave_ComplexNDArray_h 1 |
25 | 25 |
26 #include "MArrayN.h" | 26 #include "MArray.h" |
27 #include "CMatrix.h" | 27 #include "CMatrix.h" |
28 | 28 |
29 #include "mx-defs.h" | 29 #include "mx-defs.h" |
30 #include "mx-op-decl.h" | 30 #include "mx-op-decl.h" |
31 #include "bsxfun-decl.h" | 31 #include "bsxfun-decl.h" |
32 | 32 |
33 class | 33 class |
34 OCTAVE_API | 34 OCTAVE_API |
35 ComplexNDArray : public MArrayN<Complex> | 35 ComplexNDArray : public MArray<Complex> |
36 { | 36 { |
37 public: | 37 public: |
38 | 38 |
39 typedef ComplexMatrix matrix_type; | 39 typedef ComplexMatrix matrix_type; |
40 | 40 |
41 ComplexNDArray (void) : MArrayN<Complex> () { } | 41 ComplexNDArray (void) : MArray<Complex> () { } |
42 | 42 |
43 ComplexNDArray (const dim_vector& dv) : MArrayN<Complex> (dv) { } | 43 ComplexNDArray (const dim_vector& dv) : MArray<Complex> (dv) { } |
44 | 44 |
45 ComplexNDArray (const dim_vector& dv, const Complex& val) | 45 ComplexNDArray (const dim_vector& dv, const Complex& val) |
46 : MArrayN<Complex> (dv, val) { } | 46 : MArray<Complex> (dv, val) { } |
47 | 47 |
48 ComplexNDArray (const ComplexNDArray& a) : MArrayN<Complex> (a) { } | 48 ComplexNDArray (const ComplexNDArray& a) : MArray<Complex> (a) { } |
49 | 49 |
50 ComplexNDArray (const ComplexMatrix& a) : MArrayN<Complex> (a) { } | 50 ComplexNDArray (const ComplexMatrix& a) : MArray<Complex> (a) { } |
51 | 51 |
52 template <class U> | 52 template <class U> |
53 ComplexNDArray (const MArrayN<U>& a) : MArrayN<Complex> (a) { } | 53 ComplexNDArray (const MArray<U>& a) : MArray<Complex> (a) { } |
54 | 54 |
55 template <class U> | 55 template <class U> |
56 ComplexNDArray (const Array<U>& a) : MArrayN<Complex> (a) { } | 56 ComplexNDArray (const Array<U>& a) : MArray<Complex> (a) { } |
57 | 57 |
58 ComplexNDArray (const charNDArray&); | 58 ComplexNDArray (const charNDArray&); |
59 | 59 |
60 ComplexNDArray& operator = (const ComplexNDArray& a) | 60 ComplexNDArray& operator = (const ComplexNDArray& a) |
61 { | 61 { |
62 MArrayN<Complex>::operator = (a); | 62 MArray<Complex>::operator = (a); |
63 return *this; | 63 return *this; |
64 } | 64 } |
65 | 65 |
66 // unary operations | 66 // unary operations |
67 | 67 |
119 ComplexNDArray fourierNd (void) const; | 119 ComplexNDArray fourierNd (void) const; |
120 ComplexNDArray ifourierNd (void) const; | 120 ComplexNDArray ifourierNd (void) const; |
121 | 121 |
122 ComplexMatrix matrix_value (void) const; | 122 ComplexMatrix matrix_value (void) const; |
123 | 123 |
124 ComplexNDArray squeeze (void) const { return MArrayN<Complex>::squeeze (); } | 124 ComplexNDArray squeeze (void) const { return MArray<Complex>::squeeze (); } |
125 | 125 |
126 static void increment_index (Array<octave_idx_type>& ra_idx, | 126 static void increment_index (Array<octave_idx_type>& ra_idx, |
127 const dim_vector& dimensions, | 127 const dim_vector& dimensions, |
128 int start_dimension = 0); | 128 int start_dimension = 0); |
129 | 129 |
142 | 142 |
143 ComplexNDArray diag (octave_idx_type k = 0) const; | 143 ComplexNDArray diag (octave_idx_type k = 0) const; |
144 | 144 |
145 ComplexNDArray& changesign (void) | 145 ComplexNDArray& changesign (void) |
146 { | 146 { |
147 MArrayN<Complex>::changesign (); | 147 MArray<Complex>::changesign (); |
148 return *this; | 148 return *this; |
149 } | 149 } |
150 | 150 |
151 private: | 151 private: |
152 | 152 |
153 ComplexNDArray (Complex *d, const dim_vector& dv) | 153 ComplexNDArray (Complex *d, const dim_vector& dv) |
154 : MArrayN<Complex> (d, dv) { } | 154 : MArray<Complex> (d, dv) { } |
155 }; | 155 }; |
156 | 156 |
157 extern OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a); | 157 extern OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a); |
158 | 158 |
159 MINMAX_DECLS (ComplexNDArray, Complex, OCTAVE_API) | 159 MINMAX_DECLS (ComplexNDArray, Complex, OCTAVE_API) |
165 SND_BOOL_OP_DECLS (Complex, ComplexNDArray, OCTAVE_API) | 165 SND_BOOL_OP_DECLS (Complex, ComplexNDArray, OCTAVE_API) |
166 | 166 |
167 NDND_CMP_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API) | 167 NDND_CMP_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API) |
168 NDND_BOOL_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API) | 168 NDND_BOOL_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API) |
169 | 169 |
170 MARRAY_FORWARD_DEFS (MArrayN, ComplexNDArray, Complex) | 170 MARRAY_FORWARD_DEFS (MArray, ComplexNDArray, Complex) |
171 | 171 |
172 extern OCTAVE_API ComplexNDArray& operator *= (ComplexNDArray& a, double s); | 172 extern OCTAVE_API ComplexNDArray& operator *= (ComplexNDArray& a, double s); |
173 extern OCTAVE_API ComplexNDArray& operator /= (ComplexNDArray& a, double s); | 173 extern OCTAVE_API ComplexNDArray& operator /= (ComplexNDArray& a, double s); |
174 | 174 |
175 BSXFUN_STDOP_DECLS (ComplexNDArray, OCTAVE_API) | 175 BSXFUN_STDOP_DECLS (ComplexNDArray, OCTAVE_API) |