Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > Class Template Reference

Matrix class made of an heterogeneous collection of matrices. More...

#include <HeterogeneousMatrixCollection.hxx>

Inheritance diagram for Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >:
Seldon::Matrix_Base< double, Allocator< double > >

List of all members.

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.
 HeterogeneousMatrixCollection (int i, int j)
 Main constructor.
 HeterogeneousMatrixCollection (const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &A)
 Copy constructor.
 ~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.
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.
int GetType (int i, int j) const
 Returns the type of a given underlying matrix.
float_dense_cGetFloatDense ()
 Returns the collection of float dense underlying matrices.
const float_dense_cGetFloatDense () const
 Returns the collection of float dense underlying matrices.
float_sparse_cGetFloatSparse ()
 Returns the collection of float sparse underlying matrices.
const float_sparse_cGetFloatSparse () const
 Returns the collection of float sparse underlying matrices.
double_dense_cGetDoubleDense ()
 Returns the collection of double dense underlying matrices.
const double_dense_cGetDoubleDense () const
 Returns the collection of double dense underlying matrices.
double_sparse_cGetDoubleSparse ()
 Returns the collection of double sparse underlying matrices.
const double_sparse_cGetDoubleSparse () const
 Returns the collection of double sparse underlying matrices.
void Reallocate (int i, int j)
 Reallocates memory to resize the matrix collection.
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.
HeterogeneousMatrixCollection
< Prop0, Storage0, Prop1,
Storage1, Allocator > & 
operator= (const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &A)
 Duplicates a matrix collection (assignment operator).
void Copy (const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &A)
 Duplicates a matrix collection (assignment operator).
void Print () const
 Displays the matrix collection 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
int GetN (const Seldon::SeldonTranspose &status) const
pointer GetData () const
const_pointer GetDataConst () const
void * GetDataVoid () const
const void * GetDataConstVoid () const
Allocator< double > & GetAllocator ()

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.
Matrix< int, General, RowMajor,
CallocAlloc< int > > 
collection_
 Type of the underlying matrices.
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.
int m_
int n_
pointer data_

Static Protected Attributes

static Allocator< double > allocator_

Detailed Description

template<class Prop0, class Storage0, class Prop1, class Storage1, template< class U > class Allocator>
class Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >

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.


Constructor & Destructor Documentation

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::HeterogeneousMatrixCollection (  )  [inline]

Default constructor.

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

Definition at line 45 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::HeterogeneousMatrixCollection ( int  i,
int  j 
) [inline]

Main constructor.

Builds a i x j collection matrix.

Parameters:
[in] i number of rows of matrices.
[in] j number of columns of matrices.

Definition at line 68 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0, class Storage0, class Prop1, class Storage1, template< class U > class Allocator>
Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::HeterogeneousMatrixCollection ( const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &  A  )  [inline]

Copy constructor.

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

Definition at line 95 of file HeterogeneousMatrixCollection.cxx.


Member Function Documentation

template<class Prop0, class Storage0, class Prop1, class Storage1, template< class U > class Allocator>
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::Copy ( const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &  A  )  [inline]

Duplicates a matrix collection (assignment operator).

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

Definition at line 1188 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetDataSize (  )  const [inline]

Returns the number of elements stored in memory.

Returns:
The number of elements stored in memory.

Definition at line 362 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::double_dense_c & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetDoubleDense (  )  [inline]

Returns the collection of double dense underlying matrices.

Returns:
the collection of double dense underlying matrices.

Definition at line 476 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::double_dense_c & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetDoubleDense (  )  const [inline]

Returns the collection of double dense underlying matrices.

Returns:
the collection of double dense underlying matrices.

Definition at line 492 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::double_sparse_c & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetDoubleSparse (  )  [inline]

Returns the collection of double sparse underlying matrices.

Returns:
the collection of double sparse underlying matrices.

Definition at line 508 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::double_sparse_c & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetDoubleSparse (  )  const [inline]

Returns the collection of double sparse underlying matrices.

