00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SELDON_FILE_MATRIX_TRIANGPACKED_HXX
00024
00025 #include "../share/Common.hxx"
00026 #include "../share/Properties.hxx"
00027 #include "../share/Storage.hxx"
00028 #include "../share/Errors.hxx"
00029 #include "../share/Allocator.hxx"
00030
00031 namespace Seldon
00032 {
00033
00034
00036 template <class T, class Prop, class Storage,
00037 class Allocator = SELDON_DEFAULT_ALLOCATOR<T> >
00038 class Matrix_TriangPacked: public Matrix_Base<T, Allocator>
00039 {
00040
00041 public:
00042 typedef typename Allocator::value_type value_type;
00043 typedef typename Allocator::pointer pointer;
00044 typedef typename Allocator::const_pointer const_pointer;
00045 typedef typename Allocator::reference reference;
00046 typedef typename Allocator::const_reference const_reference;
00047 typedef typename Allocator::value_type entry_type;
00048 typedef typename Allocator::reference access_type;
00049 typedef typename Allocator::const_reference const_access_type;
00050
00051
00052 protected:
00053
00054
00055 public:
00056
00057 Matrix_TriangPacked();
00058 Matrix_TriangPacked(int i, int j = 0);
00059 Matrix_TriangPacked(const Matrix_TriangPacked<T, Prop, Storage,
00060 Allocator>& A);
00061
00062
00063 ~Matrix_TriangPacked();
00064 void Clear();
00065
00066
00067 int GetDataSize() const;
00068
00069
00070 void Reallocate(int i, int j);
00071 void SetData(int i, int j, pointer data);
00072 void Nullify();
00073
00074
00075 reference operator() (int i, int j);
00076 value_type operator() (int i, int j) const;
00077 reference Val(int i, int j);
00078 const_reference Val(int i, int j) const;
00079 reference operator[] (int i);
00080 const_reference operator[] (int i) const;
00081 Matrix_TriangPacked<T, Prop, Storage, Allocator>&
00082 operator= (const Matrix_TriangPacked<T, Prop, Storage, Allocator>& A);
00083 void Copy(const Matrix_TriangPacked<T, Prop, Storage, Allocator>& A);
00084
00085
00086 void Zero();
00087 void SetIdentity();
00088 void Fill();
00089 template <class T0>
00090 void Fill(const T0& x);
00091 template <class T0>
00092 Matrix_TriangPacked<T, Prop, Storage, Allocator>& operator= (const T0& x);
00093 void FillRand();
00094 void Print() const;
00095 void Print(int a, int b, int m, int n) const;
00096 void Print(int l) const;
00097
00098
00099 void Write(string FileName) const;
00100 void Write(ostream& FileStream) const;
00101 void WriteText(string FileName) const;
00102 void WriteText(ostream& FileStream) const;
00103 void Read(string FileName);
00104 void Read(istream& FileStream);
00105 void ReadText(string FileName);
00106 void ReadText(istream& FileStream);
00107
00108 };
00109
00110
00112 template <class T, class Prop, class Allocator>
00113 class Matrix<T, Prop, ColUpTriangPacked, Allocator>:
00114 public Matrix_TriangPacked<T, Prop, ColUpTriangPacked, Allocator>
00115 {
00116
00117 public:
00118 typedef typename Allocator::value_type value_type;
00119 typedef Prop property;
00120 typedef ColUpTriangPacked storage;
00121 typedef Allocator allocator;
00122
00123 public:
00124 Matrix();
00125 Matrix(int i, int j = 0);
00126 void Resize(int i, int j);
00127
00128 template <class T0>
00129 Matrix<T, Prop, ColUpTriangPacked, Allocator>& operator= (const T0& x);
00130 template<class T0>
00131 Matrix<T, Prop, ColUpTriangPacked, Allocator>& operator*= (const T0& x);
00132 };
00133
00134
00136 template <class T, class Prop, class Allocator>
00137 class Matrix<T, Prop, ColLoTriangPacked, Allocator>:
00138 public Matrix_TriangPacked<T, Prop, ColLoTriangPacked, Allocator>
00139 {
00140
00141 public:
00142 typedef typename Allocator::value_type value_type;
00143 typedef Prop property;
00144 typedef ColLoTriangPacked storage;
00145 typedef Allocator allocator;
00146
00147 public:
00148 Matrix();
00149 Matrix(int i, int j = 0);
00150 void Resize(int i, int j);
00151
00152 template <class T0>
00153 Matrix<T, Prop, ColLoTriangPacked, Allocator>& operator= (const T0& x);
00154 template<class T0>
00155 Matrix<T, Prop, ColLoTriangPacked, Allocator>& operator*= (const T0& x);
00156 };
00157
00158
00160 template <class T, class Prop, class Allocator>
00161 class Matrix<T, Prop, RowUpTriangPacked, Allocator>:
00162 public Matrix_TriangPacked<T, Prop, RowUpTriangPacked, Allocator>
00163 {
00164
00165 public:
00166 typedef typename Allocator::value_type value_type;
00167 typedef Prop property;
00168 typedef RowUpTriangPacked storage;
00169 typedef Allocator allocator;
00170
00171 public:
00172 Matrix();
00173 Matrix(int i, int j = 0);
00174 void Resize(int i, int j);
00175
00176 template <class T0>
00177 Matrix<T, Prop, RowUpTriangPacked, Allocator>& operator= (const T0& x);
00178 template<class T0>
00179 Matrix<T, Prop, RowUpTriangPacked, Allocator>& operator*= (const T0& x);
00180 };
00181
00182
00184 template <class T, class Prop, class Allocator>
00185 class Matrix<T, Prop, RowLoTriangPacked, Allocator>:
00186 public Matrix_TriangPacked<T, Prop, RowLoTriangPacked, Allocator>
00187 {
00188
00189 public:
00190 typedef typename Allocator::value_type value_type;
00191 typedef Prop property;
00192 typedef RowLoTriangPacked storage;
00193 typedef Allocator allocator;
00194
00195 public:
00196 Matrix();
00197 Matrix(int i, int j = 0);
00198 void Resize(int i, int j);
00199
00200 template <class T0>
00201 Matrix<T, Prop, RowLoTriangPacked, Allocator>& operator= (const T0& x);
00202 template<class T0>
00203 Matrix<T, Prop, RowLoTriangPacked, Allocator>& operator*= (const T0& x);
00204 };
00205
00206
00207 }
00208
00209 #define SELDON_FILE_MATRIX_TRIANGPACKED_HXX
00210 #endif