23 #ifndef SELDON_FILE_MATRIX_SYMMETRIC_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);
78 const_reference
operator() (
int i,
int j)
const;
79 const_reference
Val(
int i,
int j)
const;
80 reference
Val(
int i,
int j);
81 reference
Get(
int i,
int j);
82 const_reference
Get(
int i,
int j)
const;
87 void Set(
int i,
int j,
const T& x);
95 void Fill(
const T0& x);
100 void Print(
int a,
int b,
int m,
int n)
const;
101 void Print(
int l)
const;
104 void Write(
string FileName)
const;
105 void Write(ostream& FileStream)
const;
107 void WriteText(ostream& FileStream)
const;
108 void Read(
string FileName);
109 void Read(istream& FileStream);
113 #ifdef SELDON_WITH_VIRTUAL
114 typedef typename ClassComplexType<T>::Treal Treal;
115 typedef typename ClassComplexType<T>::Tcplx Tcplx;
117 virtual void AddInteraction(
int,
int,
const T&);
118 virtual void AddInteractionRow(
int,
int,
const Vector<int>&,
121 virtual void AddInteractionColumn(
int,
int,
const Vector<int>&,
124 virtual void ClearRow(
int i);
127 const typename ClassComplexType<T>::Treal& omega,
128 int nb_iter,
int stage_ssor)
const;
131 const typename ClassComplexType<T>::Treal& omega,
132 int nb_iter,
int stage_ssor)
const;
134 virtual void MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
137 virtual void MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
157 virtual bool IsSymmetric()
const;
164 template <
class T,
class Prop,
class Allocator>
170 typedef typename Allocator::value_type value_type;
171 typedef Prop property;
173 typedef Allocator allocator;
177 explicit Matrix(
int i,
int j);
191 template <
class T,
class Prop,
class Allocator>
197 typedef typename Allocator::value_type value_type;
198 typedef Prop property;
200 typedef Allocator allocator;
204 explicit Matrix(
int i,
int j);
219 #define SELDON_FILE_MATRIX_SYMMETRIC_HXX
void Resize(int i, int j)
Reallocates memory to resize the matrix and keeps previous entries.
void Read(string FileName)
Reads the matrix from a file.
void ReadText(string FileName)
Reads the matrix from a file.
Base class for all matrices.
Matrix_Symmetric< T, Prop, Storage, Allocator > & operator=(const Matrix_Symmetric< T, Prop, Storage, Allocator > &A)
Duplicates a matrix (assignment operator).
const_reference Val(int i, int j) const
Access operator.
void SetData(int i, int j, pointer data)
Changes the size of the matrix and sets its data array (low level method).
void Print() const
Displays the matrix on the standard output.
void Copy(const Matrix_Symmetric< T, Prop, Storage, Allocator > &A)
Duplicates a matrix.
reference Get(int i, int j)
Returns the element (i, j)
void Reallocate(int i, int j)
Reallocates memory to resize the matrix.
reference operator[](int i)
Access to elements of the data array.
void Set(int i, int j, const T &x)
Sets an element of the matrix.
Column-major symmetric full-matrix class.
Row-major symmetric full-matrix class.
void Nullify()
Clears the matrix without releasing memory.
void Fill()
Fills the matrix with 0, 1, 2, ...
reference operator()(int i, int j)
Access operator.
long GetDataSize() const
Returns the number of elements stored in memory.
size_t GetMemorySize() const
Returns size of A in bytes used to store the matrix.
void Write(string FileName) const
Writes the matrix in a file.
Matrix_Symmetric()
Default constructor.
void FillRand()
Fills a matrix randomly.
Symmetric matrix stored in a full matrix.
void Zero()
Sets all elements to zero.
void Clear()
Clears the matrix.
void WriteText(string FileName) const
Writes the matrix in a file.
~Matrix_Symmetric()
Destructor.
void SetIdentity()
Sets the matrix to the identity.