21 #ifndef SELDON_FILE_MATRIX_COLLECTION_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,
36 class Allocator = NewAlloc<T> >
41 typedef typename T::value_type value_type;
42 typedef typename T::pointer pointer;
43 typedef typename T::const_pointer const_pointer;
44 typedef typename T::reference reference;
45 typedef typename T::const_reference const_reference;
47 typedef T matrix_type;
48 typedef matrix_type* matrix_pointer;
49 typedef const matrix_type* const_matrix_pointer;
50 typedef matrix_type& matrix_reference;
51 typedef const matrix_type& const_matrix_reference;
98 int GetM(
int i)
const;
101 int GetN(
int j)
const;
110 template <
class T0,
class Prop0,
class Storage0,
class Allocator0>
113 template <
class T0,
class Prop0,
class Allocator0>
118 matrix_reference
GetMatrix(
int i,
int j);
119 const_matrix_reference
GetMatrix(
int i,
int j)
const;
129 void Print(
int m,
int n)
const;
132 void Write(
string FileName,
bool with_size)
const;
133 void Write(ostream& FileStream,
bool with_size)
const;
135 void WriteText(ostream& FileStream)
const;
137 void Read(
string FileName);
138 void Read(istream& FileStream);
143 template <
class T,
class Prop,
class Allocator>
149 typedef T value_type;
150 typedef Prop property;
152 typedef Allocator allocator;
161 template <
class T,
class Prop,
class Allocator>
167 typedef T value_type;
168 typedef Prop property;
170 typedef Allocator allocator;
179 template <
class T,
class Prop,
class Allocator>
185 typedef T value_type;
186 typedef Prop property;
188 typedef Allocator allocator;
197 template <
class T,
class Prop,
class Allocator>
203 typedef T value_type;
204 typedef Prop property;
206 typedef Allocator allocator;
218 #define SELDON_FILE_MATRIX_COLLECTION_HXX
void Nullify()
Clears the matrix.
Base class for all matrices.
void Read(string FileName)
Reads the matrix collection from a file.
Vector< int, VectFull, CallocAlloc< int > > Mlocal_sum_
Cumulative number of rows in the underlying matrices.
Matrix class made of a collection of matrices.
collection_type matrix_
Pointers of the underlying matrices.
int Nmatrix_
Number of columns of matrices.
~MatrixCollection()
Destructor.
MatrixCollection< T, Prop, Storage, Allocator > & operator=(const MatrixCollection< T, Prop, Storage, Allocator > &A)
Duplicates a matrix collection (assignment operator).
void SetMatrix(int m, int n, const Matrix< T0, Prop0, Storage0, Allocator0 > &)
Sets an underlying matrix in the matrix collection.
int GetM() const
Returns the number of rows.
void Write(string FileName, bool with_size) const
Writes the matrix collection in a file.
void WriteText(string FileName) const
Writes the matrix collection in a file.
value_type operator()(int i, int j) const
Access operator.
Vector< int, VectFull, CallocAlloc< int > > Nlocal_
Number of columns in the underlying matrices.
matrix_reference GetMatrix(int i, int j)
Access to an underlying matrix.
void Reallocate(int i, int j)
Reallocates memory to resize the matrix collection.
int GetNmatrix() const
Returns the number of columns.
MatrixCollection()
Default constructor.
int GetMmatrix() const
Returns the number of rows.
Vector< int, VectFull, CallocAlloc< int > > Mlocal_
Number of rows in the underlying matrices.
int GetN() const
Returns the number of columns.
size_t GetMemorySize() const
Returns size of A in bytes used to store the matrix.
int GetDataSize() const
Returns the number of elements stored in memory.
int nz_
Number of non-zero elements.
Vector< int, VectFull, CallocAlloc< int > > Nlocal_sum_
Cumulative number of columns in the underlying matrices.
void Deallocate()
Deallocates underlying the matrices.
void Clear()
Clears the matrix.
void Print() const
Displays the matrix collection on the standard output.
void Copy(const MatrixCollection< T, Prop, Storage, Allocator > &A)
Duplicates a matrix collection.
int GetSize() const
Returns the number of elements stored in memory.
int Mmatrix_
Number of rows of matrices.