Main Page | User's Guide | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

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

Symmetric sparse-matrix class. More...

#include <Matrix_SymSparse.hxx>

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

Seldon::Matrix_Base< T, Allocator > List of all members.

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

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 ()
 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)
 Redefines the matrix.
int GetNonZeros () const
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.
void Print () const
 Displays the matrix on the standard output.
void SetDiags ()

Protected Attributes

int nz_
int * ptr_
int * ind_

Detailed Description

template<class T, class Prop, class Storage, class Allocator = SELDON_DEFAULT_ALLOCATOR<T>>
class Seldon::Matrix_SymSparse< T, Prop, Storage, 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.

Only values of the upper part are stored.


Constructor & Destructor Documentation

template<class T, class Prop, class Storage, class Allocator>
Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Matrix_SymSparse  )  [inline]
 

Default constructor.

Builds a empty matrix.

template<class T, class Prop, class Storage, class Allocator>
Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Matrix_SymSparse int  i,
int  j
[inline]
 

Constructor.

Builds an empty i by j sparse matrix.

Parameters:
i number of rows.
j number of columns.
Note:
'j' is assumed to be equal to 'i' and is therefore discarded.

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

Parameters:
i number of rows.
j number of columns.
nz number of non-zero elements that are stored.
Note:
Matrix values are not initialized. Indices of non-zero entries are not initialized either.

'j' is assumed to be equal to 'i' and is therefore discarded.

template<class T, class Prop, class Storage, class Allocator>
template<class Storage0, class Allocator0, class Storage1, class Allocator1, class Storage2, class Allocator2>
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.

Parameters:
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.
Warning:
Input vectors 'values', 'ptr' and 'ind' are empty on exit. Moreover 'j' is assumed to be equal to i so that 'j' is discarded.


Member Function Documentation

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

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

Returns the number of elements stored in memory.

Returns:
The number of elements stored in memory (the number of non-zero elements).

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

Returns:
The array of (row or column) indices of non-zero entries.

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

Returns:
The length of the array of (column or row) indices.
Note:
The length of the array of (column or row) indices is the number of non-zero entries that are stored.

template<class T, class Prop, class Storage, class Allocator>
int * Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetPtr  )  const
 

Returns (row or column) start indices.

Returns the array ('ptr_') of start indices.

Returns:
The array of start indices.

template<class T, class Prop, class Storage, class Allocator>
int Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetPtrSize  )  const
 

Returns the length of the array of start indices.

Returns:
The length of the array of start indices.

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

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

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

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

Parameters:
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.
Warning:
On exit, arrays 'values', 'ptr' and 'ind' are managed by the matrix. For example, it means that the destructor will released those arrays; therefore, the user mustn't release those arrays. Moreover 'j' is assumed to be equal to 'i' so that 'j' is discarded.

template<class T, class Prop, class Storage, class Allocator>
template<class Storage0, class Allocator0, class Storage1, class Allocator1, class Storage2, class Allocator2>
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.

Parameters:
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.
Warning:
Input vectors 'values', 'ptr' and 'ind' are empty on exit. Moreover 'j' is assumed to be equal to 'i' so that 'j' is discarded.


The documentation for this class was generated from the following files:
Generated on Sun Jan 16 23:38:02 2005 for Multivac by  doxygen 1.4.0