23 #ifndef SELDON_FILE_MATRIX_SYMCOMPLEXSPARSE_HXX
35 ::allocator allocator;
43 SeldonDefaultAllocator<VectFull, float>::allocator allocator;
51 SeldonDefaultAllocator<VectFull, double>::allocator allocator;
59 SeldonDefaultAllocator<VectFull, long double>::allocator allocator;
70 ::allocator allocator;
78 SeldonDefaultAllocator<VectFull, float>::allocator allocator;
86 SeldonDefaultAllocator<VectFull, double>::allocator allocator;
94 SeldonDefaultAllocator<VectFull, long double>::allocator allocator;
111 template <
class T,
class Prop,
class Storage,
class Allocator
112 =
typename SeldonDefaultAllocator<Storage, T>::allocator>
117 typedef typename Allocator::value_type value_type;
118 typedef typename Allocator::pointer pointer;
119 typedef typename Allocator::const_pointer const_pointer;
120 typedef typename Allocator::reference reference;
121 typedef typename Allocator::const_reference const_reference;
122 typedef typename SeldonDefaultAllocator<VectFull, int>::allocator AllocatorInt;
123 typedef typename SeldonDefaultAllocator<VectFull, long>::allocator AllocatorLong;
124 typedef complex<value_type> entry_type;
125 typedef complex<value_type> access_type;
126 typedef complex<value_type> const_access_type;
141 value_type* real_data_;
142 value_type* imag_data_;
150 template <
class Storage0,
class Allocator0,
151 class Storage1,
class Allocator1,
152 class Storage2,
class Allocator2>
168 template <
class Storage0,
class Allocator0,
169 class Storage1,
class Allocator1,
170 class Storage2,
class Allocator2>
179 long real_nz, pointer real_values,
long* real_ptr,
181 long imag_nz, pointer imag_values,
long* imag_ptr,
185 void Reallocate(
int i,
int j,
long real_nz,
long imag_nz);
186 void Resize(
int i,
int j);
187 void Resize(
int i,
int j,
long real_nz,
long imag_nz);
208 const complex<value_type>
operator() (
int i,
int j)
const;
209 value_type&
ValReal(
int i,
int j);
210 const value_type&
ValReal(
int i,
int j)
const;
211 value_type&
ValImag(
int i,
int j);
212 const value_type&
ValImag(
int i,
int j)
const;
213 value_type&
GetReal(
int i,
int j);
214 const value_type&
GetReal(
int i,
int j)
const;
215 value_type&
GetImag(
int i,
int j);
216 const value_type&
GetImag(
int i,
int j)
const;
217 void Set(
int i,
int j,
const entry_type& x);
222 bool sorted =
false);
231 void Fill(
const entry_type& x);
235 void Write(
string FileName)
const;
236 void Write(ostream& FileStream)
const;
237 void WriteText(
string FileName,
bool cplx =
false)
const;
238 void WriteText(ostream& FileStream,
bool cplx =
false)
const;
239 void Read(
string FileName);
240 void Read(istream& FileStream);
241 void ReadText(
string FileName,
bool cplx =
false);
242 void ReadText(istream& FileStream,
bool cplx =
false);
244 #ifdef SELDON_WITH_VIRTUAL
245 typedef typename ClassComplexType<T>::Treal Treal;
246 typedef typename ClassComplexType<T>::Tcplx Tcplx;
250 const typename ClassComplexType<T>::Treal& omega,
251 int nb_iter,
int stage_ssor)
const;
254 const typename ClassComplexType<T>::Treal& omega,
255 int nb_iter,
int stage_ssor)
const;
257 virtual void MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
260 virtual void MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
280 virtual bool IsSymmetric()
const;
287 template <
class T,
class Prop,
class Allocator>
293 typedef typename Allocator::value_type value_type;
294 typedef Prop property;
296 typedef Allocator allocator;
300 explicit Matrix(
int i,
int j);
301 Matrix(
int i,
int j,
long real_nz,
long imag_nz);
302 template <
class Storage0,
class Allocator0,
303 class Storage1,
class Allocator1,
304 class Storage2,
class Allocator2>
316 template <
class T,
class Prop,
class Allocator>
322 typedef typename Allocator::value_type value_type;
323 typedef Prop property;
325 typedef Allocator allocator;
329 explicit Matrix(
int i,
int j);
330 Matrix(
int i,
int j,
long real_nz,
long imag_nz);
331 template <
class Storage0,
class Allocator0,
332 class Storage1,
class Allocator1,
333 class Storage2,
class Allocator2>
345 #define SELDON_FILE_MATRIX_SYMCOMPLEXSPARSE_HXX
Selection of default allocator depending on storage and value type.
void Zero()
Resets all non-zero entries to 0-value.
void WriteText(string FileName, bool cplx=false) const
Writes the matrix in a file.
Base class for all matrices.
void AddInteractionRow(int i, int nb, const IVect &col, const Vector< entry_type > &val, bool sorted=false)
Adds values to several non-zero entries on a given row.
int * GetRealInd() const
Returns (row or column) indices of non-zero entries for the real part.
value_type & ValImag(int i, int j)
Access method.
long * GetRealPtr() const
Returns (row or column) start indices for the real part.
long GetNonZeros() const
Returns the number of elements stored in memory.
Matrix_SymComplexSparse< T, Prop, Storage, Allocator > & operator=(const Matrix_SymComplexSparse< T, Prop, Storage, Allocator > &A)
Duplicates a matrix (assignment operator).
size_t GetMemorySize() const
returns size of A in bytes used to store the matrix
void Fill()
Fills the non-zero entries with 0, 1, 2, ...
long GetDataSize() const
Returns the number of elements stored in memory.
Symmetric complex sparse-matrix class.
const complex< value_type > operator()(int i, int j) const
Access operator.
void FillRand()
Fills the non-zero entries randomly.
value_type & ValReal(int i, int j)
Access method.
value_type & GetReal(int i, int j)
Access method.
long GetImagIndSize() const
Returns the length of the array of (column or row) indices for the imaginary part.
void AddInteraction(int i, int j, const entry_type &x)
Add a value to a non-zero entry.
long GetRealIndSize() const
Returns the length of the array of (column or row) indices for the real part.
long * GetImagPtr() const
Returns (row or column) start indices for the imaginary part.
void Copy(const Matrix_SymComplexSparse< T, Prop, Storage, Allocator > &A)
Copies a matrix.
void Read(string FileName)
Reads the matrix from a file.
void Set(int i, int j, const entry_type &x)
Sets an element (i, j) to a value.
void Print() const
Displays the matrix on the standard output.
int GetImagPtrSize() const
Returns the length of the array of start indices for the imaginary part.
int GetRealPtrSize() const
Returns the length of the array of start indices for the real part.
void SetData(int i, int j, Vector< value_type, Storage0, Allocator0 > &real_values, Vector< long, Storage1, Allocator1 > &real_ptr, Vector< int, Storage2, Allocator2 > &real_ind, Vector< value_type, Storage0, Allocator0 > &imag_values, Vector< long, Storage1, Allocator1 > &imag_ptr, Vector< int, Storage2, Allocator2 > &imag_ind)
Redefines the matrix.
void Resize(int i, int j)
Changing the number of rows and columns.
value_type * GetImagData() const
Returns the array of values of the imaginary part.
int * GetImagInd() const
Returns (row or column) indices of non-zero entries for the imaginary part.
value_type & GetImag(int i, int j)
Access method.
void Write(string FileName) const
Writes the matrix in a file.
void SetIdentity()
Sets the matrix to identity.
long GetRealDataSize() const
Returns the length of the array of (column or row) indices for the real part.
Matrix_SymComplexSparse()
Default constructor.
void Clear()
Clears the matrix.
~Matrix_SymComplexSparse()
Destructor.
value_type * GetRealData() const
Returns the array of values of the real part.
void Nullify()
Clears the matrix without releasing memory.
void Reallocate(int i, int j)
Initialization of an empty matrix i x j.
void ReadText(string FileName, bool cplx=false)
Reads the matrix from a file.
long GetImagDataSize() const
Returns the length of the array of (column or row) indices for the imaginary part.