Matrix class made of a collection of matrices. More...
#include <MatrixCollection.hxx>
Public Types | |
typedef T::value_type | value_type |
typedef T::pointer | pointer |
typedef T::const_pointer | const_pointer |
typedef T::reference | reference |
typedef T::const_reference | const_reference |
typedef T | matrix_type |
typedef matrix_type * | matrix_pointer |
typedef const matrix_type * | const_matrix_pointer |
typedef matrix_type & | matrix_reference |
typedef const matrix_type & | const_matrix_reference |
typedef Matrix< matrix_type, Prop, Storage, NewAlloc< T > > | collection_type |
typedef const collection_type | const_collection_type |
typedef collection_type & | collection_reference |
typedef const collection_type & | const_collection_reference |
Public Member Functions | |
MatrixCollection () | |
Default constructor. | |
MatrixCollection (int i, int j) | |
Main constructor. | |
MatrixCollection (const MatrixCollection< T, Prop, Storage, Allocator > &A) | |
Copy constructor. | |
~MatrixCollection () | |
Destructor. | |
void | Clear () |
Clears the matrix. | |
void | Nullify () |
Clears the matrix. | |
void | Nullify (int i, int j) |
Clears a given underlying matrix. | |
void | Deallocate () |
Deallocates underlying the matrices. | |
int | GetM () const |
Returns the number of rows. | |
int | GetMmatrix () const |
Returns the number of rows. | |
int | GetM (int i) const |
Returns the number of rows in an underlying matrix. | |
int | GetN () const |
Returns the number of columns. | |
int | GetNmatrix () const |
Returns the number of columns. | |
int | GetN (int j) const |
Returns the number of columns in an underlying matrix. | |
int | GetSize () const |
Returns the number of elements stored in memory. | |
int | GetDataSize () const |
Returns the number of elements stored in memory. | |
void | Reallocate (int i, int j) |
Reallocates memory to resize the matrix collection. | |
template<class T0 , class Prop0 , class Storage0 , class Allocator0 > | |
void | SetMatrix (int m, int n, const Matrix< T0, Prop0, Storage0, Allocator0 > &) |
Sets an underlying matrix in the matrix collection. | |
template<class T0 , class Prop0 , class Allocator0 > | |
void | SetMatrix (int m, int n, const Matrix< T0, Prop0, RowSparse, Allocator0 > &) |
Sets an underlying matrix in the matrix collection. | |
matrix_reference | GetMatrix (int i, int j) |
Access to an underlying matrix. | |
const_matrix_reference | GetMatrix (int i, int j) const |
Access to an underlying matrix. | |
value_type | operator() (int i, int j) const |
Access operator. | |
MatrixCollection< T, Prop, Storage, Allocator > & | operator= (const MatrixCollection< T, Prop, Storage, Allocator > &A) |
Duplicates a matrix collection (assignment operator). | |
void | Copy (const MatrixCollection< T, Prop, Storage, Allocator > &A) |
Duplicates a matrix collection. | |
void | Print () const |
Displays the matrix collection on the standard output. | |
void | Print (int m, int n) const |
Displays an underlying matrix on the standard output. | |
void | Write (string FileName, bool with_size) const |
Writes the matrix collection in a file. | |
void | Write (ostream &FileStream, bool with_size) const |
Writes the matrix collection to an output stream. | |
void | WriteText (string FileName) const |
Writes the matrix collection in a file. | |
void | WriteText (ostream &FileStream) const |
Writes the matrix collection to an output stream. | |
void | Read (string FileName) |
Reads the matrix collection from a file. | |
void | Read (istream &FileStream) |
Reads the matrix collection from an input stream. | |
int | GetM (const Seldon::SeldonTranspose &status) const |
Returns the number of rows of the matrix possibly transposed. | |
int | GetN (const Seldon::SeldonTranspose &status) const |
Returns the number of columns of the matrix possibly transposed. | |
pointer | GetData () const |
Returns a pointer to the data array. | |
const_pointer | GetDataConst () const |
Returns a const pointer to the data array. | |
void * | GetDataVoid () const |
Returns a pointer of type "void*" to the data array. | |
const void * | GetDataConstVoid () const |
Returns a pointer of type "const void*" to the data array. | |
Allocator & | GetAllocator () |
Returns the allocator of the matrix. | |
Protected Attributes | |
int | nz_ |
Number of non-zero elements. | |
int | Mmatrix_ |
Number of rows of matrices. | |
int | Nmatrix_ |
Number of columns of matrices. | |
Vector< int, VectFull, CallocAlloc< int > > | Mlocal_ |
Number of rows in the underlying matrices. | |
Vector< int, VectFull, CallocAlloc< int > > | Mlocal_sum_ |
Cumulative number of rows in the underlying matrices. | |
Vector< int, VectFull, CallocAlloc< int > > | Nlocal_ |
Number of columns in the underlying matrices. | |
Vector< int, VectFull, CallocAlloc< int > > | Nlocal_sum_ |
Cumulative number of columns in the underlying matrices. | |
collection_type | matrix_ |
Pointers of the underlying matrices. | |
int | m_ |
int | n_ |
pointer | data_ |
Static Protected Attributes | |
static Allocator | allocator_ |
Matrix class made of a collection of matrices.
Definition at line 37 of file MatrixCollection.hxx.
Seldon::MatrixCollection< T, Prop, Storage, Allocator >::MatrixCollection | ( | ) | [inline] |
Default constructor.
On exit, the matrix is an empty 0x0 matrix.
Definition at line 42 of file MatrixCollection.cxx.
Seldon::MatrixCollection< T, Prop, Storage, Allocator >::MatrixCollection | ( | int | i, | |
int | j | |||
) | [inline] |
Main constructor.
Builds a i x j collection matrix.
[in] | i | number of rows of matrices. |
[in] | j | number of columns of matrices. |
Definition at line 61 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Clear | ( | ) | [inline] |
Clears the matrix.
Destructs the matrix.
Definition at line 105 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Copy | ( | const MatrixCollection< T, Prop, Storage, Allocator > & | A | ) | [inline] |
Duplicates a matrix collection.
[in] | A | matrix collection to be copied. |
Definition at line 557 of file MatrixCollection.cxx.
Allocator & Seldon::Matrix_Base< T, Allocator >::GetAllocator | ( | ) | [inherited] |
Returns the allocator of the matrix.
Definition at line 257 of file Matrix_Base.cxx.
Matrix_Base< T, Allocator >::pointer Seldon::Matrix_Base< T, Allocator >::GetData | ( | ) | const [inherited] |
Returns a pointer to the data array.
Returns a pointer to data, i.e. the data array 'data_'.
Definition at line 207 of file Matrix_Base.cxx.
Matrix_Base< T, Allocator >::const_pointer Seldon::Matrix_Base< T, Allocator >::GetDataConst | ( | ) | const [inherited] |
Returns a const pointer to the data array.
Returns a const pointer to data, i.e. the data array 'data_'.
Definition at line 220 of file Matrix_Base.cxx.
const void * Seldon::Matrix_Base< T, Allocator >::GetDataConstVoid | ( | ) | const [inherited] |
Returns a pointer of type "const void*" to the data array.
Returns a pointer of type "const void*" to data, i.e. the data array 'data_'.
Definition at line 246 of file Matrix_Base.cxx.
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetDataSize | ( | ) | const |
Returns the number of elements stored in memory.
Definition at line 280 of file MatrixCollection.cxx.
void * Seldon::Matrix_Base< T, Allocator >::GetDataVoid | ( | ) | const [inherited] |
Returns a pointer of type "void*" to the data array.
Returns a pointer of type "void*" to data, i.e. the data array 'data_'.
Definition at line 233 of file Matrix_Base.cxx.
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetM | ( | ) | const |
Returns the number of rows.
Reimplemented from Seldon::Matrix_Base< T, Allocator >.
Definition at line 181 of file MatrixCollection.cxx.
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetM | ( | int | i | ) | const |
Returns the number of rows in an underlying matrix.
[in] | i | row index of the underlying matrix. |
Definition at line 205 of file MatrixCollection.cxx.
int Seldon::Matrix_Base< T, Allocator >::GetM | ( | const Seldon::SeldonTranspose & | status | ) | const [inherited] |
Returns the number of rows of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Reimplemented in Seldon::SubMatrix_Base< T, Prop, M, Allocator >.
Definition at line 129 of file Matrix_Base.cxx.
MatrixCollection< T, Prop, Storage, Allocator >::const_matrix_reference Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetMatrix | ( | int | i, | |
int | j | |||
) | const [inline] |
Access to an underlying matrix.
Returns the underlying matrix (i, j).
[in] | i | row index. |
[in] | j | column index. |
Definition at line 472 of file MatrixCollection.cxx.
MatrixCollection< T, Prop, Storage, Allocator >::matrix_reference Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetMatrix | ( | int | i, | |
int | j | |||
) | [inline] |
Access to an underlying matrix.
Returns the underlying matrix (i, j).
[in] | i | row index. |
[in] | j | column index. |
Definition at line 443 of file MatrixCollection.cxx.
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetMmatrix | ( | ) | const |
Returns the number of rows.
Definition at line 193 of file MatrixCollection.cxx.
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetN | ( | ) | const |
Returns the number of columns.
Reimplemented from Seldon::Matrix_Base< T, Allocator >.
Definition at line 225 of file MatrixCollection.cxx.
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetN | ( | int | j | ) | const |
Returns the number of columns in an underlying matrix.
[in] | j | column index of the underlying matrix. |
Definition at line 250 of file MatrixCollection.cxx.
int Seldon::Matrix_Base< T, Allocator >::GetN | ( | const Seldon::SeldonTranspose & | status | ) | const [inherited] |
Returns the number of columns of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Reimplemented in Seldon::SubMatrix_Base< T, Prop, M, Allocator >.
Definition at line 144 of file Matrix_Base.cxx.
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetNmatrix | ( | ) | const |
Returns the number of columns.
Definition at line 237 of file MatrixCollection.cxx.
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetSize | ( | ) | const |
Returns the number of elements stored in memory.
Reimplemented from Seldon::Matrix_Base< T, Allocator >.
Definition at line 269 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Nullify | ( | ) | [inline] |
Clears the matrix.
Destructs the matrix.
Definition at line 129 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Nullify | ( | int | i, | |
int | j | |||
) | [inline] |
Clears a given underlying matrix.
[in] | i | row of the underlying matrix to be nullified. |
[in] | j | column of the underlying matrix to be nullified. |
Definition at line 152 of file MatrixCollection.cxx.
MatrixCollection< T, Prop, Storage, Allocator >::value_type Seldon::MatrixCollection< T, Prop, Storage, Allocator >::operator() | ( | int | i, | |
int | j | |||
) | const [inline] |
Access operator.
Returns the value of element (i, j).
[in] | i | row index. |
[in] | j | column index. |
Definition at line 502 of file MatrixCollection.cxx.
MatrixCollection< T, Prop, Storage, Allocator > & Seldon::MatrixCollection< T, Prop, Storage, Allocator >::operator= | ( | const MatrixCollection< T, Prop, Storage, Allocator > & | A | ) | [inline] |
Duplicates a matrix collection (assignment operator).
[in] | A | matrix collection to be copied. |
Definition at line 542 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Print | ( | ) | const |
Displays the matrix collection on the standard output.
Displays elements on the standard output, in text format.
Definition at line 589 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Print | ( | int | i, | |
int | j | |||
) | const |
Displays an underlying matrix on the standard output.
[in] | m | row index of the underlying matrix. |
[in] | n | column index of the underlying matrix. |
Definition at line 607 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Read | ( | istream & | FileStream | ) |
Reads the matrix collection from an input stream.
Reads a matrix collection stored in binary format from a stream. The number of rows of matrices (integer) and the number of columns of matrices (integer) are read, and the underlying matrices are then read in the same order as it should be in memory (e.g. row-major storage).
[in,out] | FileStream | input stream. |
Definition at line 801 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Read | ( | string | FileName | ) |
Reads the matrix collection from a file.
Reads a matrix collection stored in binary format in a file. The number of rows of matrices (integer) and the number of columns of matrices (integer) are read, and the underlying matrices are then read in the same order as it should be in memory (e.g. row-major storage).
[in] | FileName | input file name. |
Definition at line 774 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Reallocate | ( | int | i, | |
int | j | |||
) | [inline] |
Reallocates memory to resize the matrix collection.
On exit, the matrix is a matrix collection with i x j underlying matrices.
[in] | i | number of rows of matrices. |
[in] | j | number of columns of matrices. |
Definition at line 300 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::SetMatrix | ( | int | i, | |
int | j, | |||
const Matrix< T0, Prop0, RowSparse, Allocator0 > & | A | |||
) | [inline] |
Sets an underlying matrix in the matrix collection.
[in] | i | row of the underlying matrix to be set. |
[in] | j | column of the underlying matrix to be set. |
[in] | matrix | new value for the underlying matrix. |
Definition at line 381 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::SetMatrix | ( | int | i, | |
int | j, | |||
const Matrix< T0, Prop0, Storage0, Allocator0 > & | A | |||
) | [inline] |
Sets an underlying matrix in the matrix collection.
[in] | i | row of the underlying matrix to be set. |
[in] | j | column of the underlying matrix to be set. |
[in] | matrix | new value for the underlying matrix. |
Definition at line 326 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Write | ( | ostream & | FileStream, | |
bool | with_size = true | |||
) | const |
Writes the matrix collection to an output stream.
Writes the matrix collection to an output stream in binary format. The number of rows of matrices (integer) and the number of columns of matrices (integer) are written, and the underlying matrices are then written in the same order as in memory (e.g. row-major storage).
[in,out] | FileStream | output stream. |
[in] | with_size | if set to 'false', the dimensions of the matrix are not saved. |
Definition at line 666 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Write | ( | string | FileName, | |
bool | with_size | |||
) | const |
Writes the matrix collection in a file.
Stores the matrix collection in a file in binary format. The number of rows of matrices (integer) and the number of columns of matrices (integer) are written, and the underlying matrices are then written in the same order as in memory (e.g. row-major storage).
[in] | FileName | output file name. |
[in] | with_size | if set to 'false', the dimensions of the matrix are not saved. |
Definition at line 637 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::WriteText | ( | ostream & | FileStream | ) | const |
Writes the matrix collection to an output stream.
Stores the matrix to an output stream in text format. Only the underlying matrices are written, without the dimensions. Each row is written on a single line and elements of a row are delimited by tabulations.
[in,out] | FileStream | output stream. |
Definition at line 738 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::WriteText | ( | string | FileName | ) | const |
Writes the matrix collection in a file.
Stores the matrix in a file in text format. Only the underlying matrices are written, without the dimensions. Each row is written on a single line and elements of a row are delimited by tabulations.
[in] | FileName | output file name. |
Definition at line 709 of file MatrixCollection.cxx.