00001 // Template array classes with like-type math ops 00002 /* 00003 00004 Copyright (C) 1996, 1997 John W. Eaton 00005 00006 This file is part of Octave. 00007 00008 Octave is free software; you can redistribute it and/or modify it 00009 under the terms of the GNU General Public License as published by the 00010 Free Software Foundation; either version 2, or (at your option) any 00011 later version. 00012 00013 Octave is distributed in the hope that it will be useful, but WITHOUT 00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00015 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00016 for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with Octave; see the file COPYING. If not, write to the Free 00020 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 00022 */ 00023 00024 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) 00025 #pragma interface 00026 #endif 00027 00028 #if !defined (octave_MArrayN_h) 00029 #define octave_MArrayN_h 1 00030 00031 #include "ArrayN.h" 00032 #include "MArray2.h" 00033 #include "dim-vector.h" 00034 00035 // N-dimensional array with math ops. 00036 00037 // But first, some preprocessor abuse... 00038 00039 #include "MArray-defs.h" 00040 00041 MARRAY_OPS_FORWARD_DECLS (MArrayN) 00042 00043 template <class T> 00044 class 00045 MArrayN : public ArrayN<T> 00046 { 00047 protected: 00048 00049 MArrayN (T *d, const dim_vector& dv) : ArrayN<T> (d, dv) { } 00050 00051 public: 00052 00053 MArrayN (void) : ArrayN<T> () {} 00054 00055 MArrayN (const dim_vector& dv) : ArrayN<T> (dv) { } 00056 00057 MArrayN (const dim_vector& dv, const T& val) : ArrayN<T> (dv, val) { } 00058 00059 template <class U> 00060 explicit MArrayN (const Array2<U>& a) : ArrayN<T> (a) { } 00061 00062 template <class U> 00063 MArrayN (const ArrayN<U>& a) : ArrayN<T> (a) { } 00064 00065 template <class U> 00066 MArrayN (const MArrayN<U>& a) : ArrayN<T> (a) { } 00067 00068 ~MArrayN (void) { } 00069 00070 MArrayN<T>& operator = (const MArrayN<T>& a) 00071 { 00072 ArrayN<T>::operator = (a); 00073 return *this; 00074 } 00075 00076 MArrayN<T> reshape (const dim_vector& new_dims) const 00077 { return ArrayN<T>::reshape (new_dims); } 00078 00079 MArrayN<T> permute (const Array<int>& vec, bool inv = false) const 00080 { return ArrayN<T>::permute (vec, inv); } 00081 00082 MArrayN<T> ipermute (const Array<int>& vec) const 00083 { return ArrayN<T>::ipermute (vec); } 00084 00085 MArrayN squeeze (void) const { return ArrayN<T>::squeeze (); } 00086 }; 00087 00088 #endif 00089 00090 /* 00091 ;;; Local Variables: *** 00092 ;;; mode: C++ *** 00093 ;;; End: *** 00094 */
SEO | [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送 | ||