Public Types | Public Member Functions | Protected Attributes | List of all members
Seldon::Matrix< FloatDouble, General, DenseSparseCollection, Allocator< double > > Class Template Reference

Heterogeneous matrix collection class. More...

#include <HeterogeneousMatrixCollection.hxx>

Inheritance diagram for Seldon::Matrix< FloatDouble, General, DenseSparseCollection, Allocator< double > >:
Seldon::HeterogeneousMatrixCollection< General, RowMajor, General, RowSparse, Allocator > Seldon::Matrix_Base< double, Allocator< double > > Seldon::VirtualMatrix< double >

Public Types

typedef General property
 
typedef DenseSparseCollection storage
 
typedef Allocator< double > allocator
 
typedef Matrix< float, General, RowMajor, Allocator< float > > float_dense_m
 
typedef Matrix< float, General, RowSparse, Allocator< float > > float_sparse_m
 
typedef Matrix< double, General, RowMajor, Allocator< double > > double_dense_m
 
typedef Matrix< double, General, RowSparse, 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

 Matrix ()
 Default constructor. More...
 
 Matrix (int i, int j)
 Main constructor. More...
 
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 GetM (int i) const
 Returns the number of rows in an underlying matrix. 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 GetMmatrix () const
 Returns the number of rows. More...
 
int GetN () const
 Returns the number of columns. More...
 
int GetN (int j) const
 Returns the number of columns in an underlying matrix. 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...
 
int GetNmatrix () const
 Returns the number of columns. 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_cGetFloatDense ()
 Returns the collection of float dense underlying matrices. More...
 
const float_dense_cGetFloatDense () const
 
float_sparse_cGetFloatSparse ()
 Returns the collection of float sparse underlying matrices. More...
 
const float_sparse_cGetFloatSparse () const
 
double_dense_cGetDoubleDense ()
 Returns the collection of double dense underlying matrices. More...
 
const double_dense_cGetDoubleDense () const
 
double_sparse_cGetDoubleSparse ()
 Returns the collection of double sparse underlying matrices. More...
 
const double_sparse_cGetDoubleSparse () 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...
 
