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 matrix_type & | matrix_reference |
typedef Matrix< matrix_type, Prop, Storage, NewAlloc< T > > | collection_type |
typedef collection_type & | collection_reference |
Public Member Functions | |
MatrixCollection () | |
Default constructor. More... | |
MatrixCollection (int i, int j) | |
Main constructor. More... | |
MatrixCollection (const MatrixCollection< T, Prop, Storage, Allocator > &A) | |
Copy constructor. | |
~MatrixCollection () | |
Destructor. | |
void | Clear () |
Clears the matrix. More... | |
void | Nullify () |
Clears the matrix. More... | |
void | Nullify (int i, int j) |
Clears a given underlying matrix. More... | |
void | Deallocate () |
Deallocates underlying the matrices. | |
int | GetM () const |
Returns the number of rows. More... | |
int | GetMmatrix () const |
Returns the number of rows. More... | |
int | GetM (int i) const |
Returns the number of rows in an underlying matrix. More... | |
int | GetN () const |
Returns the number of columns. More... | |
int | GetNmatrix () const |
Returns the number of columns. More... | |
int | GetN (int j) const |
Returns the number of columns in an underlying matrix. More... | |
int | GetSize () const |
Returns the number of elements stored in memory. More... | |
int | GetDataSize () const |
Returns the number of elements stored in memory. More... | |
size_t | GetMemorySize () const |
Returns size of A in bytes used to store the matrix. | |
void | Reallocate (int i, int j) |
Reallocates memory to resize the matrix collection. More... | |
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. More... | |
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. More... | |
matrix_reference | GetMatrix (int i, int j) |
Access to an underlying matrix. More... | |
const_matrix_reference | GetMatrix (int i, int j) const |
Access to an underlying matrix. More... | |
value_type | operator() (int i, int j) const |
Access operator. More... | |
MatrixCollection< T, Prop, Storage, Allocator > & | operator= (const MatrixCollection< T, Prop, Storage, Allocator > &A) |
Duplicates a matrix collection (assignment operator). More... | |
void | Copy (const MatrixCollection< T, Prop, Storage, Allocator > &A) |
Duplicates a matrix collection. More... | |
void | Print () const |
Displays the matrix collection on the standard output. More... | |
void | Print (int m, int n) const |
Displays an underlying matrix on the standard output. More... | |
void | Write (string FileName, bool with_size) const |
Writes the matrix collection in a file. More... | |
void | Write (ostream &FileStream, bool with_size) const |
Writes the matrix collection to an output stream. More... | |
void | WriteText (string FileName) const |
Writes the matrix collection in a file. More... | |
void | WriteText (ostream &FileStream) const |
Writes the matrix collection to an output stream. More... | |
void | Read (string FileName) |
Reads the matrix collection from a file. More... | |
void | Read (istream &FileStream) |
Reads the matrix collection from an input stream. More... | |
pointer | GetData () const |
Returns a pointer to the data array. More... | |
const_pointer | GetDataConst () const |
Returns a const pointer to the data array. More... | |
void * | GetDataVoid () const |
Returns a pointer of type "void*" to the data array. More... | |
const void * | GetDataConstVoid () const |
Returns a pointer of type "const void*" to the data array. More... | |
int | GetM (const Seldon::SeldonTranspose &status) const |
Returns the number of rows of the matrix possibly transposed. More... | |
int | GetM (const CBLAS_TRANSPOSE &status) const |
Returns the number of rows of the matrix possibly transposed. More... | |
int | GetN (const Seldon::SeldonTranspose &status) const |
Returns the number of columns of the matrix possibly transposed. More... | |
int | GetN (const CBLAS_TRANSPOSE &status) const |
Returns the number of columns of the matrix possibly transposed. More... | |
Public Attributes | |
const typedef matrix_type * | const_matrix_pointer |
const typedef matrix_type & | const_matrix_reference |
const typedef collection_type | const_collection_type |
const typedef collection_type & | const_collection_reference |
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. | |
pointer | data_ |
int | m_ |
int | n_ |
Matrix class made of a collection of matrices.
Definition at line 37 of file MatrixCollection.hxx.
Seldon::MatrixCollection< T, Prop, Storage, Allocator >::MatrixCollection |
Default constructor.
On exit, the matrix is an empty 0x0 matrix.
Definition at line 45 of file MatrixCollection.cxx.
Seldon::MatrixCollection< T, Prop, Storage, Allocator >::MatrixCollection | ( | int | i, |
int | j | ||
) |
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 64 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Clear |
Clears the matrix.
Destructs the matrix.
Definition at line 85 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Copy | ( | const MatrixCollection< T, Prop, Storage, Allocator > & | A | ) |
Duplicates a matrix collection.
[in] | A | matrix collection to be copied. |
Definition at line 358 of file MatrixCollection.cxx.
|
inlineinherited |
Returns a pointer to the data array.
Returns a pointer to data, i.e. the data array 'data_'.
Definition at line 241 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns a const pointer to the data array.
Returns a const pointer to data, i.e. the data array 'data_'.
Definition at line 254 of file Matrix_BaseInline.cxx.
|
inlineinherited |
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 280 of file Matrix_BaseInline.cxx.
|
inline |
Returns the number of elements stored in memory.
Definition at line 168 of file MatrixCollectionInline.cxx.
|
inlineinherited |
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 267 of file Matrix_BaseInline.cxx.
|
inline |
Returns the number of rows.
Definition at line 69 of file MatrixCollectionInline.cxx.
|
inlineinherited |
Returns the number of rows of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 122 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns the number of rows of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 92 of file Matrix_BaseInline.cxx.
|
inline |
Returns the number of rows in an underlying matrix.
[in] | i | row index of the underlying matrix. |
Definition at line 93 of file MatrixCollectionInline.cxx.
|
inline |
Access to an underlying matrix.
Returns the underlying matrix (i, j).
[in] | i | row index. |
[in] | j | column index. |
Definition at line 198 of file MatrixCollectionInline.cxx.
|
inline |
Access to an underlying matrix.
Returns the underlying matrix (i, j).
[in] | i | row index. |
[in] | j | column index. |
Definition at line 227 of file MatrixCollectionInline.cxx.
|
inline |
Returns the number of rows.
Definition at line 81 of file MatrixCollectionInline.cxx.
|
inline |
Returns the number of columns.
Definition at line 113 of file MatrixCollectionInline.cxx.
|
inlineinherited |
Returns the number of columns of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 137 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns the number of columns of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 107 of file Matrix_BaseInline.cxx.
|
inline |
Returns the number of columns in an underlying matrix.
[in] | j | column index of the underlying matrix. |
Definition at line 138 of file MatrixCollectionInline.cxx.
|
inline |
Returns the number of columns.
Definition at line 125 of file MatrixCollectionInline.cxx.
|
inline |
Returns the number of elements stored in memory.
Definition at line 157 of file MatrixCollectionInline.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Nullify |
Clears the matrix.
Destructs the matrix.
Definition at line 109 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Nullify | ( | int | i, |
int | j | ||
) |
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 132 of file MatrixCollection.cxx.
MatrixCollection< T, Prop, Storage, Allocator >::value_type Seldon::MatrixCollection< T, Prop, Storage, Allocator >::operator() | ( | int | i, |
int | j | ||
) | const |
Access operator.
Returns the value of element (i, j).
[in] | i | row index. |
[in] | j | column index. |
Definition at line 303 of file MatrixCollection.cxx.
MatrixCollection< T, Prop, Storage, Allocator > & Seldon::MatrixCollection< T, Prop, Storage, Allocator >::operator= | ( | const MatrixCollection< T, Prop, Storage, Allocator > & | A | ) |
Duplicates a matrix collection (assignment operator).
[in] | A | matrix collection to be copied. |
Definition at line 343 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Print |
Displays the matrix collection on the standard output.
Displays elements on the standard output, in text format.
Definition at line 390 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 408 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 602 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 575 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Reallocate | ( | int | i, |
int | j | ||
) |
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 164 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::SetMatrix | ( | int | i, |
int | j, | ||
const Matrix< T0, Prop0, RowSparse, Allocator0 > & | A | ||
) |
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 245 of file MatrixCollection.cxx.
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::SetMatrix | ( | int | i, |
int | j, | ||
const Matrix< T0, Prop0, Storage0, Allocator0 > & | A | ||
) |
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 190 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 467 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 438 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 539 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 510 of file MatrixCollection.cxx.