23 #ifndef SELDON_FILE_MATRIX_HERMPACKED_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::reference access_type;
49 typedef typename Allocator::const_reference const_access_type;
57 Storage, Allocator>& A);
69 void SetData(
int i,
int j, pointer data);
73 const value_type
operator() (
int i,
int j)
const;
74 reference
Val(
int i,
int j);
75 const_reference
Val(
int i,
int j)
const;
76 reference
Get(
int i,
int j);
77 const_reference
Get(
int i,
int j)
const;
82 void Set(
int i,
int j,
const T& val);
90 void Fill(
const T0& x);
95 void Print(
int a,
int b,
int m,
int n)
const;
96 void Print(
int l)
const;
99 void Write(
string FileName)
const;
100 void Write(ostream& FileStream)
const;
102 void WriteText(ostream& FileStream)
const;
103 void Read(
string FileName);
104 void Read(istream& FileStream);
108 #ifdef SELDON_WITH_VIRTUAL
109 typedef typename ClassComplexType<T>::Treal Treal;
110 typedef typename ClassComplexType<T>::Tcplx Tcplx;
112 virtual void AddInteraction(
int,
int,
const T&);
113 virtual void AddInteractionRow(
int,
int,
const Vector<int>&,
116 virtual void AddInteractionColumn(
int,
int,
const Vector<int>&,
119 virtual void ClearRow(
int i);
122 const typename ClassComplexType<T>::Treal& omega,
123 int nb_iter,
int stage_ssor)
const;
126 const typename ClassComplexType<T>::Treal& omega,
127 int nb_iter,
int stage_ssor)
const;
129 virtual void MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
132 virtual void MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
152 virtual bool IsSymmetric()
const;
159 template <
class T,
class Prop,
class Allocator>
165 typedef typename Allocator::value_type value_type;
166 typedef Prop property;
168 typedef Allocator allocator;
172 explicit Matrix(
int i,
int j = 0);
182 void Resize(
int i,
int j);
188 template <
class T,
class Prop,
class Allocator>
194 typedef typename Allocator::value_type value_type;
195 typedef Prop property;
197 typedef Allocator allocator;
201 explicit Matrix(
int i,
int j = 0);
211 void Resize(
int i,
int j);
218 #define SELDON_FILE_MATRIX_HERMPACKED_HXX
void Nullify()
Clears the matrix without releasing memory.
void Set(int i, int j, const T &val)
Sets an element of the matrix.
Base class for all matrices.
void Zero()
Sets all elements to zero.
Matrix_HermPacked()
Default constructor.
void Reallocate(int i, int j)
Reallocates memory to resize the matrix.
Hermitian packed matrix class.
Matrix_HermPacked< T, Prop, Storage, Allocator > & operator=(const Matrix_HermPacked< T, Prop, Storage, Allocator > &A)
Duplicates a matrix (assignment operator).
reference Val(int i, int j)
Direct access method.
Column-major hermitian packed matrix class.
void Print() const
Displays the matrix on the standard output.
long GetDataSize() const
Returns the number of elements stored in memory.
const value_type operator()(int i, int j) const
Access operator.
Row-major hermitian packed matrix class.
void Copy(const Matrix_HermPacked< T, Prop, Storage, Allocator > &A)
Duplicates a matrix.
void Clear()
Clears the matrix.
void Read(string FileName)
Reads the matrix from a file.
void SetData(int i, int j, pointer data)
Changes the size of the matrix and sets its data array (low level method).
void SetIdentity()
Sets the matrix to the identity.
size_t GetMemorySize() const
Returns size of A in bytes used to store the matrix.
reference Get(int i, int j)
Returns access to an element (i, j)
void WriteText(string FileName) const
Writes the matrix in a file.
void ReadText(string FileName)
Reads the matrix from a file.
~Matrix_HermPacked()
Destructor.
void FillRand()
Fills the matrix randomly.
void Fill()
Fills the matrix with 0, 1, 2, ...
void Write(string FileName) const
Writes the matrix in a file.
reference operator[](int i)
Access to elements of the data array.