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_SYMSPARSE_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
00043 template <class T, class Prop, class Storage,
00044 class Allocator = SELDON_DEFAULT_ALLOCATOR<T> >
00045 class Matrix_SymSparse: public Spacetown, public Matrix_Base<T, Allocator>
00046 {
00047
00048 public:
00049 typedef typename Allocator::value_type value_type;
00050 typedef typename Allocator::pointer pointer;
00051 typedef typename Allocator::const_pointer const_pointer;
00052 typedef typename Allocator::reference reference;
00053 typedef typename Allocator::const_reference const_reference;
00054
00055
00056 protected:
00057
00058 int nz_;
00059
00060 int* ptr_;
00061
00062 int* ind_;
00063
00064
00065 public:
00066
00067 Matrix_SymSparse();
00068 Matrix_SymSparse(int i, int j);
00069 Matrix_SymSparse(int i, int j, int nz);
00070 template <class Storage0, class Allocator0,
00071 class Storage1, class Allocator1,
00072 class Storage2, class Allocator2>
00073 Matrix_SymSparse(int i, int j, Vector<T, Storage0, Allocator0>& values,
00074 Vector<int, Storage1, Allocator1>& ptr,
00075 Vector<int, Storage2, Allocator2>& ind);
00076
00077
00078 ~Matrix_SymSparse();
00079 void Clear();
00080
00081
00082 template <class Storage0, class Allocator0,
00083 class Storage1, class Allocator1,
00084 class Storage2, class Allocator2>
00085 void SetData(int i, int j,
00086 Vector<T, Storage0, Allocator0>& values,
00087 Vector<int, Storage1, Allocator1>& ptr,
00088 Vector<int, Storage2, Allocator2>& ind);
00089 void SetData(int i, int j, int nz, pointer values, int* ptr, int* ind);
00090
00091
00092 int GetNonZeros() const;
00093 int GetDataSize() const;
00094 int* GetPtr() const;
00095 int* GetInd() const;
00096 int GetPtrSize() const;
00097 int GetIndSize() const;
00098
00099
00100 value_type operator() (int i, int j) const;
00101
00102
00103 void Print() const;
00104 void SetDiags();
00105 };
00106
00107
00109 template <class T, class Prop, class Allocator>
00110 class Matrix<T, Prop, ColSymSparse, Allocator>:
00111 public Matrix_SymSparse<T, Prop, ColSymSparse, Allocator>
00112 {
00113 public:
00114 Matrix() throw();
00115 Matrix(int i, int j);
00116 Matrix(int i, int j, int nz);
00117 template <class Storage0, class Allocator0,
00118 class Storage1, class Allocator1,
00119 class Storage2, class Allocator2>
00120 Matrix(int i, int j,
00121 Vector<T, Storage0, Allocator0>& values,
00122 Vector<int, Storage1, Allocator1>& ptr,
00123 Vector<int, Storage2, Allocator2>& ind);
00124 };
00125
00126
00128 template <class T, class Prop, class Allocator>
00129 class Matrix<T, Prop, RowSymSparse, Allocator>:
00130 public Matrix_SymSparse<T, Prop, RowSymSparse, Allocator>
00131 {
00132 public:
00133 Matrix() throw();
00134 Matrix(int i, int j);
00135 Matrix(int i, int j, int nz);
00136 template <class Storage0, class Allocator0,
00137 class Storage1, class Allocator1,
00138 class Storage2, class Allocator2>
00139 Matrix(int i, int j,
00140 Vector<T, Storage0, Allocator0>& values,
00141 Vector<int, Storage1, Allocator1>& ptr,
00142 Vector<int, Storage2, Allocator2>& ind);
00143 };
00144
00145
00146 }
00147
00148 #define SELDON_FILE_MATRIX_SYMSPARSE_HXX
00149 #endif