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

Sparse-matrix class. More...

#include <Matrix_Sparse.hxx>

Inheritance diagram for Seldon::Matrix_Sparse< 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
typedef value_type entry_type
typedef value_type access_type
typedef value_type const_access_type

Public Member Functions

 Matrix_Sparse ()
 Default constructor.
 Matrix_Sparse (int i, int j)
 Constructor.
 Matrix_Sparse (int i, int j, int nz)
 Constructor.
template<class Storage0 , class Allocator0 , class Storage1 , class Allocator1 , class Storage2 , class Allocator2 >
 Matrix_Sparse (int i, int j, Vector< T, Storage0, Allocator0 > &values, Vector< int, Storage1, Allocator1 > &ptr, Vector< int, Storage2, Allocator2 > &ind)
 Constructor.
 Matrix_Sparse (const Matrix_Sparse< T, Prop, Storage, Allocator > &A)
 Copy constructor.
 ~Matrix_Sparse ()
 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 Reallocate (int i, int j)
 Initialization of an empty sparse matrix with i rows and j columns.
void Reallocate (int i, int j, int nz)
 Initialization of a sparse matrix with i rows and j columns.
void Resize (int i, int j)
 Reallocates memory to resize the matrix and keeps previous entries.
void Resize (int i, int j, int nz)
 Reallocates memory to resize the matrix and keeps previous entries.
void Copy (const Matrix_Sparse< T, Prop, Storage, Allocator > &A)
 Copies a matrix.
int GetNonZeros () const
 Returns the number of non-zero elements.
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.
value_type & Get (int i, int j)
 Access method.
const value_type & Val (int i, int j) const
 Access method.
const value_type & Get (int i, int j) const
 Access method.
void AddInteraction (int i, int j, const T &val)
 Add a value to a non-zero entry.
void Set (int i, int j, const T &x)
 Sets an element (i, j) to a value.
Matrix_Sparse< T, Prop,
Storage, Allocator > & 
operator= (const Matrix_Sparse< T, Prop, Storage, Allocator > &A)
 Duplicates a matrix (assignment operator).
void Zero ()
 Resets all non-zero entries to 0-value.
void SetIdentity ()
 Sets the matrix to identity.
void Fill ()
 Fills the non-zero entries with 0, 1, 2, ...
template<class T0 >
void Fill (const T0 &x)
 Fills the non-zero entries with a given value.
void FillRand ()
 Fills the non-zero entries randomly.
void FillRand (int Nelement)
 Fills the matrix with random elements.
void FillRand (int Nelement, const T &x)
 Fills the matrix with one value inserted at random positions.
void Print () const
 Displays the matrix on the standard output.
void Write (string FileName) const
 Writes the matrix in a file.
void Write (ostream &FileStream) const
 Writes the matrix to an output stream.
void WriteText (string FileName) const
 Writes the matrix in a file.
void WriteText (ostream &FileStream) const
 Writes the matrix to an output stream.
void Read (string FileName)
 Reads the matrix from a file.
void Read (istream &FileStream)
 Reads the matrix from an input stream.
void ReadText (string FileName)
 Reads the matrix from a file.
void ReadText (istream &FileStream)
 Reads the matrix from an input stream.
