00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_ComplexNDArray_h)
00024 #define octave_ComplexNDArray_h 1
00025
00026 #include "MArrayN.h"
00027 #include "CMatrix.h"
00028
00029 #include "mx-defs.h"
00030 #include "mx-op-decl.h"
00031
00032 class
00033 OCTAVE_API
00034 ComplexNDArray : public MArrayN<Complex>
00035 {
00036 public:
00037
00038 typedef ComplexMatrix matrix_type;
00039
00040 ComplexNDArray (void) : MArrayN<Complex> () { }
00041
00042 ComplexNDArray (const dim_vector& dv) : MArrayN<Complex> (dv) { }
00043
00044 ComplexNDArray (const dim_vector& dv, const Complex& val)
00045 : MArrayN<Complex> (dv, val) { }
00046
00047 ComplexNDArray (const ComplexNDArray& a) : MArrayN<Complex> (a) { }
00048
00049 ComplexNDArray (const ComplexMatrix& a) : MArrayN<Complex> (a) { }
00050
00051 template <class U>
00052 ComplexNDArray (const MArrayN<U>& a) : MArrayN<Complex> (a) { }
00053
00054 template <class U>
00055 ComplexNDArray (const Array<U>& a) : MArrayN<Complex> (a) { }
00056
00057 ComplexNDArray (const charNDArray&);
00058
00059 ComplexNDArray& operator = (const ComplexNDArray& a)
00060 {
00061 MArrayN<Complex>::operator = (a);
00062 return *this;
00063 }
00064
00065
00066
00067 boolNDArray operator ! (void) const;
00068
00069
00070
00071 bool any_element_is_nan (void) const;
00072 bool any_element_is_inf_or_nan (void) const;
00073 bool all_elements_are_real (void) const;
00074 bool all_integers (double& max_val, double& min_val) const;
00075 bool too_large_for_float (void) const;
00076
00077 boolNDArray all (int dim = -1) const;
00078 boolNDArray any (int dim = -1) const;
00079
00080 ComplexNDArray cumprod (int dim = -1) const;
00081 ComplexNDArray cumsum (int dim = -1) const;
00082 ComplexNDArray prod (int dim = -1) const;
00083 ComplexNDArray sum (int dim = -1) const;
00084 ComplexNDArray xsum (int dim = -1) const;
00085 ComplexNDArray sumsq (int dim = -1) const;
00086 ComplexNDArray concat (const ComplexNDArray& rb, const Array<octave_idx_type>& ra_idx);
00087 ComplexNDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx);
00088
00089 ComplexNDArray max (int dim = 0) const;
00090 ComplexNDArray max (Array<octave_idx_type>& index, int dim = 0) const;
00091 ComplexNDArray min (int dim = 0) const;
00092 ComplexNDArray min (Array<octave_idx_type>& index, int dim = 0) const;
00093
00094 ComplexNDArray cummax (int dim = 0) const;
00095 ComplexNDArray cummax (Array<octave_idx_type>& index, int dim = 0) const;
00096 ComplexNDArray cummin (int dim = 0) const;
00097 ComplexNDArray cummin (Array<octave_idx_type>& index, int dim = 0) const;
00098
00099 ComplexNDArray diff (octave_idx_type order = 1, int dim = 0) const;
00100
00101 ComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_type c);
00102 ComplexNDArray& insert (const ComplexNDArray& a, octave_idx_type r, octave_idx_type c);
00103 ComplexNDArray& insert (const ComplexNDArray& a, const Array<octave_idx_type>& ra_idx);
00104
00105 NDArray abs (void) const;
00106 boolNDArray isnan (void) const;
00107 boolNDArray isinf (void) const;
00108 boolNDArray isfinite (void) const;
00109
00110 friend OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a);
00111
00112 ComplexNDArray fourier (int dim = 1) const;
00113 ComplexNDArray ifourier (int dim = 1) const;
00114
00115 ComplexNDArray fourier2d (void) const;
00116 ComplexNDArray ifourier2d (void) const;
00117
00118 ComplexNDArray fourierNd (void) const;
00119 ComplexNDArray ifourierNd (void) const;
00120
00121 ComplexMatrix matrix_value (void) const;
00122
00123 ComplexNDArray squeeze (void) const { return MArrayN<Complex>::squeeze (); }
00124
00125 static void increment_index (Array<octave_idx_type>& ra_idx,
00126 const dim_vector& dimensions,
00127 int start_dimension = 0);
00128
00129 static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx,
00130 const dim_vector& dimensions);
00131
00132
00133
00134 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexNDArray& a);
00135 friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexNDArray& a);
00136
00137 static Complex resize_fill_value (void) { return Complex (0.0, 0.0); }
00138
00139
00140
00141
00142 ComplexNDArray diag (octave_idx_type k = 0) const;
00143
00144 ComplexNDArray& changesign (void)
00145 {
00146 MArrayN<Complex>::changesign ();
00147 return *this;
00148 }
00149
00150 typedef double (*dmapper) (const Complex&);
00151 typedef Complex (*cmapper) (const Complex&);
00152 typedef bool (*bmapper) (const Complex&);
00153
00154 NDArray map (dmapper fcn) const;
00155 ComplexNDArray map (cmapper fcn) const;
00156 boolNDArray map (bmapper fcn) const;
00157
00158 private:
00159
00160 ComplexNDArray (Complex *d, const dim_vector& dv)
00161 : MArrayN<Complex> (d, dv) { }
00162 };
00163
00164 extern OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a);
00165
00166 extern OCTAVE_API ComplexNDArray min (const Complex& c, const ComplexNDArray& m);
00167 extern OCTAVE_API ComplexNDArray min (const ComplexNDArray& m, const Complex& c);
00168 extern OCTAVE_API ComplexNDArray min (const ComplexNDArray& a, const ComplexNDArray& b);
00169
00170 extern OCTAVE_API ComplexNDArray max (const Complex& c, const ComplexNDArray& m);
00171 extern OCTAVE_API ComplexNDArray max (const ComplexNDArray& m, const Complex& c);
00172 extern OCTAVE_API ComplexNDArray max (const ComplexNDArray& a, const ComplexNDArray& b);
00173
00174 NDS_CMP_OP_DECLS (ComplexNDArray, Complex, OCTAVE_API)
00175 NDS_BOOL_OP_DECLS (ComplexNDArray, Complex, OCTAVE_API)
00176
00177 SND_CMP_OP_DECLS (Complex, ComplexNDArray, OCTAVE_API)
00178 SND_BOOL_OP_DECLS (Complex, ComplexNDArray, OCTAVE_API)
00179
00180 NDND_CMP_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API)
00181 NDND_BOOL_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API)
00182
00183 MARRAY_FORWARD_DEFS (MArrayN, ComplexNDArray, Complex)
00184
00185 extern OCTAVE_API ComplexNDArray& operator *= (ComplexNDArray& a, double s);
00186 extern OCTAVE_API ComplexNDArray& operator /= (ComplexNDArray& a, double s);
00187
00188 #endif
00189
00190
00191
00192
00193
00194