23 #ifndef SELDON_FILE_MATRIX_TRIANGPACKED_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;
72 void SetData(
int i,
int j, pointer data);
76 const value_type
operator() (
int i,
int j)
const;
77 reference
Val(
int i,
int j);
78 const_reference
Val(
int i,
int j)
const;
79 reference
Get(
int i,
int j);
80 const_reference
Get(
int i,
int j)
const;
85 void Set(
int i,
int j,
const T& x);
93 void Fill(
const T0& x);
98 void Print(
int a,
int b,
int m,
int n)
const;
99 void Print(
int l)
const;
102 void Write(
string FileName)
const;
103 void Write(ostream& FileStream)
const;
105 void WriteText(ostream& FileStream)
const;
106 void Read(
string FileName);
107 void Read(istream& FileStream);
111 #ifdef SELDON_WITH_VIRTUAL
112 typedef typename ClassComplexType<T>::Treal Treal;
113 typedef typename ClassComplexType<T>::Tcplx Tcplx;
115 virtual void MltAddVector(
const Treal& alpha,
const Vector<Treal>& x,
118 virtual void MltAddVector(
const Tcplx& alpha,
const Vector<Tcplx>& x,
138 virtual bool IsSymmetric()
const;
145 template <
class T,
class Prop,
class Allocator>
151 typedef typename Allocator::value_type value_type;
152 typedef Prop property;
154 typedef Allocator allocator;
158 explicit Matrix(
int i,
int j = 0);
159 void Resize(
int i,
int j);
171 template <
class T,
class Prop,
class Allocator>
177 typedef typename Allocator::value_type value_type;
178 typedef Prop property;
180 typedef Allocator allocator;
185 void Resize(
int i,
int j);
197 template <
class T,
class Prop,
class Allocator>
203 typedef typename Allocator::value_type value_type;
204 typedef Prop property;
206 typedef Allocator allocator;
210 explicit Matrix(
int i,
int j = 0);
211 void Resize(
int i,
int j);
223 template <
class T,
class Prop,
class Allocator>
229 typedef typename Allocator::value_type value_type;
230 typedef Prop property;
232 typedef Allocator allocator;
236 explicit Matrix(
int i,
int j = 0);
237 void Resize(
int i,
int j);
250 #define SELDON_FILE_MATRIX_TRIANGPACKED_HXX
void SetData(int i, int j, pointer data)
Changes the size of the matrix and sets its data array (low level method).
Base class for all matrices.
void Zero()
Sets all elements to zero.
void WriteText(string FileName) const
Writes the matrix in a file.
size_t GetMemorySize() const
Returns size of A in bytes used to store the matrix.
reference Val(int i, int j)
Direct access method.
Matrix_TriangPacked< T, Prop, Storage, Allocator > & operator=(const Matrix_TriangPacked< T, Prop, Storage, Allocator > &A)
Duplicates a matrix (assignment operator).
void Nullify()
Clears the matrix without releasing memory.
void Write(string FileName) const
Writes the matrix in a file.
void Fill()
Fills the matrix with 0, 1, 2, ...
void SetIdentity()
Sets the matrix to the identity.
void Clear()
Clears the matrix.
const value_type operator()(int i, int j) const
Access operator.
void FillRand()
Fills the matrix randomly.
Triangular packed matrix class.
Row-major upper-triangular packed matrix class.
void Copy(const Matrix_TriangPacked< T, Prop, Storage, Allocator > &A)
Duplicates a matrix.
Column-major upper-triangular packed matrix class.
void Set(int i, int j, const T &x)
Sets an element of the matrix.
reference Get(int i, int j)
Returns the element (i, j)
long GetDataSize() const
Returns the number of elements stored in memory.
void Read(string FileName)
Reads the matrix from a file.
void ReadText(string FileName)
Reads the matrix from a file.
~Matrix_TriangPacked()
Destructor.
void Print() const
Displays the matrix on the standard output.
Matrix_TriangPacked()
Default constructor.
Row-major lower-triangular packed matrix class.
void Reallocate(int i, int j)
Reallocates memory to resize the matrix.
Column-major lower-triangular packed matrix class.
reference operator[](int i)
Access to elements of the data array.