Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
Seldon::Matrix< T, Prop, ColMajorCollection, Allocator > Class Template Reference

Column-major matrix collection class. More...

#include <MatrixCollection.hxx>

Inheritance diagram for Seldon::Matrix< T, Prop, ColMajorCollection, Allocator >:
Seldon::MatrixCollection< T, Prop, ColMajor, Allocator > Seldon::Matrix_Base< T, Allocator > Seldon::VirtualMatrix< T >

Public Types

typedef T value_type
 
typedef Prop property
 
typedef ColMajorCollection storage
 
typedef Allocator allocator
 
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, ColMajor, NewAlloc< T > > collection_type
 
typedef collection_typecollection_reference
 

Public Member Functions

 Matrix ()
 Default constructor. More...
 
 Matrix (int i, int j)
 Main constructor. More...
 
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 GetM (int i) const
 Returns the number of rows in an underlying matrix. 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 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
 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...
 
int GetNmatrix () const
 Returns the number of columns. More...
 
int GetSize () const
 Returns the number of elements stored in memory. More...
 
long GetSize () const
 Returns the number of elements in the matrix. 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...
 
void SetMatrix (int m, int n, const Matrix< T0, Prop0, Storage0, Allocator0 > &)
 Sets an underlying matrix in the matrix collection. More...
 
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...
 
