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