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 #include "data-conv.h" |
|
37 #include "mach-info.h" |
|
38 |
|
39 class |
|
40 ComplexNDArray : public MArrayN<Complex> |
|
41 { |
|
42 public: |
|
43 |
|
44 ComplexNDArray (void) : MArrayN<Complex> () { } |
|
45 |
4587
|
46 ComplexNDArray (const dim_vector& dv) : MArrayN<Complex> (dv) { } |
4514
|
47 |
4587
|
48 ComplexNDArray (const dim_vector& dv, const Complex& val) |
|
49 : MArrayN<Complex> (dv, val) { } |
4514
|
50 |
|
51 ComplexNDArray (const ComplexNDArray& a) : MArrayN<Complex> (a) { } |
|
52 |
|
53 ComplexNDArray (const ComplexMatrix& a) : MArrayN<Complex> (a) { } |
|
54 |
|
55 ComplexNDArray (const MArrayN<Complex>& a) : MArrayN<Complex> (a) { } |
|
56 |
|
57 ComplexNDArray (const ArrayN<Complex>& a) : MArrayN<Complex> (a) { } |
|
58 |
4543
|
59 explicit ComplexNDArray (const NDArray& a); |
|
60 |
|
61 explicit ComplexNDArray (const boolNDArray& a); |
|
62 |
|
63 explicit ComplexNDArray (const charNDArray& a); |
|
64 |
4514
|
65 ComplexNDArray& operator = (const ComplexNDArray& a) |
|
66 { |
|
67 MArrayN<Complex>::operator = (a); |
|
68 return *this; |
|
69 } |
|
70 |
4543
|
71 // unary operations |
|
72 |
|
73 boolNDArray operator ! (void) const; |
|
74 |
4514
|
75 // XXX FIXME XXX -- this is not quite the right thing. |
|
76 |
4687
|
77 bool any_element_is_inf_or_nan (void) const; |
|
78 bool all_elements_are_real (void) const; |
|
79 bool all_integers (double& max_val, double& min_val) const; |
|
80 bool too_large_for_float (void) const; |
|
81 |
4556
|
82 boolNDArray all (int dim = -1) const; |
|
83 boolNDArray any (int dim = -1) const; |
4514
|
84 |
4584
|
85 ComplexNDArray cumprod (int dim = -1) const; |
|
86 ComplexNDArray cumsum (int dim = -1) const; |
4569
|
87 ComplexNDArray prod (int dim = -1) const; |
|
88 ComplexNDArray sum (int dim = -1) const; |
|
89 ComplexNDArray sumsq (int dim = -1) const; |
|
90 |
4634
|
91 NDArray abs (void) const; |
4569
|
92 |
4514
|
93 ComplexMatrix matrix_value (void) const; |
|
94 |
4532
|
95 ComplexNDArray squeeze (void) const { return ArrayN<Complex>::squeeze (); } |
|
96 |
|
97 static void increment_index (Array<int>& ra_idx, |
|
98 const dim_vector& dimensions, |
|
99 int start_dimension = 0); |
|
100 |
4556
|
101 static int compute_index (Array<int>& ra_idx, |
|
102 const dim_vector& dimensions); |
|
103 |
4514
|
104 // i/o |
|
105 |
4687
|
106 friend std::ostream& operator << (std::ostream& os, const ComplexNDArray& a); |
|
107 friend std::istream& operator >> (std::istream& is, ComplexNDArray& a); |
4514
|
108 |
|
109 static Complex resize_fill_value (void) { return Complex (0.0, 0.0); } |
|
110 |
|
111 // bool all_elements_are_real (void) const; |
|
112 // bool all_integers (double& max_val, double& min_val) const; |
|
113 |
|
114 private: |
|
115 |
4634
|
116 ComplexNDArray (Complex *d, const dim_vector& dv) |
4587
|
117 : MArrayN<Complex> (d, dv) { } |
4514
|
118 }; |
|
119 |
4543
|
120 NDS_CMP_OP_DECLS (ComplexNDArray, Complex) |
|
121 NDS_BOOL_OP_DECLS (ComplexNDArray, Complex) |
|
122 |
|
123 SND_CMP_OP_DECLS (Complex, ComplexNDArray) |
|
124 SND_BOOL_OP_DECLS (Complex, ComplexNDArray) |
|
125 |
|
126 NDND_CMP_OP_DECLS (ComplexNDArray, ComplexNDArray) |
|
127 NDND_BOOL_OP_DECLS (ComplexNDArray, ComplexNDArray) |
|
128 |
4514
|
129 MARRAY_FORWARD_DEFS (MArrayN, ComplexNDArray, Complex) |
|
130 |
|
131 #endif |
|
132 |
|
133 /* |
|
134 ;;; Local Variables: *** |
|
135 ;;; mode: C++ *** |
|
136 ;;; End: *** |
|
137 */ |