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_FloatNDArray_h)
00024 #define octave_FloatNDArray_h 1
00025
00026 #include "MArray.h"
00027 #include "fMatrix.h"
00028 #include "intNDArray.h"
00029
00030 #include "mx-defs.h"
00031 #include "mx-op-decl.h"
00032 #include "bsxfun-decl.h"
00033
00034 class
00035 OCTAVE_API
00036 FloatNDArray : public MArray<float>
00037 {
00038 public:
00039
00040 typedef FloatMatrix matrix_type;
00041
00042 FloatNDArray (void) : MArray<float> () { }
00043
00044 FloatNDArray (const dim_vector& dv) : MArray<float> (dv) { }
00045
00046 FloatNDArray (const dim_vector& dv, float val)
00047 : MArray<float> (dv, val) { }
00048
00049 FloatNDArray (const FloatNDArray& a) : MArray<float> (a) { }
00050
00051 FloatNDArray (const FloatMatrix& a) : MArray<float> (a) { }
00052
00053 template <class U>
00054 FloatNDArray (const MArray<U>& a) : MArray<float> (a) { }
00055
00056 template <class U>
00057 FloatNDArray (const Array<U>& a) : MArray<float> (a) { }
00058
00059 template <class U>
00060 explicit FloatNDArray (const intNDArray<U>& a) : MArray<float> (a) { }
00061
00062 FloatNDArray (const charNDArray&);
00063
00064 FloatNDArray& operator = (const FloatNDArray& a)
00065 {
00066 MArray<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_positive (bool = false) const;
00076 bool any_element_is_nan (void) const;
00077 bool any_element_is_inf_or_nan (void) const;
00078 bool any_element_not_one_or_zero (void) const;
00079 bool all_elements_are_zero (void) const;
00080 bool all_elements_are_int_or_inf_or_nan (void) const;
00081 bool all_integers (float& max_val, float& min_val) const;
00082 bool all_integers (void) const;
00083 bool too_large_for_float (void) const;
00084
00085
00086
00087 boolNDArray all (int dim = -1) const;
00088 boolNDArray any (int dim = -1) const;
00089
00090 FloatNDArray cumprod (int dim = -1) const;
00091 FloatNDArray cumsum (int dim = -1) const;
00092 FloatNDArray prod (int dim = -1) const;
00093 FloatNDArray sum (int dim = -1) const;
00094 NDArray dsum (int dim = -1) const;
00095 FloatNDArray sumsq (int dim = -1) const;
00096 FloatNDArray concat (const FloatNDArray& rb, const Array<octave_idx_type>& ra_idx);
00097 FloatComplexNDArray concat (const FloatComplexNDArray& rb, const Array<octave_idx_type>& ra_idx);
00098 charNDArray concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx);
00099
00100 FloatNDArray max (int dim = -1) const;
00101 FloatNDArray max (Array<octave_idx_type>& index, int dim = -1) const;
00102 FloatNDArray min (int dim = -1) const;
00103 FloatNDArray min (Array<octave_idx_type>& index, int dim = -1) const;
00104
00105 FloatNDArray cummax (int dim = -1) const;
00106 FloatNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const;
00107 FloatNDArray cummin (int dim = -1) const;
00108 FloatNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const;
00109
00110 FloatNDArray diff (octave_idx_type order = 1, int dim = -1) const;
00111
00112 FloatNDArray& insert (const FloatNDArray& a, octave_idx_type r, octave_idx_type c);
00113 FloatNDArray& insert (const FloatNDArray& a, const Array<octave_idx_type>& ra_idx);
00114
00115 FloatNDArray abs (void) const;
00116 boolNDArray isnan (void) const;
00117 boolNDArray isinf (void) const;
00118 boolNDArray isfinite (void) const;
00119
00120 FloatComplexNDArray fourier (int dim = 1) const;
00121 FloatComplexNDArray ifourier (int dim = 1) const;
00122
00123 FloatComplexNDArray fourier2d (void) const;
00124 FloatComplexNDArray ifourier2d (void) const;
00125
00126 FloatComplexNDArray fourierNd (void) const;
00127 FloatComplexNDArray ifourierNd (void) const;
00128
00129 friend OCTAVE_API FloatNDArray real (const FloatComplexNDArray& a);
00130 friend OCTAVE_API FloatNDArray imag (const FloatComplexNDArray& a);
00131
00132 friend class FloatComplexNDArray;
00133
00134 FloatMatrix matrix_value (void) const;
00135
00136 FloatNDArray squeeze (void) const { return MArray<float>::squeeze (); }
00137
00138 static void increment_index (Array<octave_idx_type>& ra_idx,
00139 const dim_vector& dimensions,
00140 int start_dimension = 0);
00141
00142 static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx,
00143 const dim_vector& dimensions);
00144
00145
00146
00147 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatNDArray& a);
00148 friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatNDArray& a);
00149
00150 static float resize_fill_value (void) { return 0; }
00151
00152 FloatNDArray diag (octave_idx_type k = 0) const;
00153
00154 FloatNDArray& changesign (void)
00155 {
00156 MArray<float>::changesign ();
00157 return *this;
00158 }
00159
00160 };
00161
00162
00163
00164 extern OCTAVE_API FloatNDArray real (const FloatComplexNDArray& a);
00165 extern OCTAVE_API FloatNDArray imag (const FloatComplexNDArray& a);
00166
00167 MINMAX_DECLS (FloatNDArray, float, OCTAVE_API)
00168
00169 NDS_CMP_OP_DECLS (FloatNDArray, float, OCTAVE_API)
00170 NDS_BOOL_OP_DECLS (FloatNDArray, float, OCTAVE_API)
00171
00172 SND_CMP_OP_DECLS (float, FloatNDArray, OCTAVE_API)
00173 SND_BOOL_OP_DECLS (float, FloatNDArray, OCTAVE_API)
00174
00175 NDND_CMP_OP_DECLS (FloatNDArray, FloatNDArray, OCTAVE_API)
00176 NDND_BOOL_OP_DECLS (FloatNDArray, FloatNDArray, OCTAVE_API)
00177
00178 MARRAY_FORWARD_DEFS (MArray, FloatNDArray, float)
00179
00180 BSXFUN_STDOP_DECLS (FloatNDArray, OCTAVE_API)
00181 BSXFUN_STDREL_DECLS (FloatNDArray, OCTAVE_API)
00182
00183 BSXFUN_OP_DECL (pow, FloatNDArray, OCTAVE_API)
00184 BSXFUN_OP2_DECL (pow, FloatComplexNDArray, FloatComplexNDArray,
00185 FloatNDArray, OCTAVE_API)
00186 BSXFUN_OP2_DECL (pow, FloatComplexNDArray, FloatNDArray,
00187 FloatComplexNDArray, OCTAVE_API)
00188
00189 #endif