void Copy (const MatrixCollection< T, Prop, ColMajor, 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...
 

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_typeconst_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_
 

Detailed Description

template<class T, class Prop, class Allocator>
class Seldon::Matrix< T, Prop, ColMajorCollection, Allocator >

Column-major matrix collection class.

Definition at line 144 of file MatrixCollection.hxx.

Constructor & Destructor Documentation

◆ Matrix() [1/2]

template<class T , class Prop , class Allocator >
Seldon::Matrix< T, Prop, ColMajorCollection, Allocator >::Matrix
inline

Default constructor.

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

Definition at line 262 of file MatrixCollectionInline.cxx.

◆ Matrix() [2/2]

template<class T , class Prop , class Allocator >
Seldon::Matrix< T, Prop, ColMajorCollection, Allocator >::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 274 of file MatrixCollectionInline.cxx.

Member Function Documentation

◆ Clear()

void Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::Clear
inherited

Clears the matrix.

Destructs the matrix.

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

Definition at line 85 of file MatrixCollection.cxx.

◆ Copy()

void Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::Copy ( const MatrixCollection< T, Prop, ColMajor , Allocator > &  A)
inherited

Duplicates a matrix collection.

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

◆ GetData()

template<class T , class Allocator >
Matrix_Base< T, Allocator >::pointer Seldon::Matrix_Base< T, Allocator >::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()

template<class T , class Allocator >
Matrix_Base< T, Allocator >::const_pointer Seldon::Matrix_Base< T, Allocator >::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()

template<class T , class Allocator >
const void * Seldon::Matrix_Base< T, Allocator >::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::MatrixCollection< T, Prop, ColMajor , Allocator >::GetDataSize
inlineinherited

Returns the number of elements stored in memory.

Returns
The number of elements stored in memory.

Definition at line 168 of file MatrixCollectionInline.cxx.

◆ GetDataVoid()

template<class T , class Allocator >
void * Seldon::Matrix_Base< T, Allocator >::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.

◆ GetM() [1/5]

template<class T >
int Seldon::VirtualMatrix< T >::GetM
inlineinherited

Returns the number of rows.

Returns
The number of rows.

Definition at line 69 of file Matrix_BaseInline.cxx.

◆ GetM() [2/5]

int Seldon::MatrixCollection< T, Prop, ColMajor , 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 69 of file MatrixCollectionInline.cxx.

◆ GetM() [3/5]

template<class T >
int Seldon::VirtualMatrix< T >::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() [4/5]

template<class T >
int Seldon::VirtualMatrix< T >::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() [5/5]

int Seldon::MatrixCollection< T, Prop, ColMajor , 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 93 of file MatrixCollectionInline.cxx.

◆ GetMatrix() [1/2]

MatrixCollection< T, Prop, ColMajor , Allocator >::matrix_reference Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::GetMatrix ( int  i,
int  j 
)
inlineinherited

Access to an underlying matrix.

Returns the underlying matrix (i, j).

Parameters
[in]irow index.
[in]jcolumn index.
Returns
The matrix collection (i, j).

Definition at line 198 of file MatrixCollectionInline.cxx.

◆ GetMatrix() [2/2]

MatrixCollection< T, Prop, ColMajor , Allocator >::const_matrix_reference Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::GetMatrix ( int  i,
int  j 
) const
inlineinherited

Access to an underlying matrix.

Returns the underlying matrix (i, j).

Parameters
[in]irow index.
[in]jcolumn index.
Returns
The matrix collection (i, j).

Definition at line 227 of file MatrixCollectionInline.cxx.

◆ GetMmatrix()

int Seldon::MatrixCollection< T, Prop, ColMajor , 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 81 of file MatrixCollectionInline.cxx.

◆ GetN() [1/5]

template<class T >
int Seldon::VirtualMatrix< T >::GetN
inlineinherited

Returns the number of columns.

Returns
The number of columns.

Definition at line 80 of file Matrix_BaseInline.cxx.

◆ GetN() [2/5]

int Seldon::MatrixCollection< T, Prop, ColMajor , 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 113 of file MatrixCollectionInline.cxx.

◆ GetN() [3/5]

template<class T >
int Seldon::VirtualMatrix< T >::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() [4/5]

template<class T >
int Seldon::VirtualMatrix< T >::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() [5/5]

int Seldon::MatrixCollection< T, Prop, ColMajor , 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 138 of file MatrixCollectionInline.cxx.

◆ GetNmatrix()

int Seldon::MatrixCollection< T, Prop, ColMajor , 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 125 of file MatrixCollectionInline.cxx.

◆ GetSize() [1/2]

template<class T >
long Seldon::VirtualMatrix< T >::GetSize
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.

Returns
The number of elements in the matrix.

Definition at line 153 of file Matrix_BaseInline.cxx.

◆ GetSize() [2/2]

int Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::GetSize
inlineinherited

Returns the number of elements stored in memory.

Returns
The number of elements stored in memory.

Definition at line 157 of file MatrixCollectionInline.cxx.

◆ Nullify() [1/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::Nullify
inherited

Clears the matrix.

Destructs the matrix.

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

Definition at line 109 of file MatrixCollection.cxx.

◆ Nullify() [2/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , 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 132 of file MatrixCollection.cxx.

◆ operator()()

MatrixCollection< T, Prop, ColMajor , Allocator >::value_type Seldon::MatrixCollection< T, Prop, ColMajor , 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 303 of file MatrixCollection.cxx.

◆ Print() [1/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::Print
inherited

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.

◆ Print() [2/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::Print ( int  i,
int  j 
) const
inherited

Displays an underlying matrix on the standard output.

Parameters
[in]mrow index of the underlying matrix.
[in]ncolumn index of the underlying matrix.

Definition at line 408 of file MatrixCollection.cxx.

◆ Read() [1/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , 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 602 of file MatrixCollection.cxx.

◆ Read() [2/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , 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 575 of file MatrixCollection.cxx.

◆ Reallocate()

void Seldon::MatrixCollection< T, Prop, ColMajor , 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 164 of file MatrixCollection.cxx.

◆ SetMatrix() [1/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::SetMatrix ( int  i,
int  j,
const Matrix< T0, Prop0, RowSparse, Allocator0 > &  A 
)
inherited

Sets an underlying matrix in the matrix collection.

Parameters
[in]irow of the underlying matrix to be set.
[in]jcolumn of the underlying matrix to be set.
[in]matrixnew value for the underlying matrix.

Definition at line 245 of file MatrixCollection.cxx.

◆ SetMatrix() [2/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , Allocator >::SetMatrix ( int  i,
int  j,
const Matrix< T0, Prop0, Storage0, Allocator0 > &  A 
)
inherited

Sets an underlying matrix in the matrix collection.

Parameters
[in]irow of the underlying matrix to be set.
[in]jcolumn of the underlying matrix to be set.
[in]matrixnew value for the underlying matrix.

Definition at line 190 of file MatrixCollection.cxx.

◆ Write() [1/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , 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 467 of file MatrixCollection.cxx.

◆ Write() [2/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , 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 438 of file MatrixCollection.cxx.

◆ WriteText() [1/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , 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 539 of file MatrixCollection.cxx.

◆ WriteText() [2/2]

void Seldon::MatrixCollection< T, Prop, ColMajor , 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 510 of file MatrixCollection.cxx.


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