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

MDiagArray2.h

解説を見る。
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_MDiagArray2_h)
00029 #define octave_MDiagArray2_h 1
00030 
00031 #include "DiagArray2.h"
00032 #include "MArray2.h"
00033 
00034 // Two dimensional diagonal array with math ops.
00035 
00036 // But first, some preprocessor abuse...
00037 
00038 #include "MArray-defs.h"
00039 
00040 MDIAGARRAY2_OPS_FORWARD_DECLS (MDiagArray2)
00041 
00042 template <class T>
00043 class
00044 MDiagArray2 : public DiagArray2<T>
00045 {
00046 protected:
00047 
00048   MDiagArray2 (T *d, int r, int c) : DiagArray2<T> (d, r, c) { }
00049 
00050 public:
00051   
00052   MDiagArray2 (void) : DiagArray2<T> () { }
00053 
00054   MDiagArray2 (int r, int c) : DiagArray2<T> (r, c) { }
00055 
00056   MDiagArray2 (int r, int c, const T& val) : DiagArray2<T> (r, c, val) { }
00057 
00058   MDiagArray2 (const MDiagArray2<T>& a) : DiagArray2<T> (a) { }
00059 
00060   MDiagArray2 (const DiagArray2<T>& a) : DiagArray2<T> (a) { }
00061 
00062   explicit MDiagArray2 (const Array<T>& a) : DiagArray2<T> (a) { }
00063 
00064   ~MDiagArray2 (void) { }
00065 
00066   MDiagArray2<T>& operator = (const MDiagArray2<T>& a)
00067     {
00068       DiagArray2<T>::operator = (a);
00069       return *this;
00070     }
00071 
00072   operator MArray2<T> () const
00073     {
00074       int nr = DiagArray2<T>::dim1 ();
00075       int nc = DiagArray2<T>::dim2 ();
00076 
00077       MArray2<T> retval (nr, nc,  T (0));
00078 
00079       int len = nr < nc ? nr : nc;
00080 
00081       for (int i = 0; i < len; i++)
00082         retval.xelem (i, i) = this->xelem (i, i);
00083 
00084       return retval;
00085     }
00086 
00087   static MDiagArray2<T> nil_array;
00088 
00089   // Currently, the OPS functions don't need to be friends, but that
00090   // may change.
00091 
00092   // MDIAGARRAY2_OPS_FRIEND_DECLS (MDiagArray2)
00093 
00094 };
00095 
00096 #endif
00097 
00098 /*
00099 ;;; Local Variables: ***
00100 ;;; mode: C++ ***
00101 ;;; End: ***
00102 */

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