23 #ifndef SELDON_FILE_MATRIX_HERMITIAN_HXX
25 #include "../share/Common.hxx"
26 #include "../share/Properties.hxx"
27 #include "../share/Storage.hxx"
28 #include "../share/Errors.hxx"
29 #include "../share/Allocator.hxx"
36 template <
class T,
class Prop,
class Storage,
class Allocator
37 =
typename SeldonDefaultAllocator<Storage, T>::allocator>
42 typedef typename Allocator::value_type value_type;
43 typedef typename Allocator::pointer pointer;
44 typedef typename Allocator::const_pointer const_pointer;
45 typedef typename Allocator::reference reference;
46 typedef typename Allocator::const_reference const_reference;
47 typedef typename Allocator::value_type entry_type;
48 typedef typename Allocator::value_type access_type;
49 typedef typename Allocator::value_type const_access_type;
72 void SetData(
int i,
int j, pointer data);
77 const value_type
operator() (
int i,
int j)
const;
78 const_reference
Val(
int i,
int j)
const;
79 reference
Val(
int i,
int j);
80 const_reference
Get(
int i,
int j)
const;
81 reference
Get(
int i,
int j);
88 void Set(
int i,
int j,
const T& x);
96 void Fill(
const T0& x);
102 void Print(
int a,
int b,
int m,
int n)
const;
103 void Print(
int l)
const;
106 void Write(
string FileName)
const;
107 void Write(ostream& FileStream)
const;
109 void WriteText(ostream& FileStream)
const;
110 void Read(
string FileName);
111 void Read(istream& FileStream);
115 #ifdef SELDON_WITH_VIRTUAL
116 typedef typename ClassComplexType<T>::Treal Treal;
117 typedef typename ClassComplexType<T>::Tcplx Tcplx;
119 virtual void AddInteraction(
int,
int,
const T&);
120 virtual void AddInteractionRow(
int,
int,
const Vector<int>&,
121 const Vector<T>& val,
bool sorted =
false);
123 virtual void AddInteractionColumn(
int,
int,
const Vector<int>&,
124 const Vector<T>& val,
bool sorted =
false);
126 virtual void ClearRow(
int i);
129 const typename ClassComplexType<T>::Treal& omega,
130 int nb_iter,
int stage_ssor)
const;
133 const typename ClassComplexType<T>::Treal& omega,
134 int nb_iter,
int stage_ssor)
const;
136 virtual void MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
139 virtual void MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
159 virtual bool IsSymmetric()
const;
166 template <
class T,
class Prop,
class Allocator>
172 typedef typename Allocator::value_type value_type;
173 typedef Prop property;
175 typedef Allocator allocator;
179 explicit Matrix(
int i,
int j = 0);
193 template <
class T,
class Prop,
class Allocator>
199 typedef typename Allocator::value_type value_type;
200 typedef Prop property;
202 typedef Allocator allocator;
206 explicit Matrix(
int i,
int j = 0);
221 #define SELDON_FILE_MATRIX_HERMITIAN_HXX
void WriteText(string FileName) const
Writes the matrix in a file.
void Nullify()
Clears the matrix without releasing memory.
reference operator[](int i)
Access to elements of the data array.
void ReadText(string FileName)
Reads the matrix from a file.
Base class for all matrices.
Matrix_Hermitian< T, Prop, Storage, Allocator > & operator=(const Matrix_Hermitian< T, Prop, Storage, Allocator > &A)
Duplicates a matrix (assignement operator).
const_reference Get(int i, int j) const
Returns access to an element (i, j)
const value_type operator()(int i, int j) const
Access operator.
Column-major hermitian full-matrix class.
void Reallocate(int i, int j)
Reallocates memory to resize the matrix.
Hermitian matrix stored in a full matrix.
Row-major hermitian full-matrix class.
void SetData(int i, int j, pointer data)
Changes the size of the matrix and sets its data array (low level method).
long GetDataSize() const
Returns the number of elements stored in memory.
void Set(int i, int j, const T &x)
Sets an element of the matrix.
void Read(string FileName)
Reads the matrix from a file.
size_t GetMemorySize() const
Returns size of A in bytes used to store the matrix.
void Clear()
Clears the matrix.
void FillRand()
Fills the matrix randomly.
void Zero()
Sets all elements to zero.
void Write(string FileName) const
Writes the matrix in a file.
const_reference Val(int i, int j) const
Access operator.
~Matrix_Hermitian()
Destructor.
void Print() const
Displays the matrix on the standard output.
void Fill()
Fills the matrix with 0, 1, 2, ...
void SetIdentity()
Sets the matrix to the identity.
void Resize(int i, int j)
Reallocates memory to resize the matrix and keeps previous entries.
void Copy(const Matrix_Hermitian< T, Prop, Storage, Allocator > &A)
Duplicates a matrix.
Matrix_Hermitian()
Default constructor.