4514
|
1 /* |
|
2 |
|
3 Copyright (C) 2003 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_ComplexNDArray_h) |
|
24 #define octave_ComplexNDArray_h 1 |
|
25 |
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include "MArrayN.h" |
|
31 #include "CMatrix.h" |
|
32 |
|
33 #include "mx-defs.h" |
|
34 #include "mx-op-defs.h" |
|
35 |
|
36 class |
|
37 ComplexNDArray : public MArrayN<Complex> |
|
38 { |
|
39 public: |
|
40 |
|
41 ComplexNDArray (void) : MArrayN<Complex> () { } |
|
42 |
4587
|
43 ComplexNDArray (const dim_vector& dv) : MArrayN<Complex> (dv) { } |
4514
|
44 |
4587
|
45 ComplexNDArray (const dim_vector& dv, const Complex& val) |
|
46 : MArrayN<Complex> (dv, val) { } |
4514
|
47 |
|
48 ComplexNDArray (const ComplexNDArray& a) : MArrayN<Complex> (a) { } |
|
49 |
|
50 ComplexNDArray (const ComplexMatrix& a) : MArrayN<Complex> (a) { } |
|
51 |
|
52 ComplexNDArray (const MArrayN<Complex>& a) : MArrayN<Complex> (a) { } |
|
53 |
|
54 ComplexNDArray& operator = (const ComplexNDArray& a) |
|
55 { |
|
56 MArrayN<Complex>::operator = (a); |
|
57 return *this; |
|
58 } |
|
59 |
4543
|
60 // unary operations |
|
61 |
|
62 boolNDArray operator ! (void) const; |
|
63 |
4514
|
64 // XXX FIXME XXX -- this is not quite the right thing. |
|
65 |
4687
|
66 bool any_element_is_inf_or_nan (void) const; |
|
67 bool all_elements_are_real (void) const; |
|
68 bool all_integers (double& max_val, double& min_val) const; |
|
69 bool too_large_for_float (void) const; |
|
70 |
4556
|
71 boolNDArray all (int dim = -1) const; |
|
72 boolNDArray any (int dim = -1) const; |
4514
|
73 |
4584
|
74 ComplexNDArray cumprod (int dim = -1) const; |
|
75 ComplexNDArray cumsum (int dim = -1) const; |
4569
|
76 ComplexNDArray prod (int dim = -1) const; |
|
77 ComplexNDArray sum (int dim = -1) const; |
|
78 ComplexNDArray sumsq (int dim = -1) const; |
5073
|
79 ComplexNDArray concat (const ComplexNDArray& rb, const Array<int>& ra_idx); |
|
80 ComplexNDArray concat (const NDArray& rb, const Array<int>& ra_idx); |
4569
|
81 |
4844
|
82 ComplexNDArray max (int dim = 0) const; |
|
83 ComplexNDArray max (ArrayN<int>& index, int dim = 0) const; |
|
84 ComplexNDArray min (int dim = 0) const; |
|
85 ComplexNDArray min (ArrayN<int>& index, int dim = 0) const; |
|
86 |
4765
|
87 ComplexNDArray& insert (const NDArray& a, int r, int c); |
|
88 ComplexNDArray& insert (const ComplexNDArray& a, int r, int c); |
4915
|
89 ComplexNDArray& insert (const ComplexNDArray& a, const Array<int>& ra_idx); |
4765
|
90 |
4634
|
91 NDArray abs (void) const; |
4569
|
92 |
4773
|
93 ComplexNDArray fourier (int dim = 1) const; |
|
94 ComplexNDArray ifourier (int dim = 1) const; |
|
95 |
|
96 ComplexNDArray fourier2d (void) const; |
|
97 ComplexNDArray ifourier2d (void) const; |
|
98 |
|
99 ComplexNDArray fourierNd (void) const; |
|
100 ComplexNDArray ifourierNd (void) const; |
|
101 |
4514
|
102 ComplexMatrix matrix_value (void) const; |
|
103 |
4902
|
104 ComplexNDArray squeeze (void) const { return MArrayN<Complex>::squeeze (); } |
4532
|
105 |
|
106 static void increment_index (Array<int>& ra_idx, |
|
107 const dim_vector& dimensions, |
|
108 int start_dimension = 0); |
|
109 |
4556
|
110 static int compute_index (Array<int>& ra_idx, |
|
111 const dim_vector& dimensions); |
|
112 |
4514
|
113 // i/o |
|
114 |
4687
|
115 friend std::ostream& operator << (std::ostream& os, const ComplexNDArray& a); |
|
116 friend std::istream& operator >> (std::istream& is, ComplexNDArray& a); |
4514
|
117 |
|
118 static Complex resize_fill_value (void) { return Complex (0.0, 0.0); } |
|
119 |
|
120 // bool all_elements_are_real (void) const; |
|
121 // bool all_integers (double& max_val, double& min_val) const; |
|
122 |
|
123 private: |
|
124 |
4634
|
125 ComplexNDArray (Complex *d, const dim_vector& dv) |
4587
|
126 : MArrayN<Complex> (d, dv) { } |
4514
|
127 }; |
|
128 |
4844
|
129 extern ComplexNDArray min (const Complex& c, const ComplexNDArray& m); |
|
130 extern ComplexNDArray min (const ComplexNDArray& m, const Complex& c); |
|
131 extern ComplexNDArray min (const ComplexNDArray& a, const ComplexNDArray& b); |
|
132 |
|
133 extern ComplexNDArray max (const Complex& c, const ComplexNDArray& m); |
|
134 extern ComplexNDArray max (const ComplexNDArray& m, const Complex& c); |
|
135 extern ComplexNDArray max (const ComplexNDArray& a, const ComplexNDArray& b); |
|
136 |
4543
|
137 NDS_CMP_OP_DECLS (ComplexNDArray, Complex) |
|
138 NDS_BOOL_OP_DECLS (ComplexNDArray, Complex) |
|
139 |
|
140 SND_CMP_OP_DECLS (Complex, ComplexNDArray) |
|
141 SND_BOOL_OP_DECLS (Complex, ComplexNDArray) |
|
142 |
|
143 NDND_CMP_OP_DECLS (ComplexNDArray, ComplexNDArray) |
|
144 NDND_BOOL_OP_DECLS (ComplexNDArray, ComplexNDArray) |
|
145 |
4514
|
146 MARRAY_FORWARD_DEFS (MArrayN, ComplexNDArray, Complex) |
|
147 |
|
148 #endif |
|
149 |
|
150 /* |
|
151 ;;; Local Variables: *** |
|
152 ;;; mode: C++ *** |
|
153 ;;; End: *** |
|
154 */ |