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