Matrix class made of an heterogeneous collection of matrices. More...
#include <HeterogeneousMatrixCollection.hxx>
Public Types | |
typedef Matrix< float, Prop0, Storage0, Allocator< float > > | float_dense_m |
typedef Matrix< float, Prop1, Storage1, Allocator< float > > | float_sparse_m |
typedef Matrix< double, Prop0, Storage0, Allocator< double > > | double_dense_m |
typedef Matrix< double, Prop1, Storage1, Allocator< double > > | double_sparse_m |
typedef Matrix< float_dense_m, General, RowMajorCollection, NewAlloc< float_dense_m > > | float_dense_c |
typedef Matrix< float_sparse_m, General, RowMajorCollection, NewAlloc< float_sparse_m > > | float_sparse_c |
typedef Matrix< double_dense_m, General, RowMajorCollection, NewAlloc< double_dense_m > > | double_dense_c |
typedef Matrix< double_sparse_m, General, RowMajorCollection, NewAlloc< double_sparse_m > > | double_sparse_c |
typedef Allocator< double > ::value_type | value_type |
typedef Allocator< double > ::pointer | pointer |
typedef Allocator< double > ::const_pointer | const_pointer |
typedef Allocator< double > ::reference | reference |
typedef Allocator< double > ::const_reference | const_reference |
Public Member Functions | |
HeterogeneousMatrixCollection () | |
Default constructor. More... | |
HeterogeneousMatrixCollection (int i, int j) | |
Main constructor. More... | |
HeterogeneousMatrixCollection (const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &A) | |
Copy constructor. More... | |
~HeterogeneousMatrixCollection () | |
Destructor. | |
void | Clear () |
Clears the matrix collection without releasing memory. | |
void | Nullify () |
Clears the matrix collection without releasing memory. | |
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. | |
int | GetType (int i, int j) const |
Returns the type of a given underlying matrix. More... | |
float_dense_c & | GetFloatDense () |
Returns the collection of float dense underlying matrices. More... | |
const float_dense_c & | GetFloatDense () const |
float_sparse_c & | GetFloatSparse () |
Returns the collection of float sparse underlying matrices. More... | |
const float_sparse_c & | GetFloatSparse () const |
double_dense_c & | GetDoubleDense () |
Returns the collection of double dense underlying matrices. More... | |
const double_dense_c & | GetDoubleDense () const |
double_sparse_c & | GetDoubleSparse () |
Returns the collection of double sparse underlying matrices. More... | |
const double_sparse_c & | GetDoubleSparse () const |
void | Reallocate (int i, int j) |
Reallocates memory to resize the matrix collection. More... | |
void | SetMatrix (int m, int n, const float_dense_m &) |
void | SetMatrix (int m, int n, const float_sparse_m &) |
void | SetMatrix (int m, int n, const double_dense_m &) |
void | SetMatrix (int m, int n, const double_sparse_m &) |
void | GetMatrix (int m, int n, float_dense_m &) const |
void | GetMatrix (int m, int n, float_sparse_m &) const |
void | GetMatrix (int m, int n, double_dense_m &) const |
void | GetMatrix (int m, int n, double_sparse_m &) const |
double | operator() (int i, int j) const |
Access operator. More... | |
HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > & | operator= (const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &A) |
Duplicates a matrix collection (assignment operator). More... | |
void | Copy (const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &A) |
Duplicates a matrix collection (assignment operator). More... | |
void | Print () const |
Displays the matrix collection 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 |
Returns the number of rows. 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 |
Returns the number of columns. 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... | |
long | GetSize () const |
Returns the number of elements in the matrix. More... | |
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 > | Mlocal_ |
Number of rows in the underlying matrices. | |
Vector< int > | Mlocal_sum_ |
Cumulative number of rows in the underlying matrices. | |
Vector< int > | Nlocal_ |
Number of columns in the underlying matrices. | |
Vector< int > | Nlocal_sum_ |
Cumulative number of columns in the underlying matrices. | |
Matrix< int, General, RowMajor > | collection_ |
Type of the underlying matrices. More... | |
float_dense_c | float_dense_c_ |
Pointers of the underlying float dense matrices. | |
float_sparse_c | float_sparse_c_ |
Pointers of the underlying float sparse matrices. | |
double_dense_c | double_dense_c_ |
Pointers of the underlying double dense matrices. | |
double_sparse_c | double_sparse_c_ |
Pointers of the underlying double sparse matrices. | |
pointer | data_ |
int | m_ |
int | n_ |
Matrix class made of an heterogeneous collection of matrices.
A collection can refer to matrices of different types : float, double, dense and sparse.
Definition at line 42 of file HeterogeneousMatrixCollection.hxx.
Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::HeterogeneousMatrixCollection |
Default constructor.
On exit, the matrix is an empty 0x0 matrix.
Definition at line 47 of file HeterogeneousMatrixCollection.cxx.
Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::HeterogeneousMatrixCollection | ( | 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 70 of file HeterogeneousMatrixCollection.cxx.
|
inline |
Copy constructor.
[in] | A | matrix collection to be copied. |
Definition at line 44 of file HeterogeneousMatrixCollectionInline.cxx.
Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::Copy | ( | const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > & | A | ) |
Duplicates a matrix collection (assignment operator).
[in] | A | matrix collection to be copied. |
Definition at line 850 of file HeterogeneousMatrixCollection.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 203 of file HeterogeneousMatrixCollectionInline.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 collection of double dense underlying matrices.
Definition at line 331 of file HeterogeneousMatrixCollectionInline.cxx.
|
inline |
Returns the collection of double sparse underlying matrices.
Definition at line 363 of file HeterogeneousMatrixCollectionInline.cxx.
|
inline |
Returns the collection of float dense underlying matrices.
Definition at line 267 of file HeterogeneousMatrixCollectionInline.cxx.
|
inline |
Returns the collection of float sparse underlying matrices.
Definition at line 299 of file HeterogeneousMatrixCollectionInline.cxx.
|
inlineinherited |
Returns the number of rows.
Definition at line 69 of file Matrix_BaseInline.cxx.
|
inline |
Returns the number of rows.
Definition at line 82 of file HeterogeneousMatrixCollectionInline.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 112 of file HeterogeneousMatrixCollectionInline.cxx.
|
inline |
Returns the number of rows.
Definition at line 97 of file HeterogeneousMatrixCollectionInline.cxx.
|
inlineinherited |
Returns the number of columns.
Definition at line 80 of file Matrix_BaseInline.cxx.
|
inline |
Returns the number of columns.
Definition at line 135 of file HeterogeneousMatrixCollectionInline.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 166 of file HeterogeneousMatrixCollectionInline.cxx.
|
inline |
Returns the number of columns.
Definition at line 150 of file HeterogeneousMatrixCollectionInline.cxx.
|
inlineinherited |
Returns the number of elements in the matrix.
Returns the number of elements in the matrix, i.e. the number of rows multiplied by the number of columns.
Definition at line 153 of file Matrix_BaseInline.cxx.
|
inline |
Returns the number of elements stored in memory.
Definition at line 188 of file HeterogeneousMatrixCollectionInline.cxx.
|
inline |
Returns the type of a given underlying matrix.
Type 0 refers to a float dense matrice. Type 1 refers to a float sparse matrice. Type 2 refers to a double dense matrice. Type 3 refers to a double sparse matrice.
[in] | i | row of the given underlying matrix. |
[in] | j | column of the given underlying matrix. |
Definition at line 238 of file HeterogeneousMatrixCollectionInline.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 142 of file HeterogeneousMatrixCollection.cxx.
double Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 764 of file HeterogeneousMatrixCollection.cxx.
HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::operator= | ( | const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > & | A | ) |
Duplicates a matrix collection (assignment operator).
[in] | A | matrix collection to be copied. |
Definition at line 832 of file HeterogeneousMatrixCollection.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::Print |
Displays the matrix collection on the standard output.
Displays elements on the standard output, in text format.
Definition at line 925 of file HeterogeneousMatrixCollection.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 1199 of file HeterogeneousMatrixCollection.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 1169 of file HeterogeneousMatrixCollection.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 211 of file HeterogeneousMatrixCollection.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 980 of file HeterogeneousMatrixCollection.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 949 of file HeterogeneousMatrixCollection.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 1095 of file HeterogeneousMatrixCollection.cxx.
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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 1063 of file HeterogeneousMatrixCollection.cxx.
|
protected |
Type of the underlying matrices.
Type 0 refers to float dense matrices. Type 1 refers to float sparse matrices. Type 2 refers to double dense matrices. Type 3 refers to double sparse matrices.
Definition at line 88 of file HeterogeneousMatrixCollection.hxx.