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_TRIANGULAR_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_Triangular: 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::value_type access_type;
00049 typedef typename Allocator::value_type const_access_type;
00050
00051
00052 protected:
00053 pointer* me_;
00054
00055
00056 public:
00057
00058 Matrix_Triangular();
00059 Matrix_Triangular(int i, int j);
00060 Matrix_Triangular(const Matrix_Triangular<T, Prop,
00061 Storage, Allocator>& A);
00062
00063
00064 ~Matrix_Triangular();
00065 void Clear();
00066
00067
00068 int GetDataSize() const;
00069
00070
00071 void Reallocate(int i, int j);
00072 void Resize(int i, int j);
00073 void SetData(int i, int j, pointer data);
00074 void Nullify();
00075
00076
00077 value_type operator() (int i, int j);
00078 value_type operator() (int i, int j) const;
00079 const_reference Val(int i, int j) const;
00080 reference Val(int i, int j);
00081 reference operator[] (int i);
00082 const_reference operator[] (int i) const;
00083 Matrix_Triangular<T, Prop, Storage, Allocator>&
00084 operator= (const Matrix_Triangular<T, Prop, Storage, Allocator>& A);
00085 void Copy(const Matrix_Triangular<T, Prop, Storage, Allocator>& A);
00086
00087
00088 void Zero();
00089 void SetIdentity();
00090 void Fill();
00091 template <class T0>
00092 void Fill(const T0& x);
00093 template <class T0>
00094 Matrix_Triangular<T, Prop, Storage, Allocator>& operator= (const T0& x);
00095 void FillRand();
00096 void Print() const;
00097 void Print(int a, int b, int m, int n) const;
00098 void Print(int l) const;
00099
00100
00101 void Write(string FileName) const;
00102 void Write(ostream& FileStream) const;
00103 void WriteText(string FileName) const;
00104 void WriteText(ostream& FileStream) const;
00105 void Read(string FileName);
00106 void Read(istream& FileStream);
00107 void ReadText(string FileName);
00108 void ReadText(istream& FileStream);
00109
00110 };
00111
00112
00114 template <class T, class Prop, class Allocator>
00115 class Matrix<T, Prop, ColUpTriang, Allocator>:
00116 public Matrix_Triangular<T, Prop, ColUpTriang, Allocator>
00117 {
00118
00119 public:
00120 typedef typename Allocator::value_type value_type;
00121 typedef Prop property;
00122 typedef ColUpTriang storage;
00123 typedef Allocator allocator;
00124
00125 public:
00126 Matrix() throw();
00127 Matrix(int i, int j);
00128
00129 template <class T0>
00130 Matrix<T, Prop, ColUpTriang, Allocator>& operator= (const T0& x);
00131 template<class T0>
00132 Matrix<T, Prop, ColUpTriang, Allocator>& operator*= (const T0& x);
00133
00134 };
00135
00136
00138 template <class T, class Prop, class Allocator>
00139 class Matrix<T, Prop, ColLoTriang, Allocator>:
00140 public Matrix_Triangular<T, Prop, ColLoTriang, Allocator>
00141 {
00142
00143 public:
00144 typedef typename Allocator::value_type value_type;
00145 typedef Prop property;
00146 typedef ColLoTriang storage;
00147 typedef Allocator allocator;
00148
00149 public:
00150 Matrix() throw();
00151 Matrix(int i, int j);
00152
00153 template <class T0>
00154 Matrix<T, Prop, ColLoTriang, Allocator>& operator= (const T0& x);
00155 template<class T0>
00156 Matrix<T, Prop, ColLoTriang, Allocator>& operator*= (const T0& x);
00157
00158 };
00159
00160
00162 template <class T, class Prop, class Allocator>
00163 class Matrix<T, Prop, RowUpTriang, Allocator>:
00164 public Matrix_Triangular<T, Prop, RowUpTriang, Allocator>
00165 {
00166
00167 public:
00168 typedef typename Allocator::value_type value_type;
00169 typedef Prop property;
00170 typedef RowUpTriang storage;
00171 typedef Allocator allocator;
00172
00173 public:
00174 Matrix() throw();
00175 Matrix(int i, int j);
00176
00177 template <class T0>
00178 Matrix<T, Prop, RowUpTriang, Allocator>& operator= (const T0& x);
00179 template<class T0>
00180 Matrix<T, Prop, RowUpTriang, Allocator>& operator*= (const T0& x);
00181
00182 };
00183
00184
00186 template <class T, class Prop, class Allocator>
00187 class Matrix<T, Prop, RowLoTriang, Allocator>:
00188 public Matrix_Triangular<T, Prop, RowLoTriang, Allocator>
00189 {
00190
00191 public:
00192 typedef typename Allocator::value_type value_type;
00193 typedef Prop property;
00194 typedef RowLoTriang storage;
00195 typedef Allocator allocator;
00196
00197 public:
00198 Matrix() throw();
00199 Matrix(int i, int j);
00200
00201 template <class T0>
00202 Matrix<T, Prop, RowLoTriang, Allocator>& operator= (const T0& x);
00203 template<class T0>
00204 Matrix<T, Prop, RowLoTriang, Allocator>& operator*= (const T0& x);
00205 };
00206
00207
00208 }
00209
00210 #define SELDON_FILE_MATRIX_TRIANGULAR_HXX
00211 #endif