Symmetric sparse-matrix class. More...
#include <Matrix_SymSparse.hxx>
Public Types | |
typedef Allocator::value_type | value_type |
typedef Allocator::pointer | pointer |
typedef Allocator::const_pointer | const_pointer |
typedef Allocator::reference | reference |
typedef Allocator::const_reference | const_reference |
typedef Allocator::value_type | entry_type |
typedef Allocator::value_type | access_type |
typedef Allocator::value_type | const_access_type |
Public Member Functions | |
Matrix_SymSparse () | |
Default constructor. | |
Matrix_SymSparse (int i, int j) | |
Constructor. | |
Matrix_SymSparse (int i, int j, int nz) | |
Constructor. | |
template<class Storage0 , class Allocator0 , class Storage1 , class Allocator1 , class Storage2 , class Allocator2 > | |
Matrix_SymSparse (int i, int j, Vector< T, Storage0, Allocator0 > &values, Vector< int, Storage1, Allocator1 > &ptr, Vector< int, Storage2, Allocator2 > &ind) | |
Constructor. | |
Matrix_SymSparse (const Matrix_SymSparse< T, Prop, Storage, Allocator > &A) | |
Copy constructor. | |
~Matrix_SymSparse () | |
Destructor. | |
void | Clear () |
Clears the matrix. | |
template<class Storage0 , class Allocator0 , class Storage1 , class Allocator1 , class Storage2 , class Allocator2 > | |
void | SetData (int i, int j, Vector< T, Storage0, Allocator0 > &values, Vector< int, Storage1, Allocator1 > &ptr, Vector< int, Storage2, Allocator2 > &ind) |
Redefines the matrix. | |
void | SetData (int i, int j, int nz, pointer values, int *ptr, int *ind) |
void | Nullify () |
Clears the matrix without releasing memory. | |
void | Copy (const Matrix_SymSparse< T, Prop, Storage, Allocator > &A) |
Copies a matrix. | |
int | GetNonZeros () const |
Returns the number of elements stored in memory. | |
int | GetDataSize () const |
Returns the number of elements stored in memory. | |
int * | GetPtr () const |
Returns (row or column) start indices. | |
int * | GetInd () const |
Returns (row or column) indices of non-zero entries. | |
int | GetPtrSize () const |
Returns the length of the array of start indices. | |
int | GetIndSize () const |
Returns the length of the array of (column or row) indices. | |
value_type | operator() (int i, int j) const |
Access operator. | |
value_type & | Val (int i, int j) |
Access method. | |
const value_type & | Val (int i, int j) const |
Access method. | |
Matrix_SymSparse< T, Prop, Storage, Allocator > & | operator= (const Matrix_SymSparse< T, Prop, Storage, Allocator > &A) |
Duplicates a matrix (assignment operator). | |
void | Print () const |
Displays the matrix on the standard output. | |
void | WriteText (string FileName) const |
Writes the matrix in a file. | |
void | WriteText (ostream &FileStream) const |
Writes the matrix to an output stream. | |
template<class T , class Prop , class Storage , class Allocator > | |
void | SetData (int i, int j, int nz, typename Matrix_SymSparse< T, Prop, Storage, Allocator >::pointer values, int *ptr, int *ind) |
Redefines the matrix. | |
int | GetM () const |
Returns the number of rows. | |
int | GetM (const Seldon::SeldonTranspose &status) const |
Returns the number of rows of the matrix possibly transposed. | |
int | GetN () const |
Returns the number of columns. | |
int | GetN (const Seldon::SeldonTranspose &status) const |
Returns the number of columns of the matrix possibly transposed. | |
int | GetSize () const |
Returns the number of elements in the matrix. | |
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_ |
int * | ptr_ |
int * | ind_ |
int | m_ |
int | n_ |
pointer | data_ |
Static Protected Attributes | |
static Allocator | allocator_ |
Symmetric sparse-matrix class.
Symmetric sparse matrices are defined by: (1) the number of rows and columns; (2) the number of non-zero entries; (3) an array 'ptr_' of start indices (i.e. indices of the first element of each row or column, depending on the storage); (4) an array 'ind_' of column or row indices of each non-zero entry; (5) values of non-zero entries.
Definition at line 45 of file Matrix_SymSparse.hxx.
Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Matrix_SymSparse | ( | ) | [inline] |
Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Matrix_SymSparse | ( | int | i, | |
int | j | |||
) | [inline] |
Constructor.
Builds a i by j sparse matrix.
i | number of rows. | |
j | number of columns. |
Definition at line 55 of file Matrix_SymSparse.cxx.
Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Matrix_SymSparse | ( | int | i, | |
int | j, | |||
int | nz | |||
) | [inline] |
Constructor.
Builds a sparse matrix of size i x j , with nz non-zero (stored) elements.
i | number of rows. | |
j | number of columns. | |
nz | number of non-zero elements that are stored. |
Definition at line 75 of file Matrix_SymSparse.cxx.
Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Matrix_SymSparse | ( | int | i, | |
int | j, | |||
Vector< T, Storage0, Allocator0 > & | values, | |||
Vector< int, Storage1, Allocator1 > & | ptr, | |||
Vector< int, Storage2, Allocator2 > & | ind | |||
) | [inline] |
Constructor.
Builds a i by j sparse matrix with non-zero values and indices provided by 'values' (values), 'ptr' (pointers) and 'ind' (indices). Input vectors are released and are empty on exit.
i | number of rows. | |
j | number of columns. | |
values | values of non-zero entries. | |
ptr | row or column start indices. | |
ind | row or column indices. |
Definition at line 224 of file Matrix_SymSparse.cxx.
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Clear | ( | ) | [inline] |
Clears the matrix.
This methods is equivalent to the destructor. On exit, the matrix is empty (0x0).
Definition at line 388 of file Matrix_SymSparse.cxx.
Allocator & Seldon::Matrix_Base< T, Allocator >::GetAllocator | ( | ) | [inherited] |
Returns the allocator of the matrix.
Definition at line 257 of file Matrix_Base.cxx.
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_'.
Definition at line 207 of file Matrix_Base.cxx.
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_'.
Definition at line 220 of file Matrix_Base.cxx.
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_'.
Definition at line 246 of file Matrix_Base.cxx.
int Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetDataSize | ( | ) | const |
Returns the number of elements stored in memory.
Definition at line 714 of file Matrix_SymSparse.cxx.
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_'.
Definition at line 233 of file Matrix_Base.cxx.
int * Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetInd | ( | ) | const |
Returns (row or column) indices of non-zero entries.
Returns the array ('ind_') of (row or column) indices of non-zero entries. This array defines non-zero entries indices if coupled with (column or row) start indices.
Definition at line 741 of file Matrix_SymSparse.cxx.
int Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetIndSize | ( | ) | const |
Returns the length of the array of (column or row) indices.
Returns the length of the array ('ind_') of (row or column) indices of non-zero entries (that are stored). This array defines non-zero entries indices (that are stored) if coupled with (column or row) start indices.
Definition at line 769 of file Matrix_SymSparse.cxx.
int Seldon::Matrix_Base< T, Allocator >::GetM | ( | ) | const [inherited] |
Returns the number of rows.
Reimplemented in Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >, Seldon::MatrixCollection< T, Prop, Storage, Allocator >, Seldon::SubMatrix_Base< T, Prop, M, Allocator >, Seldon::HeterogeneousMatrixCollection< General, RowMajor, General, RowSparse, Allocator >, Seldon::MatrixCollection< T, Prop, RowMajor, Allocator >, Seldon::MatrixCollection< T, Prop, ColMajor, Allocator >, Seldon::MatrixCollection< T, Prop, ColSymPacked, Allocator >, and Seldon::MatrixCollection< T, Prop, RowSymPacked, Allocator >.
Definition at line 106 of file Matrix_Base.cxx.
int Seldon::Matrix_Base< T, Allocator >::GetM | ( | const Seldon::SeldonTranspose & | status | ) | const [inherited] |
Returns the number of rows of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Reimplemented in Seldon::SubMatrix_Base< T, Prop, M, Allocator >.
Definition at line 129 of file Matrix_Base.cxx.
int Seldon::Matrix_Base< T, Allocator >::GetN | ( | ) | const [inherited] |
Returns the number of columns.
Reimplemented in Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >, Seldon::MatrixCollection< T, Prop, Storage, Allocator >, Seldon::SubMatrix_Base< T, Prop, M, Allocator >, Seldon::HeterogeneousMatrixCollection< General, RowMajor, General, RowSparse, Allocator >, Seldon::MatrixCollection< T, Prop, RowMajor, Allocator >, Seldon::MatrixCollection< T, Prop, ColMajor, Allocator >, Seldon::MatrixCollection< T, Prop, ColSymPacked, Allocator >, and Seldon::MatrixCollection< T, Prop, RowSymPacked, Allocator >.
Definition at line 117 of file Matrix_Base.cxx.
int Seldon::Matrix_Base< T, Allocator >::GetN | ( | const Seldon::SeldonTranspose & | status | ) | const [inherited] |
Returns the number of columns of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Reimplemented in Seldon::SubMatrix_Base< T, Prop, M, Allocator >.
Definition at line 144 of file Matrix_Base.cxx.
int Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetNonZeros | ( | ) | const |
Returns the number of elements stored in memory.
Definition at line 702 of file Matrix_SymSparse.cxx.
int * Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetPtr | ( | ) | const |
Returns (row or column) start indices.
Returns the array ('ptr_') of start indices.
Definition at line 726 of file Matrix_SymSparse.cxx.
int Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetPtrSize | ( | ) | const |
Returns the length of the array of start indices.
Definition at line 752 of file Matrix_SymSparse.cxx.
int Seldon::Matrix_Base< T, Allocator >::GetSize | ( | ) | const [inherited] |
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.
Reimplemented in Seldon::HeterogeneousMatrixCollection< Prop0, Storage0, Prop1, Storage1, Allocator >, Seldon::MatrixCollection< T, Prop, Storage, Allocator >, Seldon::HeterogeneousMatrixCollection< General, RowMajor, General, RowSparse, Allocator >, Seldon::MatrixCollection< T, Prop, RowMajor, Allocator >, Seldon::MatrixCollection< T, Prop, ColMajor, Allocator >, Seldon::MatrixCollection< T, Prop, ColSymPacked, Allocator >, and Seldon::MatrixCollection< T, Prop, RowSymPacked, Allocator >.
Definition at line 194 of file Matrix_Base.cxx.
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Nullify | ( | ) | [inline] |
Clears the matrix without releasing memory.
On exit, the matrix is empty and the memory has not been released. It is useful for low level manipulations on a Matrix instance.
Definition at line 531 of file Matrix_SymSparse.cxx.
Matrix_SymSparse< T, Prop, Storage, Allocator >::value_type Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::operator() | ( | int | i, | |
int | j | |||
) | const [inline] |
Access operator.
Returns the value of element (i, j).
i | row index. | |
j | column index. |
Definition at line 789 of file Matrix_SymSparse.cxx.
Matrix_SymSparse< T, Prop, Storage, Allocator > & Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::operator= | ( | const Matrix_SymSparse< T, Prop, Storage, Allocator > & | A | ) | [inline] |
Duplicates a matrix (assignment operator).
A | matrix to be copied. |
Definition at line 960 of file Matrix_SymSparse.cxx.
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Print | ( | ) | const |
Displays the matrix on the standard output.
Displays elements on the standard output, in text format. Each row is displayed on a single line and elements of a row are delimited by tabulations.
Definition at line 980 of file Matrix_SymSparse.cxx.
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::SetData | ( | int | i, | |
int | j, | |||
Vector< T, Storage0, Allocator0 > & | values, | |||
Vector< int, Storage1, Allocator1 > & | ptr, | |||
Vector< int, Storage2, Allocator2 > & | ind | |||
) |
Redefines the matrix.
It clears the matrix and sets it to a new matrix defined by 'values' (values), 'ptr' (pointers) and 'ind' (indices). Input vectors are released and are empty on exit.
i | number of rows. | |
j | number of columns. | |
values | values of non-zero entries. | |
ptr | row or column start indices. | |
ind | row or column indices. |
Definition at line 416 of file Matrix_SymSparse.cxx.
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::SetData | ( | int | i, | |
int | j, | |||
int | nz, | |||
typename Matrix_SymSparse< T, Prop, Storage, Allocator >::pointer | values, | |||
int * | ptr, | |||
int * | ind | |||
) | [inline] |
Redefines the matrix.
It clears the matrix and sets it to a new matrix defined by arrays 'values' (values), 'ptr' (pointers) and 'ind' (indices).
i | number of rows. | |
j | number of columns. | |
nz | number of non-zero entries that are stored. | |
values | values of non-zero entries. | |
ptr | row or column start indices. | |
ind | row or column indices. |
Definition at line 506 of file Matrix_SymSparse.cxx.
Matrix_SymSparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Val | ( | int | i, | |
int | j | |||
) | [inline] |
Access method.
Returns the value of element (i, j) if it can be returned as a reference.
[in] | i | row index. |
[in] | j | column index. |
WrongArgument | No reference can be returned because the element is a zero entry (not stored in the matrix). |
Definition at line 843 of file Matrix_SymSparse.cxx.
const Matrix_SymSparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Val | ( | int | i, | |
int | j | |||
) | const [inline] |
Access method.
Returns the value of element (i, j) if it can be returned as a reference.
[in] | i | row index. |
[in] | j | column index. |
WrongArgument | No reference can be returned because the element is a zero entry (not stored in the matrix). |
Definition at line 903 of file Matrix_SymSparse.cxx.
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::WriteText | ( | ostream & | FileStream | ) | const |
Writes the matrix to an output stream.
Stores the matrix in a file in ascii format. The entries are written in coordinate format (row index, column index, value). Row and column indexes start at 1.
FileStream | output file name. |
Definition at line 1025 of file Matrix_SymSparse.cxx.
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::WriteText | ( | string | FileName | ) | const |
Writes the matrix in a file.
Stores the matrix in a file in ascii format. The entries are written in coordinate format (row index, column index, value). Row and column indexes start at 1.
FileName | output file name. |
Definition at line 999 of file Matrix_SymSparse.cxx.