fCNDArray.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2003-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_FloatComplexNDArray_h)
00024 #define octave_FloatComplexNDArray_h 1
00025 
00026 #include "MArray.h"
00027 #include "fCMatrix.h"
00028 
00029 #include "mx-defs.h"
00030 #include "mx-op-decl.h"
00031 #include "bsxfun-decl.h"
00032 
00033 class
00034 OCTAVE_API
00035 FloatComplexNDArray : public MArray<FloatComplex>
00036 {
00037 public:
00038 
00039   typedef FloatComplexMatrix matrix_type;
00040 
00041   FloatComplexNDArray (void) : MArray<FloatComplex> () { }
00042 
00043   FloatComplexNDArray (const dim_vector& dv) : MArray<FloatComplex> (dv) { }
00044 
00045   FloatComplexNDArray (const dim_vector& dv, const FloatComplex& val)
00046     : MArray<FloatComplex> (dv, val) { }
00047 
00048   FloatComplexNDArray (const FloatComplexNDArray& a) : MArray<FloatComplex> (a) { }
00049 
00050   FloatComplexNDArray (const FloatComplexMatrix& a) : MArray<FloatComplex> (a) { }
00051 
00052   template <class U>
00053   FloatComplexNDArray (const MArray<U>& a) : MArray<FloatComplex> (a) { }
00054 
00055   template <class U>
00056   FloatComplexNDArray (const Array<U>& a) : MArray<FloatComplex> (a) { }
00057 
00058   FloatComplexNDArray (const charNDArray&);
00059 
00060   FloatComplexNDArray& operator = (const FloatComplexNDArray& a)
00061     {
00062       MArray<FloatComplex>::operator = (a);
00063       return *this;
00064     }
00065 
00066   // unary operations
00067 
00068   boolNDArray operator ! (void) const;
00069 
00070   // FIXME -- this is not quite the right thing.
00071 
00072   bool any_element_is_nan (void) const;
00073   bool any_element_is_inf_or_nan (void) const;
00074   bool all_elements_are_real (void) const;
00075   bool all_integers (float& max_val, float& min_val) const;
00076   bool too_large_for_float (void) const;
00077 
00078   boolNDArray all (int dim = -1) const;
00079   boolNDArray any (int dim = -1) const;
00080 
00081   FloatComplexNDArray cumprod (int dim = -1) const;
00082   FloatComplexNDArray cumsum (int dim = -1) const;
00083   FloatComplexNDArray prod (int dim = -1) const;
00084   FloatComplexNDArray sum (int dim = -1) const;
00085        ComplexNDArray dsum (int dim = -1) const;
00086   FloatComplexNDArray sumsq (int dim = -1) const;
00087   FloatComplexNDArray concat (const FloatComplexNDArray& rb, const Array<octave_idx_type>& ra_idx);
00088   FloatComplexNDArray concat (const FloatNDArray& rb, const Array<octave_idx_type>& ra_idx);
00089 
00090   FloatComplexNDArray max (int dim = -1) const;
00091   FloatComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) const;
00092   FloatComplexNDArray min (int dim = -1) const;
00093   FloatComplexNDArray min (Array<octave_idx_type>& index, int dim = -1) const;
00094 
00095   FloatComplexNDArray cummax (int dim = -1) const;
00096   FloatComplexNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const;
00097   FloatComplexNDArray cummin (int dim = -1) const;
00098   FloatComplexNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const;
00099 
00100   FloatComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const;
00101 
00102   FloatComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_type c);
00103   FloatComplexNDArray& insert (const FloatComplexNDArray& a, octave_idx_type r, octave_idx_type c);
00104   FloatComplexNDArray& insert (const FloatComplexNDArray& a, const Array<octave_idx_type>& ra_idx);
00105 
00106   FloatNDArray abs (void) const;
00107   boolNDArray isnan (void) const;
00108   boolNDArray isinf (void) const;
00109   boolNDArray isfinite (void) const;
00110 
00111   friend OCTAVE_API FloatComplexNDArray conj (const FloatComplexNDArray& a);
00112 
00113   FloatComplexNDArray fourier (int dim = 1) const;
00114   FloatComplexNDArray ifourier (int dim = 1) const;
00115 
00116   FloatComplexNDArray fourier2d (void) const;
00117   FloatComplexNDArray ifourier2d (void) const;
00118 
00119   FloatComplexNDArray fourierNd (void) const;
00120   FloatComplexNDArray ifourierNd (void) const;
00121 
00122   FloatComplexMatrix matrix_value (void) const;
00123 
00124   FloatComplexNDArray squeeze (void) const { return MArray<FloatComplex>::squeeze (); }
00125 
00126   static void increment_index (Array<octave_idx_type>& ra_idx,
00127                                const dim_vector& dimensions,
00128                                int start_dimension = 0);
00129 
00130   static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx,
00131                             const dim_vector& dimensions);
00132 
00133   // i/o
00134 
00135   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexNDArray& a);
00136   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexNDArray& a);
00137 
00138   static FloatComplex resize_fill_value (void) { return FloatComplex (0.0, 0.0); }
00139 
00140   //  bool all_elements_are_real (void) const;
00141   //  bool all_integers (float& max_val, float& min_val) const;
00142 
00143   FloatComplexNDArray diag (octave_idx_type k = 0) const;
00144 
00145   FloatComplexNDArray& changesign (void)
00146     {
00147       MArray<FloatComplex>::changesign ();
00148       return *this;
00149     }
00150 
00151 };
00152 
00153 extern OCTAVE_API FloatComplexNDArray conj (const FloatComplexNDArray& a);
00154 
00155 MINMAX_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API)
00156 
00157 NDS_CMP_OP_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API)
00158 NDS_BOOL_OP_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API)
00159 
00160 SND_CMP_OP_DECLS (FloatComplex, FloatComplexNDArray, OCTAVE_API)
00161 SND_BOOL_OP_DECLS (FloatComplex, FloatComplexNDArray, OCTAVE_API)
00162 
00163 NDND_CMP_OP_DECLS (FloatComplexNDArray, FloatComplexNDArray, OCTAVE_API)
00164 NDND_BOOL_OP_DECLS (FloatComplexNDArray, FloatComplexNDArray, OCTAVE_API)
00165 
00166 MARRAY_FORWARD_DEFS (MArray, FloatComplexNDArray, FloatComplex)
00167 
00168 extern OCTAVE_API FloatComplexNDArray& operator *= (FloatComplexNDArray& a, float s);
00169 extern OCTAVE_API FloatComplexNDArray& operator /= (FloatComplexNDArray& a, float s);
00170 
00171 BSXFUN_STDOP_DECLS (FloatComplexNDArray, OCTAVE_API)
00172 BSXFUN_STDREL_DECLS (FloatComplexNDArray, OCTAVE_API)
00173 
00174 BSXFUN_OP_DECL (pow, FloatComplexNDArray, OCTAVE_API)
00175 
00176 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines