Warning: this documentation for the development version is under construction.

Seldon::MatrixCollection< T, Prop, Storage, Allocator > Class Template Reference

Matrix class made of a collection of matrices. More...

#include <MatrixCollection.hxx>

Inheritance diagram for Seldon::MatrixCollection< T, Prop, Storage, Allocator >:
Seldon::Matrix_Base< T, Allocator >

List of all members.

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_typecollection_reference
typedef const collection_typeconst_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_

Detailed Description

template<class T, class Prop, class Storage, class Allocator = NewAlloc<T>>
class Seldon::MatrixCollection< T, Prop, Storage, Allocator >

Matrix class made of a collection of matrices.

Definition at line 37 of file MatrixCollection.hxx.


Constructor & Destructor Documentation

template<class T , class Prop , class Storage , class Allocator >
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.

template<class T , class Prop , class Storage , class Allocator >
Seldon::MatrixCollection< T, Prop, Storage, Allocator >::MatrixCollection ( 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 61 of file MatrixCollection.cxx.


Member Function Documentation

template<class T , class Prop , class Storage , class Allocator >
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Clear (  )  [inline]

Clears the matrix.

Destructs the matrix.

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

Definition at line 105 of file MatrixCollection.cxx.

template<class T, class Prop, class Storage, class Allocator>
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Copy ( const MatrixCollection< T, Prop, Storage, Allocator > &  A  )  [inline]

Duplicates a matrix collection.

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 557 of file MatrixCollection.cxx.

template<class T , class Allocator >
Allocator & Seldon::Matrix_Base< T, Allocator >::GetAllocator (  )  [inherited]

Returns the allocator of the matrix.

Returns:
The allocator.

Definition at line 258 of file Matrix_Base.cxx.

template<class T , class Allocator >
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_'.

Returns:
A pointer to the data array.

Definition at line 208 of file Matrix_Base.cxx.

template<class T , class Allocator >
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_'.

Returns:
A const pointer to the data array.

Definition at line 221 of file Matrix_Base.cxx.

template<class T , class Allocator >
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_'.

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

Definition at line 247 of file Matrix_Base.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetDataSize (  )  const

Returns the number of elements stored in memory.

Returns:
The number of elements stored in memory.

Definition at line 280 of file MatrixCollection.cxx.

template<class T , class Allocator >
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_'.

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

Definition at line 234 of file Matrix_Base.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetM (  )  const

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< T, Allocator >.

Definition at line 181 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetM ( int  i  )  const

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 205 of file MatrixCollection.cxx.

template<class T , class Allocator >
int Seldon::Matrix_Base< T, Allocator >::GetM ( const Seldon::SeldonTranspose status  )  const [inherited]

Returns the number of rows of the matrix possibly transposed.

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

Reimplemented in Seldon::SubMatrix_Base< T, Prop, M, Allocator >.

Definition at line 130 of file Matrix_Base.cxx.

template<class T , class Prop , class Storage , class Allocator >
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).

Parameters:
[in] i row index.
[in] j column index.
Returns:
The matrix collection (i, j).

Definition at line 472 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
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).

Parameters:
[in] i row index.
[in] j column index.
Returns:
The matrix collection (i, j).

Definition at line 443 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetMmatrix (  )  const

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 193 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetN (  )  const

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< T, Allocator >.

Definition at line 225 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetN ( int  j  )  const

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 250 of file MatrixCollection.cxx.

template<class T , class Allocator >
int Seldon::Matrix_Base< T, Allocator >::GetN ( const Seldon::SeldonTranspose status  )  const [inherited]

Returns the number of columns of the matrix possibly transposed.

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

Reimplemented in Seldon::SubMatrix_Base< T, Prop, M, Allocator >.

Definition at line 145 of file Matrix_Base.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetNmatrix (  )  const

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 237 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::MatrixCollection< T, Prop, Storage, Allocator >::GetSize (  )  const

Returns the number of elements stored in memory.

Returns:
The number of elements stored in memory.

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

Definition at line 269 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Nullify (  )  [inline]

Clears the matrix.

Destructs the matrix.

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

Definition at line 129 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::MatrixCollection< T, Prop, Storage, 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 152 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
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).

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

Definition at line 502 of file MatrixCollection.cxx.

template<class T, class Prop, class Storage, class Allocator>
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).

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 542 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
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.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::MatrixCollection< T, Prop, Storage, Allocator >::Print ( int  i,
int  j 
) const

Displays an underlying matrix on the standard output.

Parameters:
[in] m row index of the underlying matrix.
[in] n column index of the underlying matrix.

Definition at line 607 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
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).

Parameters:
[in,out] FileStream input stream.

Definition at line 801 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
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).

Parameters:
[in] FileName input file name.

Definition at line 774 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
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.

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 300 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
template<class T0 , class Prop0 , class Allocator0 >
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.

Parameters:
[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.

template<class T , class Prop , class Storage , class Allocator >
template<class T0 , class Prop0 , class Storage0 , class Allocator0 >
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.

Parameters:
[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.

template<class T , class Prop , class Storage , class Allocator >
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).

Parameters:
[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.

template<class T , class Prop , class Storage , class Allocator >
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).

Parameters:
[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.

template<class T , class Prop , class Storage , class Allocator >
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.

Parameters:
[in,out] FileStream output stream.

Definition at line 738 of file MatrixCollection.cxx.

template<class T , class Prop , class Storage , class Allocator >
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.

Parameters:
[in] FileName output file name.

Definition at line 709 of file MatrixCollection.cxx.


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