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_SYMCOMPLEXSPARSE_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
00047 template <class T, class Prop, class Storage,
00048 class Allocator = SELDON_DEFAULT_ALLOCATOR<T> >
00049 class Matrix_SymComplexSparse: public Spacetown,
00050 public Matrix_Base<T, Allocator>
00051 {
00052
00053 public:
00054 typedef typename Allocator::value_type value_type;
00055 typedef typename Allocator::pointer pointer;
00056 typedef typename Allocator::const_pointer const_pointer;
00057 typedef typename Allocator::reference reference;
00058 typedef typename Allocator::const_reference const_reference;
00059
00060
00061 protected:
00062
00063 int real_nz_;
00064 int imag_nz_;
00065
00066 int* real_ptr_;
00067 int* imag_ptr_;
00068
00069 int* real_ind_;
00070 int* imag_ind_;
00071
00072
00073 T* real_data_;
00074 T* imag_data_;
00075
00076
00077 public:
00078
00079 Matrix_SymComplexSparse();
00080 Matrix_SymComplexSparse(int i, int j);
00081 Matrix_SymComplexSparse(int i, int j, int real_nz, int imag_nz);
00082 template <class Storage0, class Allocator0,
00083 class Storage1, class Allocator1,
00084 class Storage2, class Allocator2>
00085 Matrix_SymComplexSparse(int i, int j,
00086 Vector<T, Storage0, Allocator0>& real_values,
00087 Vector<int, Storage1, Allocator1>& real_ptr,
00088 Vector<int, Storage2, Allocator2>& real_ind,
00089 Vector<T, Storage0, Allocator0>& imag_values,
00090 Vector<int, Storage1, Allocator1>& imag_ptr,
00091 Vector<int, Storage2, Allocator2>& imag_ind);
00092
00093
00094 ~Matrix_SymComplexSparse();
00095 void Clear();
00096
00097
00098 template <class Storage0, class Allocator0,
00099 class Storage1, class Allocator1,
00100 class Storage2, class Allocator2>
00101 void SetData(int i, int j,
00102 Vector<T, Storage0, Allocator0>& real_values,
00103 Vector<int, Storage1, Allocator1>& real_ptr,
00104 Vector<int, Storage2, Allocator2>& real_ind,
00105 Vector<T, Storage0, Allocator0>& imag_values,
00106 Vector<int, Storage1, Allocator1>& imag_ptr,
00107 Vector<int, Storage2, Allocator2>& imag_ind);
00108 void SetData(int i, int j,
00109 int real_nz, pointer real_values, int* real_ptr,
00110 int* real_ind,
00111 int imag_nz, pointer imag_values, int* imag_ptr,
00112 int* imag_ind);
00113
00114
00115 int GetNonZeros() const;
00116 int GetDataSize() const;
00117 int* GetRealPtr() const;
00118 int* GetImagPtr() const;
00119 int* GetRealInd() const;
00120 int* GetImagInd() const;
00121 int GetRealPtrSize() const;
00122 int GetImagPtrSize() const;
00123 int GetRealIndSize() const;
00124 int GetImagIndSize() const;
00125 T* GetRealData() const;
00126 T* GetImagData() const;
00127
00128
00129 complex<value_type> operator() (int i, int j) const;
00130
00131
00132 void Print() const;
00133 };
00134
00135
00137 template <class T, class Prop, class Allocator>
00138 class Matrix<T, Prop, ColSymComplexSparse, Allocator>:
00139 public Matrix_SymComplexSparse<T, Prop, ColSymComplexSparse, Allocator>
00140 {
00141 public:
00142 Matrix() throw();
00143 Matrix(int i, int j);
00144 Matrix(int i, int j, int real_nz, int imag_nz);
00145 template <class Storage0, class Allocator0,
00146 class Storage1, class Allocator1,
00147 class Storage2, class Allocator2>
00148 Matrix(int i, int j,
00149 Vector<T, Storage0, Allocator0>& real_values,
00150 Vector<int, Storage1, Allocator1>& real_ptr,
00151 Vector<int, Storage2, Allocator2>& real_ind,
00152 Vector<T, Storage0, Allocator0>& imag_values,
00153 Vector<int, Storage1, Allocator1>& imag_ptr,
00154 Vector<int, Storage2, Allocator2>& imag_ind);
00155 };
00156
00157
00159 template <class T, class Prop, class Allocator>
00160 class Matrix<T, Prop, RowSymComplexSparse, Allocator>:
00161 public Matrix_SymComplexSparse<T, Prop, RowSymComplexSparse, Allocator>
00162 {
00163 public:
00164 Matrix() throw();
00165 Matrix(int i, int j);
00166 Matrix(int i, int j, int real_nz, int imag_nz);
00167 template <class Storage0, class Allocator0,
00168 class Storage1, class Allocator1,
00169 class Storage2, class Allocator2>
00170 Matrix(int i, int j,
00171 Vector<T, Storage0, Allocator0>& values,
00172 Vector<int, Storage1, Allocator1>& ptr,
00173 Vector<int, Storage2, Allocator2>& ind,
00174 Vector<T, Storage0, Allocator0>& imag_values,
00175 Vector<int, Storage1, Allocator1>& imag_ptr,
00176 Vector<int, Storage2, Allocator2>& imag_ind);
00177 };
00178
00179
00180 }
00181
00182 #define SELDON_FILE_MATRIX_SYMCOMPLEXSPARSE_HXX
00183 #endif