template<class T , class Prop , class Storage , class Allocator >
void SetData (int i, int j, int nz, typename Matrix_Sparse< 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_

Detailed Description

template<class T, class Prop, class Storage, class Allocator = SELDON_DEFAULT_ALLOCATOR<T>>
class Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >

Sparse-matrix class.

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 44 of file Matrix_Sparse.hxx.


Constructor & Destructor Documentation

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

Default constructor.

Builds an empty 0x0 matrix.

Definition at line 39 of file Matrix_Sparse.cxx.

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

Constructor.

Builds a i by j sparse matrix.

Parameters:
i number of rows.
j number of columns.

Definition at line 55 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Matrix_Sparse ( int  i,
int  j,
int  nz 
) [inline]

Constructor.

Builds a sparse matrix of size i by j , with nz non-zero elements.

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

Definition at line 77 of file Matrix_Sparse.cxx.

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

Definition at line 105 of file Matrix_Sparse.cxx.


Member Function Documentation

template<class T, class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::AddInteraction ( int  i,
int  j,
const T &  val 
) [inline]

Add a value to a non-zero entry.

This function adds val to the element (i, j), provided that this element is already a non-zero entry. Otherwise a non-zero entry is inserted equal to val.

Parameters:
[in] i row index.
[in] j column index.
[in] val value to be added to the element (i, j).

Definition at line 1274 of file Matrix_Sparse.cxx.

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

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Fill (  ) 

Fills the non-zero entries with 0, 1, 2, ...

On exit, the non-zero entries are 0, 1, 2, 3, ... The order of the numbers depends on the storage.

Definition at line 1364 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
template<class T0 >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Fill ( const T0 &  x  ) 

Fills the non-zero entries with a given value.

Parameters:
x the value to set the non-zero entries to.

Definition at line 1377 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::FillRand (  ) 

Fills the non-zero entries randomly.

Note:
The random generator is very basic.

Definition at line 1389 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::FillRand ( int  Nelement  ) 

Fills the matrix with random elements.

The matrix is cleared and then filled with n random elements. Both the position of the elements and their values are randomly generated. On exit, the matrix may not have n non-zero elements: it is possible that the randomly-generated positions of two elements are the same.

Parameters:
[in] Nelement the number of random elements to be inserted in the matrix.
Note:
The random generator is very basic.

Definition at line 1408 of file Matrix_Sparse.cxx.

template<class T, class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::FillRand ( int  Nelement,
const T &  x 
)

Fills the matrix with one value inserted at random positions.

The matrix is cleared and then filled with n random elements. Only the position of the elements is randomly generated. Their value will always be x. On exit, the matrix may not have n non-zero elements: it is possible that the randomly-generated positions of two elements are the same.

Parameters:
[in] Nelement the number of random elements to be inserted in the matrix.
[in] x the value to be inserted.
Note:
The random generator is very basic.

Definition at line 1455 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
Matrix_Sparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Get ( int  i,
int  j 
) [inline]

Access method.

Returns reference to element (i, j)

Parameters:
[in] i row index.
[in] j column index.
Returns:
Element (i, j) of the matrix. If the element does not belong to sparsity pattern of the matrix, the matrix is resized.

Definition at line 1196 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
const Matrix_Sparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Get ( int  i,
int  j 
) const [inline]

Access method.

Returns reference to element (i, j)

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

Definition at line 1258 of file Matrix_Sparse.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::Matrix_Sparse< T, Prop, Storage, Allocator >::GetDataSize (  )  const

Returns the number of elements stored in memory.

Returns the number of elements stored in memory, i.e. the number of non-zero entries.

Returns:
The number of elements stored in memory.

Definition at line 975 of file Matrix_Sparse.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::Matrix_Sparse< 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.

Definition at line 1002 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
int Seldon::Matrix_Sparse< 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. This array defines non-zero entries indices 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.

Definition at line 1029 of file Matrix_Sparse.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 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::Matrix_Sparse< T, Prop, Storage, Allocator >::GetNonZeros (  )  const

Returns the number of non-zero elements.

Returns:
The number of non-zero elements.

Definition at line 962 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
int * Seldon::Matrix_Sparse< 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.

Definition at line 987 of file Matrix_Sparse.cxx.

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

Returns the length of the array of start indices.

Returns:
The length of the array of start indices.

Definition at line 1013 of file Matrix_Sparse.cxx.

template<class T , class Allocator >
int Seldon::Matrix_Base< T, Allocator >::GetSize (  )  const [inherited]
template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< 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 416 of file Matrix_Sparse.cxx.

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

Definition at line 1049 of file Matrix_Sparse.cxx.

template<class T, class Prop, class Storage, class Allocator>
Matrix_Sparse< T, Prop, Storage, Allocator > & Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::operator= ( const Matrix_Sparse< T, Prop, Storage, Allocator > &  A  )  [inline]

Duplicates a matrix (assignment operator).

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

Definition at line 1303 of file Matrix_Sparse.cxx.

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

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Read ( string  FileName  ) 

Reads the matrix from a file.

Reads a matrix stored in binary format in a file.

Parameters:
FileName input file name.

Definition at line 1621 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Read ( istream &  FileStream  ) 

Reads the matrix from an input stream.

Reads a matrix in binary format from an input stream.

Parameters:
FileStream input stream

Definition at line 1646 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::ReadText ( string  FileName  ) 

Reads the matrix from a file.

Reads the matrix from a file in text format.

Parameters:
FileName input file name.

Definition at line 1687 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::ReadText ( istream &  FileStream  ) 

Reads the matrix from an input stream.

Reads a matrix from a stream in text format.

Parameters:
FileStream input stream.

Definition at line 1712 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Reallocate ( int  i,
int  j 
)

Initialization of an empty sparse matrix with i rows and j columns.

Parameters:
i number of rows
j number of columns

Definition at line 433 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Reallocate ( int  i,
int  j,
int  nz 
)

Initialization of a sparse matrix with i rows and j columns.

Parameters:
i number of rows
j number of columns
nz number of non-zero entries

Definition at line 492 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Resize ( int  i,
int  j,
int  nz 
)

Reallocates memory to resize the matrix and keeps previous entries.

On exit, the matrix is a i x j matrix.

Parameters:
i new number of rows.
j new number of columns.
nz number of non-zero elements.

Definition at line 666 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Resize ( int  i,
int  j 
)

Reallocates memory to resize the matrix and keeps previous entries.

On exit, the matrix is a i x j matrix.

Parameters:
i new number of rows.
j new number of columns.

Definition at line 648 of file Matrix_Sparse.cxx.

template<class T, class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Set ( int  i,
int  j,
const T &  val 
) [inline]

Sets an element (i, j) to a value.

This function sets val to the element (i, j)

Parameters:
[in] i row index.
[in] j column index.
[in] val A(i, j) = val

Definition at line 1288 of file Matrix_Sparse.cxx.

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_Sparse< 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.

Definition at line 300 of file Matrix_Sparse.cxx.

template<class T, class Prop, class Storage, class Allocator = SELDON_DEFAULT_ALLOCATOR<T>>
template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::SetData ( int  i,
int  j,
int  nz,
typename Matrix_Sparse< 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.
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.

Definition at line 392 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::SetIdentity (  ) 

Sets the matrix to identity.

This method fills the diagonal of the matrix with ones. It can be applied to non square matrix.

Definition at line 1331 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
Matrix_Sparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_Sparse< 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.

Parameters:
[in] i row index.
[in] j column index.
Returns:
Element (i, j) of the matrix.
Exceptions:
WrongArgument No reference can be returned because the element is a zero entry (not stored in the matrix).

Definition at line 1094 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
const Matrix_Sparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_Sparse< 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.

Parameters:
[in] i row index.
[in] j column index.
Returns:
Element (i, j) of the matrix.
Exceptions:
WrongArgument No reference can be returned because the element is a zero entry (not stored in the matrix).

Definition at line 1146 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Write ( ostream &  FileStream  )  const

Writes the matrix to an output stream.

Stores the matrix in an output stream in binary format.

Parameters:
FileStream output stream.

Definition at line 1529 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Write ( string  FileName  )  const

Writes the matrix in a file.

Stores the matrix in a file in binary format.

Parameters:
FileName output file name.

Definition at line 1504 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< 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 column value) 1-index convention is used

Parameters:
FileName output file name.

Definition at line 1563 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< 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 column value) 1-index convention is used

Parameters:
FileStream output stream.

Definition at line 1590 of file Matrix_Sparse.cxx.

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_Sparse< T, Prop, Storage, Allocator >::Zero (  ) 

Resets all non-zero entries to 0-value.

The sparsity pattern remains unchanged.

Definition at line 1319 of file Matrix_Sparse.cxx.


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