void Copy (const HeterogeneousMatrixCollection< General, RowMajor, General, RowSparse, 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...
 

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, RowMajorcollection_
 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_
 

Detailed Description

template<template< class U > class Allocator>
class Seldon::Matrix< FloatDouble, General, DenseSparseCollection, Allocator< double > >

Heterogeneous matrix collection class.

Definition at line 180 of file HeterogeneousMatrixCollection.hxx.

Constructor & Destructor Documentation

◆ Matrix() [1/2]

template<template< class U > class Allocator>
Seldon::Matrix< FloatDouble, General, DenseSparseCollection, Allocator< double > >::Matrix
inline

Default constructor.

On exit, the matrix is an empty 0x0 matrix.

Definition at line 397 of file HeterogeneousMatrixCollectionInline.cxx.

◆ Matrix() [2/2]

template<template< class U > class Allocator>
Seldon::Matrix< FloatDouble, General, DenseSparseCollection, Allocator< double > >::Matrix ( int  i,
int  j 
)
inline

Main constructor.

Builds a i x j collection matrix.

Parameters
[in]inumber of rows of matrices.
[in]jnumber of columns of matrices.

Definition at line 412 of file HeterogeneousMatrixCollectionInline.cxx.

Member Function Documentation

◆ Copy()

Duplicates a matrix collection (assignment operator).

Parameters
[in]Amatrix collection to be copied.
Note
Memory is duplicated: A is therefore independent from the current instance after the copy.

Definition at line 850 of file HeterogeneousMatrixCollection.cxx.

◆ GetData()

Matrix_Base< double , Allocator< double > >::pointer Seldon::Matrix_Base< double , Allocator< double > >::GetData
inlineinherited

Returns a pointer to the data array.

Returns a pointer to data, i.e. the data array 'data_'.

Returns
A pointer to the data array.

Definition at line 241 of file Matrix_BaseInline.cxx.

◆ GetDataConst()

Matrix_Base< double , Allocator< double > >::const_pointer Seldon::Matrix_Base< double , Allocator< double > >::GetDataConst
inlineinherited

Returns a const pointer to the data array.

Returns a const pointer to data, i.e. the data array 'data_'.

Returns
A const pointer to the data array.

Definition at line 254 of file Matrix_BaseInline.cxx.

◆ GetDataConstVoid()

const void * Seldon::Matrix_Base< double , Allocator< double > >::GetDataConstVoid
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_'.

Returns
A const pointer of type "void*" to the data array.

Definition at line 280 of file Matrix_BaseInline.cxx.

◆ GetDataSize()

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetDataSize
inlineinherited

Returns the number of elements stored in memory.

Returns
The number of elements stored in memory.

Definition at line 203 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetDataVoid()

void * Seldon::Matrix_Base< double , Allocator< double > >::GetDataVoid
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_'.

Returns
A pointer of type "void*" to the data array.

Definition at line 267 of file Matrix_BaseInline.cxx.

◆ GetDoubleDense()

const HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::double_dense_c & Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetDoubleDense
inlineinherited

Returns the collection of double dense underlying matrices.

Returns
the collection of double dense underlying matrices.

Definition at line 331 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetDoubleSparse()

const HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::double_sparse_c & Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetDoubleSparse
inlineinherited

Returns the collection of double sparse underlying matrices.

Returns
the collection of double sparse underlying matrices.

Definition at line 363 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetFloatDense()

const HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::float_dense_c & Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetFloatDense
inlineinherited

Returns the collection of float dense underlying matrices.

Returns
the collection of float dense underlying matrices.

Definition at line 267 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetFloatSparse()

const HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::float_sparse_c & Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetFloatSparse
inlineinherited

Returns the collection of float sparse underlying matrices.

Returns
the collection of float sparse underlying matrices.

Definition at line 299 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetM() [1/4]

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetM
inlineinherited

Returns the number of rows.

Returns
the total number of rows. It is the sum of the number of rows in the underlying matrices.

Definition at line 82 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetM() [2/4]

int Seldon::VirtualMatrix< double >::GetM ( const CBLAS_TRANSPOSE &  status) const
inlineinherited

Returns the number of rows of the matrix possibly transposed.

Parameters
statusassumed status about the transposition of the matrix.
Returns
The number of rows of the possibly-transposed matrix.

Definition at line 122 of file Matrix_BaseInline.cxx.

◆ GetM() [3/4]

int Seldon::VirtualMatrix< double >::GetM ( const Seldon::SeldonTranspose status) const
inlineinherited

Returns the number of rows of the matrix possibly transposed.

Parameters
statusassumed status about the transposition of the matrix.
Returns
The number of rows of the possibly-transposed matrix.

Definition at line 92 of file Matrix_BaseInline.cxx.

◆ GetM() [4/4]

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetM ( int  i) const
inlineinherited

Returns the number of rows in an underlying matrix.

Parameters
[in]irow index of the underlying matrix.
Returns
The number of rows in the underlying matrices with row index i.

Definition at line 112 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetMmatrix()

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetMmatrix
inlineinherited

Returns the number of rows.

Returns
the total number of rows. It is the sum of the number of rows in the underlying matrices.

Definition at line 97 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetN() [1/4]

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetN
inlineinherited

Returns the number of columns.

Returns
the total number of columns. It is the sum of the number of columns in the underlying matrices.

Definition at line 135 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetN() [2/4]

int Seldon::VirtualMatrix< double >::GetN ( const CBLAS_TRANSPOSE &  status) const
inlineinherited

Returns the number of columns of the matrix possibly transposed.

Parameters
statusassumed status about the transposition of the matrix.
Returns
The number of columns of the possibly-transposed matrix.

Definition at line 137 of file Matrix_BaseInline.cxx.

◆ GetN() [3/4]

int Seldon::VirtualMatrix< double >::GetN ( const Seldon::SeldonTranspose status) const
inlineinherited

Returns the number of columns of the matrix possibly transposed.

Parameters
statusassumed status about the transposition of the matrix.
Returns
The number of columns of the possibly-transposed matrix.

Definition at line 107 of file Matrix_BaseInline.cxx.

◆ GetN() [4/4]

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetN ( int  j) const
inlineinherited

Returns the number of columns in an underlying matrix.

Parameters
[in]jcolumn index of the underlying matrix.
Returns
The number of columns in the underlying matrices with column index j.

Definition at line 166 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetNmatrix()

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetNmatrix
inlineinherited

Returns the number of columns.

Returns
the total number of columns. It is the sum of the number of columns in the underlying matrices.

Definition at line 150 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetSize()

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetSize
inlineinherited

Returns the number of elements stored in memory.

Returns
The number of elements stored in memory.

Definition at line 188 of file HeterogeneousMatrixCollectionInline.cxx.

◆ GetType()

int Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::GetType ( int  i,
int  j 
) const
inlineinherited

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.

Parameters
[in]irow of the given underlying matrix.
[in]jcolumn of the given underlying matrix.
Returns
The type of the underlying matrix.

Definition at line 238 of file HeterogeneousMatrixCollectionInline.cxx.

◆ Nullify()

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::Nullify ( int  i,
int  j 
)
inherited

Clears a given underlying matrix.

Parameters
[in]irow of the underlying matrix to be nullified.
[in]jcolumn of the underlying matrix to be nullified.

Definition at line 142 of file HeterogeneousMatrixCollection.cxx.

◆ operator()()

double Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::operator() ( int  i,
int  j 
) const
inherited

Access operator.

Returns the value of element (i, j).

Parameters
[in]irow index.
[in]jcolumn index.
Returns
Element (i, j) of the matrix.

Definition at line 764 of file HeterogeneousMatrixCollection.cxx.

◆ Print()

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::Print
inherited

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.

◆ Read() [1/2]

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::Read ( istream &  FileStream)
inherited

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).

