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_SYMMETRIC_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_Symmetric: 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_Symmetric();
00059 Matrix_Symmetric(int i, int j);
00060 Matrix_Symmetric(const Matrix_Symmetric<T, Prop, Storage, Allocator>& A);
00061
00062
00063 ~Matrix_Symmetric();
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 void Resize(int i, int j);
00074
00075
00076 reference operator() (int i, int j);
00077 const_reference operator() (int i, int j) const;
00078 const_reference Val(int i, int j) const;
00079 reference Val(int i, int j);
00080 reference Get(int i, int j);
00081 const_reference Get(int i, int j) const;
00082 reference operator[] (int i);
00083 const_reference operator[] (int i) const;
00084 Matrix_Symmetric<T, Prop, Storage, Allocator>&
00085 operator= (const Matrix_Symmetric<T, Prop, Storage, Allocator>& A);
00086 void Set(int i, int j, const T& x);
00087 void Copy(const Matrix_Symmetric<T, Prop, Storage, Allocator>& A);
00088
00089
00090 void Zero();
00091 void SetIdentity();
00092 void Fill();
00093 template <class T0>
00094 void Fill(const T0& x);
00095 template <class T0>
00096 Matrix_Symmetric<T, Prop, Storage, Allocator>& operator= (const T0& x);
00097 void FillRand();
00098 void Print() const;
00099 void Print(int a, int b, int m, int n) const;
00100 void Print(int l) const;
00101
00102
00103 void Write(string FileName) const;
00104 void Write(ostream& FileStream) const;
00105 void WriteText(string FileName) const;
00106 void WriteText(ostream& FileStream) const;
00107 void Read(string FileName);
00108 void Read(istream& FileStream);
00109 void ReadText(string FileName);
00110 void ReadText(istream& FileStream);
00111
00112 };
00113
00114
00116 template <class T, class Prop, class Allocator>
00117 class Matrix<T, Prop, ColSym, Allocator>:
00118 public Matrix_Symmetric<T, Prop, ColSym, Allocator>
00119 {
00120
00121 public:
00122 typedef typename Allocator::value_type value_type;
00123 typedef Prop property;
00124 typedef ColSym storage;
00125 typedef Allocator allocator;
00126
00127 public:
00128 Matrix();
00129 Matrix(int i, int j);
00130
00131 template <class T0>
00132 Matrix<T, Prop, ColSym, Allocator>& operator= (const T0& x);
00133 Matrix<T, Prop, ColSym, Allocator>& operator= (const Matrix<T, Prop,
00134 ColSym,
00135 Allocator>& A);
00136 template<class T0>
00137 Matrix<T, Prop, ColSym, Allocator>& operator*= (const T0& x);
00138
00139 };
00140
00141
00143 template <class T, class Prop, class Allocator>
00144 class Matrix<T, Prop, RowSym, Allocator>:
00145 public Matrix_Symmetric<T, Prop, RowSym, Allocator>
00146 {
00147
00148 public:
00149 typedef typename Allocator::value_type value_type;
00150 typedef Prop property;
00151 typedef RowSym storage;
00152 typedef Allocator allocator;
00153
00154 public:
00155 Matrix();
00156 Matrix(int i, int j);
00157
00158 template <class T0>
00159 Matrix<T, Prop, RowSym, Allocator>& operator= (const T0& x);
00160 Matrix<T, Prop, RowSym, Allocator>& operator= (const Matrix<T, Prop,
00161 RowSym,
00162 Allocator>& A);
00163 template<class T0>
00164 Matrix<T, Prop, RowSym, Allocator>& operator*= (const T0& x);
00165
00166 };
00167
00168
00169 }
00170
00171 #define SELDON_FILE_MATRIX_SYMMETRIC_HXX
00172 #endif