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_SYMPACKED_HXX
00023
00024 #include "../share/Common.hxx"
00025 #include "../share/Properties.hxx"
00026 #include "../share/Storage.hxx"
00027 #include "../share/Errors.hxx"
00028 #include "../share/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_SymPacked: public Matrix_Base<T, Allocator>
00038 {
00039
00040 public:
00041 typedef typename Allocator::value_type value_type;
00042 typedef typename Allocator::pointer pointer;
00043 typedef typename Allocator::const_pointer const_pointer;
00044 typedef typename Allocator::reference reference;
00045 typedef typename Allocator::const_reference const_reference;
00046 typedef typename Allocator::value_type entry_type;
00047 typedef typename Allocator::reference access_type;
00048 typedef typename Allocator::const_reference const_access_type;
00049
00050
00051 protected:
00052
00053
00054 public:
00055
00056 Matrix_SymPacked();
00057 Matrix_SymPacked(int i, int j = 0);
00058 Matrix_SymPacked(const Matrix_SymPacked<T, Prop, Storage, Allocator>& A);
00059
00060
00061 ~Matrix_SymPacked();
00062 void Clear();
00063
00064
00065 int GetDataSize() const;
00066
00067
00068 void Reallocate(int i, int j);
00069 void SetData(int i, int j, pointer data);
00070 void Nullify();
00071
00072
00073 reference operator() (int i, int j);
00074 const_reference operator() (int i, int j) const;
00075 reference Val(int i, int j);
00076 const_reference Val(int i, int j) const;
00077 reference operator[] (int i);
00078 const_reference operator[] (int i) const;
00079 Matrix_SymPacked<T, Prop, Storage, Allocator>&
00080 operator= (const Matrix_SymPacked<T, Prop, Storage, Allocator>& A);
00081 void Copy(const Matrix_SymPacked<T, Prop, Storage, Allocator>& A);
00082
00083
00084 void Zero();
00085 void SetIdentity();
00086 void Fill();
00087 template <class T0>
00088 void Fill(const T0& x);
00089 template <class T0>
00090 Matrix_SymPacked<T, Prop, Storage, Allocator>& operator= (const T0& x);
00091 void FillRand();
00092 void Print() const;
00093 void Print(int a, int b, int m, int n) const;
00094 void Print(int l) const;
00095
00096
00097 void Write(string FileName) const;
00098 void Write(ostream& FileStream) const;
00099 void WriteText(string FileName) const;
00100 void WriteText(ostream& FileStream) const;
00101 void Read(string FileName);
00102 void Read(istream& FileStream);
00103 void ReadText(string FileName);
00104 void ReadText(istream& FileStream);
00105 };
00106
00107
00109 template <class T, class Prop, class Allocator>
00110 class Matrix<T, Prop, ColSymPacked, Allocator>:
00111 public Matrix_SymPacked<T, Prop, ColSymPacked, Allocator>
00112 {
00113
00114 public:
00115 typedef typename Allocator::value_type value_type;
00116 typedef Prop property;
00117 typedef ColSymPacked storage;
00118 typedef Allocator allocator;
00119
00120 public:
00121 Matrix();
00122 Matrix(int i, int j = 0);
00123
00124 template <class T0>
00125 Matrix<T, Prop, ColSymPacked, Allocator>& operator= (const T0& x);
00126 template<class T0>
00127 Matrix<T, Prop, ColSymPacked, Allocator>& operator*= (const T0& x);
00128 void Resize(int i, int j);
00129 };
00130
00131
00133 template <class T, class Prop, class Allocator>
00134 class Matrix<T, Prop, RowSymPacked, Allocator>:
00135 public Matrix_SymPacked<T, Prop, RowSymPacked, Allocator>
00136 {
00137
00138 public:
00139 typedef typename Allocator::value_type value_type;
00140 typedef Prop property;
00141 typedef RowSymPacked storage;
00142 typedef Allocator allocator;
00143
00144 public:
00145 Matrix();
00146 Matrix(int i, int j = 0);
00147
00148 template <class T0>
00149 Matrix<T, Prop, RowSymPacked, Allocator>& operator= (const T0& x);
00150 template<class T0>
00151 Matrix<T, Prop, RowSymPacked, Allocator>& operator*= (const T0& x);
00152 void Resize(int i, int j);
00153 };
00154
00155
00156 }
00157
00158 #define SELDON_FILE_MATRIX_SYMPACKED_HXX
00159 #endif