22 #ifndef SELDON_FILE_MATRIX_SYMPACKED_HXX
24 #include "../share/Common.hxx"
25 #include "../share/Properties.hxx"
26 #include "../share/Storage.hxx"
27 #include "../share/Errors.hxx"
28 #include "../share/Allocator.hxx"
35 template <
class T,
class Prop,
class Storage,
class Allocator
36 =
typename SeldonDefaultAllocator<Storage, T>::allocator>
41 typedef typename Allocator::value_type value_type;
42 typedef typename Allocator::pointer pointer;
43 typedef typename Allocator::const_pointer const_pointer;
44 typedef typename Allocator::reference reference;
45 typedef typename Allocator::const_reference const_reference;
46 typedef typename Allocator::value_type entry_type;
47 typedef typename Allocator::reference access_type;
48 typedef typename Allocator::const_reference const_access_type;
70 void SetData(
int i,
int j, pointer data);
75 const_reference
operator() (
int i,
int j)
const;
76 reference
Val(
int i,
int j);
77 const_reference
Val(
int i,
int j)
const;
78 reference
Get(
int i,
int j);
79 const_reference
Get(
int i,
int j)
const;
84 void Set(
int i,
int j,
const T& x);
92 void Fill(
const T0& x);
97 void Print(
int a,
int b,
int m,
int n)
const;
98 void Print(
int l)
const;
101 void Write(
string FileName)
const;
102 void Write(ostream& FileStream)
const;
104 void WriteText(ostream& FileStream)
const;
105 void Read(
string FileName);
106 void Read(istream& FileStream);
110 #ifdef SELDON_WITH_VIRTUAL
111 typedef typename ClassComplexType<T>::Treal Treal;
112 typedef typename ClassComplexType<T>::Tcplx Tcplx;
114 virtual void AddInteraction(
int,
int,
const T&);
115 virtual void AddInteractionRow(
int,
int,
const Vector<int>&,
118 virtual void AddInteractionColumn(
int,
int,
const Vector<int>&,
121 virtual void ClearRow(
int i);
124 const typename ClassComplexType<T>::Treal& omega,
125 int nb_iter,
int stage_ssor)
const;
128 const typename ClassComplexType<T>::Treal& omega,
129 int nb_iter,
int stage_ssor)
const;
131 virtual void MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
134 virtual void MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
154 virtual bool IsSymmetric()
const;
161 template <
class T,
class Prop,
class Allocator>
167 typedef typename Allocator::value_type value_type;
168 typedef Prop property;
170 typedef Allocator allocator;
174 explicit Matrix(
int i,
int j = 0);
184 void Resize(
int i,
int j);
189 template <
class T,
class Prop,
class Allocator>
195 typedef typename Allocator::value_type value_type;
196 typedef Prop property;
198 typedef Allocator allocator;
202 explicit Matrix(
int i,
int j = 0);
212 void Resize(
int i,
int j);
218 #define SELDON_FILE_MATRIX_SYMPACKED_HXX
~Matrix_SymPacked()
Destructor.
void Clear()
Clears the matrix.
reference operator()(int i, int j)
Access operator.
Base class for all matrices.
void Nullify()
Clears the matrix without releasing memory.
void SetData(int i, int j, pointer data)
Changes the size of the matrix and sets its data array (low level method).
reference Get(int i, int j)
Returns the element (i, j)
size_t GetMemorySize() const
Returns size of A in bytes used to store the matrix.
Symmetric packed matrix class.
void WriteText(string FileName) const
Writes the matrix in a file.
reference Val(int i, int j)
Direct access method.
void ReadText(string FileName)
Reads the matrix from a file.
void Set(int i, int j, const T &x)
Sets an element of the matrix.
void FillRand()
Fills the matrix randomly.
void Copy(const Matrix_SymPacked< T, Prop, Storage, Allocator > &A)
Duplicates a matrix.
Matrix_SymPacked()
Default constructor.
void Fill()
Fills the matrix with 0, 1, 2, ...
void Print() const
Displays the matrix on the standard output.
Matrix_SymPacked< T, Prop, Storage, Allocator > & operator=(const Matrix_SymPacked< T, Prop, Storage, Allocator > &A)
Duplicates a matrix (assignment operator).
reference operator[](int i)
Access to elements of the data array.
void SetIdentity()
Sets the matrix to the identity.
void Zero()
Sets all elements to zero.
Column-major symmetric packed matrix class.
void Read(string FileName)
Reads the matrix from a file.
void Write(string FileName) const
Writes the matrix in a file.
Row-major symmetric packed matrix class.
long GetDataSize() const
Returns the number of elements stored in memory.
void Reallocate(int i, int j)
Reallocates memory to resize the matrix.