Returns:
the collection of double sparse underlying matrices.

Definition at line 524 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::float_dense_c & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetFloatDense (  )  [inline]

Returns the collection of float dense underlying matrices.

Returns:
the collection of float dense underlying matrices.

Definition at line 412 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::float_dense_c & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetFloatDense (  )  const [inline]

Returns the collection of float dense underlying matrices.

Returns:
the collection of float dense underlying matrices.

Definition at line 428 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::float_sparse_c & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetFloatSparse (  )  const [inline]

Returns the collection of float sparse underlying matrices.

Returns:
the collection of float sparse underlying matrices.

Definition at line 460 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::float_sparse_c & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetFloatSparse (  )  [inline]

Returns the collection of float sparse underlying matrices.

Returns:
the collection of float sparse underlying matrices.

Definition at line 444 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetM (  )  const [inline]

Returns the number of rows.

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

Reimplemented from Seldon::Matrix_Base< double, Allocator< double > >.

Definition at line 241 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetM ( int  i  )  const [inline]

Returns the number of rows in an underlying matrix.

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

Definition at line 271 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetMmatrix (  )  const [inline]

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 256 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetN ( int  j  )  const [inline]

Returns the number of columns in an underlying matrix.

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

Definition at line 325 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetN (  )  const [inline]

Returns the number of columns.

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

Reimplemented from Seldon::Matrix_Base< double, Allocator< double > >.

Definition at line 294 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetNmatrix (  )  const [inline]

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 309 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetSize (  )  const [inline]

Returns the number of elements stored in memory.

Returns:
The number of elements stored in memory.

Reimplemented from Seldon::Matrix_Base< double, Allocator< double > >.

Definition at line 347 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
int Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::GetType ( int  i,
int  j 
) const [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.

Parameters:
[in] i row of the given underlying matrix.
[in] j column of the given underlying matrix.
Returns:
The type of the underlying matrix.

Definition at line 383 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::Nullify ( int  i,
int  j 
) [inline]

Clears a given underlying matrix.

Parameters:
[in] i row of the underlying matrix to be nullified.
[in] j column of the underlying matrix to be nullified.

Definition at line 174 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
double Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::operator() ( int  i,
int  j 
) const [inline]

Access operator.

Returns the value of element (i, j).

Parameters:
[in] i row index.
[in] j column index.
Returns:
Element (i, j) of the matrix.

Definition at line 1100 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0, class Storage0, class Prop1, class Storage1, template< class U > class Allocator>
HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > & Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::operator= ( const HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator > &  A  )  [inline]

Duplicates a matrix collection (assignment operator).

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

Definition at line 1169 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::Print (  )  const

Displays the matrix collection on the standard output.

Displays elements on the standard output, in text format.

Definition at line 1263 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
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).

Parameters:
[in] FileName input file name.

Definition at line 1507 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
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).

Parameters:
[in,out] FileStream input stream.

Definition at line 1537 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
void Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, 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.

Parameters:
[in] i number of rows of matrices.
[in] j number of columns of matrices.
Warning:
Depending on your allocator, data may be lost.

Definition at line 546 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
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).

Parameters:
[in] FileName output file name.
[in] with_size if set to 'false', the dimensions of the matrix are not saved.

Definition at line 1287 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
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).

Parameters:
[in,out] FileStream output stream.
[in] with_size if set to 'false', the dimensions of the matrix are not saved.

Definition at line 1318 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
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.

Parameters:
[in,out] FileStream output stream.

Definition at line 1433 of file HeterogeneousMatrixCollection.cxx.

template<class Prop0 , class Storage0 , class Prop1 , class Storage1 , template< class U > class Allocator>
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.

Parameters:
[in] FileName output file name.

Definition at line 1401 of file HeterogeneousMatrixCollection.cxx.


Member Data Documentation

template<class Prop0, class Storage0, class Prop1, class Storage1, template< class U > class Allocator>
Matrix<int, General, RowMajor, CallocAlloc<int> > Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >::collection_ [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.


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