Parameters
[in,out]FileStreaminput stream.

Definition at line 1199 of file HeterogeneousMatrixCollection.cxx.

◆ Read() [2/2]

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::Read ( string  FileName)
inherited

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).

Parameters
[in]FileNameinput file name.

Definition at line 1169 of file HeterogeneousMatrixCollection.cxx.

◆ Reallocate()

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::Reallocate ( int  i,
int  j 
)
inherited

Reallocates memory to resize the matrix collection.

On exit, the matrix is a matrix collection with i x j underlying matrices.

Parameters
[in]inumber of rows of matrices.
[in]jnumber of columns of matrices.
Warning
Depending on your allocator, data may be lost.

Definition at line 211 of file HeterogeneousMatrixCollection.cxx.

◆ Write() [1/2]

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::Write ( ostream &  FileStream,
bool  with_size = true 
) const
inherited

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).

Parameters
[in,out]FileStreamoutput stream.
[in]with_sizeif set to 'false', the dimensions of the matrix are not saved.

Definition at line 980 of file HeterogeneousMatrixCollection.cxx.

◆ Write() [2/2]

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::Write ( string  FileName,
bool  with_size 
) const
inherited

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).

Parameters
[in]FileNameoutput file name.
[in]with_sizeif set to 'false', the dimensions of the matrix are not saved.

Definition at line 949 of file HeterogeneousMatrixCollection.cxx.

◆ WriteText() [1/2]

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::WriteText ( ostream &  FileStream) const
inherited

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.

Parameters
[in,out]FileStreamoutput stream.

Definition at line 1095 of file HeterogeneousMatrixCollection.cxx.

◆ WriteText() [2/2]

void Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::WriteText ( string  FileName) const
inherited

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.

Parameters
[in]FileNameoutput file name.

Definition at line 1063 of file HeterogeneousMatrixCollection.cxx.

Member Data Documentation

◆ collection_

Matrix<int, General, RowMajor> Seldon::HeterogeneousMatrixCollection< General , RowMajor , General , RowSparse , Allocator >::collection_
protectedinherited

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.


The documentation for this class was generated from the following files: