00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef SELDON_FILE_MATRIX_TRIANGPACKED_HXX
00023
00024 #include "../Common/Common.hxx"
00025 #include "../Common/Properties.hxx"
00026 #include "../Common/Storage.hxx"
00027 #include "../Common/Errors.cxx"
00028 #include "../Common/Allocator.hxx"
00029
00030 namespace Seldon
00031 {
00032
00033
00035 template <class T, class Prop, class Storage,
00036 class Allocator = SELDON_DEFAULT_ALLOCATOR<T> >
00037 class Matrix_TriangPacked: public Spacetown,
00038 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
00048
00049 protected:
00050
00051
00052 public:
00053
00054 Matrix_TriangPacked();
00055 Matrix_TriangPacked(int i, int j = 0);
00056
00057
00058 ~Matrix_TriangPacked();
00059 void Clear();
00060
00061
00062 int GetDataSize() const;
00063
00064
00065 void Reallocate(int i, int j);
00066 void SetData(int i, int j, pointer data);
00067
00068
00069 value_type operator() (int i, int j);
00070 value_type operator() (int i, int j) const;
00071 reference Val(int i, int j);
00072 const_reference Val(int i, int j) const;
00073 reference operator[] (int i);
00074 const_reference operator[] (int i) const;
00075 Matrix_TriangPacked<T, Prop, Storage, Allocator>&
00076 operator= (const Matrix_TriangPacked<T, Prop, Storage, Allocator>& A);
00077 void Copy(const Matrix_TriangPacked<T, Prop, Storage, Allocator>& A);
00078
00079
00080 void Zero();
00081 void SetIdentity();
00082 void Fill();
00083 template <class T0>
00084 void Fill(const T0& x);
00085 template <class T0>
00086 Matrix_TriangPacked<T, Prop, Storage, Allocator>& operator= (const T0& x);
00087 void FillRand();
00088 void Print() const;
00089 void Print(int a, int b, int m, int n) const;
00090 void Print(int l) const;
00091
00092
00093 value_type GetNormInf() const;
00094
00095
00096 void Write(string FileName) const;
00097 void Write(ofstream& FileStream) const;
00098 void WriteText(string FileName) const;
00099 void WriteText(ofstream& FileStream) const;
00100 void Read(string FileName);
00101 void Read(ifstream& FileStream);
00102
00103 };
00104
00105
00107 template <class T, class Prop, class Allocator>
00108 class Matrix<T, Prop, ColUpTriangPacked, Allocator>:
00109 public Matrix_TriangPacked<T, Prop, ColUpTriangPacked, Allocator>
00110 {
00111 public:
00112 Matrix();
00113 Matrix(int i, int j = 0);
00114
00115 template <class T0>
00116 Matrix<T, Prop, ColUpTriangPacked, Allocator>& operator= (const T0& x);
00117 };
00118
00119
00121 template <class T, class Prop, class Allocator>
00122 class Matrix<T, Prop, ColLoTriangPacked, Allocator>:
00123 public Matrix_TriangPacked<T, Prop, ColLoTriangPacked, Allocator>
00124 {
00125 public:
00126 Matrix();
00127 Matrix(int i, int j = 0);
00128
00129 template <class T0>
00130 Matrix<T, Prop, ColLoTriangPacked, Allocator>& operator= (const T0& x);
00131 };
00132
00133
00135 template <class T, class Prop, class Allocator>
00136 class Matrix<T, Prop, RowUpTriangPacked, Allocator>:
00137 public Matrix_TriangPacked<T, Prop, RowUpTriangPacked, Allocator>
00138 {
00139 public:
00140 Matrix();
00141 Matrix(int i, int j = 0);
00142
00143 template <class T0>
00144 Matrix<T, Prop, RowUpTriangPacked, Allocator>& operator= (const T0& x);
00145 };
00146
00147
00149 template <class T, class Prop, class Allocator>
00150 class Matrix<T, Prop, RowLoTriangPacked, Allocator>:
00151 public Matrix_TriangPacked<T, Prop, RowLoTriangPacked, Allocator>
00152 {
00153 public:
00154 Matrix();
00155 Matrix(int i, int j = 0);
00156
00157 template <class T0>
00158 Matrix<T, Prop, RowLoTriangPacked, Allocator>& operator= (const T0& x);
00159 };
00160
00161
00162 }
00163
00164 #define SELDON_FILE_MATRIX_TRIANGPACKED_HXX
00165 #endif