メインページ   クラス階層   構成   ファイル一覧   構成メンバ   ファイルメンバ  

dNDArray.h

解説を見る。
00001 /*
00002 
00003 Copyright (C) 1996, 1997 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 2, or (at your option) any
00010 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, write to the Free
00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 */
00022 
00023 #if !defined (octave_NDArray_h)
00024 #define octave_NDArray_h 1
00025 
00026 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
00027 #pragma interface
00028 #endif
00029 
00030 #include "MArrayN.h"
00031 #include "dMatrix.h"
00032 #include "intNDArray.h"
00033 
00034 #include "mx-defs.h"
00035 #include "mx-op-defs.h"
00036 
00037 class
00038 NDArray : public MArrayN<double>
00039 {
00040 public:
00041   
00042   NDArray (void) : MArrayN<double> () { }
00043 
00044   NDArray (const dim_vector& dv) : MArrayN<double> (dv) { }
00045 
00046   NDArray (const dim_vector& dv, double val)
00047     : MArrayN<double> (dv, val) { }
00048   
00049   NDArray (const NDArray& a) : MArrayN<double> (a) { }
00050 
00051   NDArray (const Matrix& a) : MArrayN<double> (a) { }
00052 
00053   NDArray (const MArrayN<double>& a) : MArrayN<double> (a) { }
00054 
00055   template <class U>
00056   explicit NDArray (const intNDArray<U>& a) : MArrayN<double> (a) { }
00057 
00058   NDArray& operator = (const NDArray& a)
00059     {
00060       MArrayN<double>::operator = (a);
00061       return *this;
00062     }
00063 
00064   // unary operations
00065 
00066   boolNDArray operator ! (void) const;
00067 
00068   bool any_element_is_negative (bool = false) const;
00069   bool any_element_is_inf_or_nan (void) const;
00070   bool all_elements_are_int_or_inf_or_nan (void) const;
00071   bool all_integers (double& max_val, double& min_val) const;
00072   bool too_large_for_float (void) const;
00073 
00074   // XXX FIXME XXX -- this is not quite the right thing.
00075 
00076   boolNDArray all (int dim = -1) const;
00077   boolNDArray any (int dim = -1) const;
00078 
00079   NDArray cumprod (int dim = -1) const;
00080   NDArray cumsum (int dim = -1) const;
00081   NDArray prod (int dim = -1) const;
00082   NDArray sum (int dim = -1) const;  
00083   NDArray sumsq (int dim = -1) const;
00084   NDArray concat (const NDArray& rb, const Array<int>& ra_idx);
00085   ComplexNDArray concat (const ComplexNDArray& rb, const Array<int>& ra_idx);
00086   charNDArray concat (const charNDArray& rb, const Array<int>& ra_idx);
00087 
00088   NDArray max (int dim = 0) const;
00089   NDArray max (ArrayN<int>& index, int dim = 0) const;
00090   NDArray min (int dim = 0) const;
00091   NDArray min (ArrayN<int>& index, int dim = 0) const;
00092   
00093   NDArray& insert (const NDArray& a, int r, int c);
00094   NDArray& insert (const NDArray& a, const Array<int>& ra_idx);
00095 
00096   NDArray abs (void) const;
00097 
00098   ComplexNDArray fourier (int dim = 1) const;
00099   ComplexNDArray ifourier (int dim = 1) const;
00100 
00101   ComplexNDArray fourier2d (void) const;
00102   ComplexNDArray ifourier2d (void) const;
00103 
00104   ComplexNDArray fourierNd (void) const;
00105   ComplexNDArray ifourierNd (void) const;
00106 
00107   friend NDArray real (const ComplexNDArray& a);
00108   friend NDArray imag (const ComplexNDArray& a);
00109 
00110   Matrix matrix_value (void) const;
00111 
00112   NDArray squeeze (void) const { return MArrayN<double>::squeeze (); }
00113 
00114   static void increment_index (Array<int>& ra_idx,
00115                                const dim_vector& dimensions,
00116                                int start_dimension = 0);
00117 
00118   static int compute_index (Array<int>& ra_idx,
00119                             const dim_vector& dimensions);
00120 
00121   // i/o
00122 
00123   friend std::ostream& operator << (std::ostream& os, const NDArray& a);
00124   friend std::istream& operator >> (std::istream& is, NDArray& a);
00125 
00126   static double resize_fill_value (void) { return 0; }
00127 
00128 private:
00129 
00130   NDArray (double *d, const dim_vector& dv) : MArrayN<double> (d, dv) { }
00131 };
00132 
00133 extern NDArray min (double d, const NDArray& m);
00134 extern NDArray min (const NDArray& m, double d);
00135 extern NDArray min (const NDArray& a, const NDArray& b);
00136 
00137 extern NDArray max (double d, const NDArray& m);
00138 extern NDArray max (const NDArray& m, double d);
00139 extern NDArray max (const NDArray& a, const NDArray& b);
00140 
00141 NDS_CMP_OP_DECLS (NDArray, double)
00142 NDS_BOOL_OP_DECLS (NDArray, double)
00143 
00144 SND_CMP_OP_DECLS (double, NDArray)
00145 SND_BOOL_OP_DECLS (double, NDArray)
00146 
00147 NDND_CMP_OP_DECLS (NDArray, NDArray)
00148 NDND_BOOL_OP_DECLS (NDArray, NDArray)
00149 
00150 MARRAY_FORWARD_DEFS (MArrayN, NDArray, double)
00151 
00152 #endif
00153 
00154 /*
00155 ;;; Local Variables: ***
00156 ;;; mode: C++ ***
00157 ;;; End: ***
00158 */

Wed Dec 29 11:51:29 2004に生成されました。 doxygen1.2.18
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送