Public Types | Public Member Functions | Protected Attributes | List of all 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, typename SeldonDefaultAllocator< Storage, T >::allocator > Seldon::VirtualMatrix< T >

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
 
typedef SeldonDefaultAllocator< VectFull, int >::allocator AllocatorInt
 
typedef SeldonDefaultAllocator< VectFull, long >::allocator AllocatorLong
 

Public Member Functions

 Matrix_SymSparse ()
 Default constructor. More...
 
 Matrix_SymSparse (int i, int j)
 Constructor. More...
 
 Matrix_SymSparse (int i, int j, long nz)
 Constructor. More...
 
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< long, Storage1, Allocator1 > &ptr, Vector< int, Storage2, Allocator2 > &ind)
 Constructor. More...
 
 Matrix_SymSparse (const Matrix_SymSparse< T, Prop, Storage, Allocator > &A)
 Copy constructor.
 
 ~Matrix_SymSparse ()
 Destructor.
 
void Clear ()
 Clears the matrix. More...
 
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< long, Storage1, Allocator1 > &ptr, Vector< int, Storage2, Allocator2 > &ind)
 Redefines the matrix. More...
 
void SetData (int i, int j, long nz, pointer values, long *ptr, int *ind)
 
void Nullify ()
 Clears the matrix without releasing memory. More...
 
void Reallocate (int i, int j)
 Initialization of an empty sparse matrix with i rows and j columns. More...
 
void Reallocate (int i, int j, long nz)
 Initialization of a sparse matrix with i rows and j columns. More...
 
void Resize (int i, int j)
 Changing the number of rows and columns. More...
 
void Resize (int i, int j, long nz)
 Changing the number of rows, columns and non-zero entries. More...
 
void Copy (const Matrix_SymSparse< T, Prop, Storage, Allocator > &A)
 Copies a matrix.
 
long GetNonZeros () const
 Returns the number of elements stored in memory. More...
 
long GetDataSize () const
 Returns the number of elements stored in memory. More...
 
size_t GetMemorySize () const
 returns size of matrix in bytes
 
long * GetPtr () const
 Returns (row or column) start indices. More...
 
int * GetInd () const
 Returns (row or column) indices of non-zero entries. More...
 
int GetPtrSize () const
 Returns the length of the array of start indices. More...
 
long GetIndSize () const
 Returns the length of the array of (column or row) indices. More...
 
void FillPtrInt (Vector< int > &) const
 Fills vector ptr with integers instead of longs.
 
const value_type operator() (int i, int j) const
 Access operator. More...
 
value_type & Val (int i, int j)
 Access method. More...
 
value_type & Get (int i, int j)
 Access method. More...
 
const value_type & Val (int i, int j) const
 Access method. More...
 
const value_type & Get (int i, int j) const
 Access method. More...
 
void Set (int i, int j, const T &x)
 Sets an element (i, j) to a value. More...
 
void SetEntry (int i, int j, const T &x)
 Sets an element (i, j) to a value. More...
 
void AddInteraction (int i, int j, const T &x)
 Add a value to a non-zero entry. More...
 
void AddInteractionRow (int i, int nb, const Vector< int > &col, const Vector< T > &val, bool sorted)
 Adds values to several non-zero entries on a given row.
 
Matrix_SymSparse< T, Prop, Storage, Allocator > & operator= (const Matrix_SymSparse< T, Prop, Storage, Allocator > &A)
 Duplicates a matrix (assignment operator). More...
 
void Zero ()
 Resets all non-zero entries to 0-value. More...
 
void SetIdentity ()
 Sets the matrix to identity. More...
 
void Fill ()
 Fills the non-zero entries with 0, 1, 2, ... More...
 
template<class T0 >
void Fill (const T0 &x)
 Fills the non-zero entries with a given value. More...
 
void FillRand ()
 Fills the non-zero entries randomly. More...
 
void Print () const
 Displays the matrix on the standard output. More...
 
void Write (string FileName) const
 Writes the matrix in a file. More...
 
void Write (ostream &FileStream) const
 Writes the matrix to an output stream. More...
 
void WriteText (string FileName, bool cplx=false) const
 Writes the matrix in a file. More...
 
void WriteText (ostream &FileStream, bool cplx=false) const
 Writes the matrix to an output stream. More...
 
void Read (string FileName)
 Reads the matrix from a file. More...
 
void Read (istream &FileStream)
 Reads the matrix from an input stream. More...
 
void ReadText (string FileName, bool cplx=false)
 Reads the matrix from a file. More...
 
void ReadText (istream &FileStream, bool cplx=false)
 Reads the matrix from an input stream. More...
 
template<class T , class Prop , class Storage , class Allocator >
void SetData (int i, int j, long nz, typename Matrix_SymSparse< T, Prop, Storage, Allocator > ::pointer values, long *ptr, int *ind)
 Redefines the matrix. 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...
 
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 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...
 
long GetSize () const
 Returns the number of elements in the matrix. More...
 

Protected Attributes

long nz_
 
long * ptr_
 
int * ind_
 
pointer data_
 
int m_
 
int n_
 

Detailed Description

template<class T, class Prop, class Storage, class Allocator = typename SeldonDefaultAllocator<Storage, T>::allocator>
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.

Definition at line 46 of file Matrix_SymSparse.hxx.

Constructor & Destructor Documentation

◆ Matrix_SymSparse() [1/4]

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

Default constructor.

Builds an empty matrix.

Definition at line 39 of file Matrix_SymSparseInline.cxx.

◆ Matrix_SymSparse() [2/4]

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 a i by j sparse matrix.

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

Definition at line 57 of file Matrix_SymSparseInline.cxx.

◆ Matrix_SymSparse() [3/4]

template<class T , class Prop , class Storage , class Allocator >
Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Matrix_SymSparse ( int  i,
int  j,
long  nz 
)
inline

Constructor.

Builds a sparse matrix of size i x j , with nz non-zero (stored) elements.

Parameters
inumber of rows.
jnumber of columns.
nznumber 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.

Definition at line 79 of file Matrix_SymSparseInline.cxx.

◆ Matrix_SymSparse() [4/4]

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< long, Storage1, Allocator1 > &  ptr,
Vector< int, Storage2, Allocator2 > &  ind 
)

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
inumber of rows.
jnumber of columns.
valuesvalues of non-zero entries.
ptrrow or column start indices.
indrow 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.

Definition at line 52 of file Matrix_SymSparse.cxx.

Member Function Documentation

◆ AddInteraction()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< 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]irow index.
[in]jcolumn index.
[in]valvalue to be added to the element (i, j).

Definition at line 216 of file Matrix_SymSparseInline.cxx.

◆ Clear()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Clear

Clears the matrix.

This methods is equivalent to the destructor. On exit, the matrix is empty (0x0).

Definition at line 143 of file Matrix_SymSparse.cxx.

◆ Fill() [1/2]

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

◆ Fill() [2/2]

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

Fills the non-zero entries with a given value.

Parameters
xthe value to set the non-zero entries to.

Definition at line 1174 of file Matrix_SymSparse.cxx.

◆ FillRand()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::FillRand

Fills the non-zero entries randomly.

Note
The random generator is very basic.

Definition at line 1188 of file Matrix_SymSparse.cxx.

◆ Get() [1/2]

template<class T , class Prop , class Storage , class Allocator >
Matrix_SymSparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Get ( int  i,
int  j 
)

Access method.

Returns reference to element (i, j)

Parameters
[in]irow index.
[in]jcolumn 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 1053 of file Matrix_SymSparse.cxx.

◆ Get() [2/2]

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

Access method.

Returns reference to element (i, j)

Parameters
[in]irow index.
[in]jcolumn index.
Returns
Element (i, j) of the matrix.

Definition at line 200 of file Matrix_SymSparseInline.cxx.

◆ GetData()

Matrix_Base< T, typename SeldonDefaultAllocator< Storage, T >::allocator >::pointer Seldon::Matrix_Base< T, typename SeldonDefaultAllocator< Storage, 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()

Matrix_Base< T, typename SeldonDefaultAllocator< Storage, T >::allocator >::const_pointer Seldon::Matrix_Base< T, typename SeldonDefaultAllocator< Storage, 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()

const void * Seldon::Matrix_Base< T, typename SeldonDefaultAllocator< Storage, 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()

template<class T , class Prop , class Storage , class Allocator >
long Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetDataSize
inline

Returns the number of elements stored in memory.

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

Definition at line 126 of file Matrix_SymSparseInline.cxx.

◆ GetDataVoid()

void * Seldon::Matrix_Base< T, typename SeldonDefaultAllocator< Storage, 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.

◆ GetInd()

template<class T , class Prop , class Storage , class Allocator >
int * Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetInd
inline

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 153 of file Matrix_SymSparseInline.cxx.

◆ GetIndSize()

template<class T , class Prop , class Storage , class Allocator >
long Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetIndSize
inline

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.

Definition at line 181 of file Matrix_SymSparseInline.cxx.

◆ GetM() [1/3]

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/3]

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() [3/3]

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.

◆ GetN() [1/3]

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/3]

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() [3/3]

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.

◆ GetNonZeros()

template<class T , class Prop , class Storage , class Allocator >
long Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetNonZeros
inline

Returns the number of elements stored in memory.

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

Definition at line 114 of file Matrix_SymSparseInline.cxx.

◆ GetPtr()

template<class T , class Prop , class Storage , class Allocator >
long * Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::GetPtr
inline

Returns (row or column) start indices.

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

Returns
The array of start indices.

Definition at line 138 of file Matrix_SymSparseInline.cxx.

◆ GetPtrSize()

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

Returns the length of the array of start indices.

Returns
The length of the array of start indices.

Definition at line 164 of file Matrix_SymSparseInline.cxx.

◆ GetSize()

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.

◆ Nullify()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Nullify

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 339 of file Matrix_SymSparse.cxx.

◆ operator()()

template<class T , class Prop , class Storage , class Allocator >
const Matrix_SymSparse< T, Prop, Storage, Allocator >::value_type Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::operator() ( int  i,
int  j 
) const

Access operator.

Returns the value of element (i, j).

Parameters
irow index.
jcolumn index.
Returns
Element (i, j) of the matrix.

Definition at line 880 of file Matrix_SymSparse.cxx.

◆ operator=()

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

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

Definition at line 270 of file Matrix_SymSparseInline.cxx.

◆ Print()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Print

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 1205 of file Matrix_SymSparse.cxx.

◆ Read() [1/2]

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< 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
FileStreaminput stream

Definition at line 1367 of file Matrix_SymSparse.cxx.

◆ Read() [2/2]

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

Reads the matrix from a file.

Reads a matrix stored in binary format in a file.

Parameters
FileNameinput file name.

Definition at line 1342 of file Matrix_SymSparse.cxx.

◆ ReadText() [1/2]

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::ReadText ( istream &  FileStream,
bool  cplx = false 
)

Reads the matrix from an input stream.

Reads a matrix from a stream in text format.

Parameters
FileStreaminput stream.
cplxif true the real part and imaginary part are given in two separate columns, otherwise the complex values are written (a,b)

Definition at line 1439 of file Matrix_SymSparse.cxx.

◆ ReadText() [2/2]

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::ReadText ( string  FileName,
bool  cplx = false 
)

Reads the matrix from a file.

Reads the matrix from a file in text format.

Parameters
FileNameinput file name.
cplxif true the real part and imaginary part are given in two separate columns, otherwise the complex values are written (a,b)

Definition at line 1411 of file Matrix_SymSparse.cxx.

◆ Reallocate() [1/2]

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

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

Parameters
inumber of rows
jnumber of columns

Definition at line 356 of file Matrix_SymSparse.cxx.

◆ Reallocate() [2/2]

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

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

Parameters
inumber of rows
jnumber of columns
nznumber of non-zero entries

Definition at line 415 of file Matrix_SymSparse.cxx.

◆ Resize() [1/2]

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

Changing the number of rows and columns.

Parameters
inumber of rows
jnumber of columns

Definition at line 561 of file Matrix_SymSparse.cxx.

◆ Resize() [2/2]

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

Changing the number of rows, columns and non-zero entries.

Parameters
inumber of rows
jnumber of columns Previous entries are kept during the operation

Definition at line 578 of file Matrix_SymSparse.cxx.

◆ Set()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< 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]irow index.
[in]jcolumn index.
[in]valA(i, j) = val

Definition at line 241 of file Matrix_SymSparseInline.cxx.

◆ SetData() [1/2]

template<class T , class Prop , class Storage , class Allocator = typename SeldonDefaultAllocator<Storage, T>::allocator>
template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::SetData ( int  i,
int  j,
long  nz,
typename Matrix_SymSparse< T, Prop, Storage, Allocator > ::pointer  values,
long *  ptr,
int *  ind 
)

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
inumber of rows.
jnumber of columns.
nznumber of non-zero entries that are stored.
valuesvalues of non-zero entries.
ptrrow or column start indices.
indrow 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.

Definition at line 316 of file Matrix_SymSparse.cxx.

◆ SetData() [2/2]

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< long, 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
inumber of rows.
jnumber of columns.
valuesvalues of non-zero entries.
ptrrow or column start indices.
indrow 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.

Definition at line 226 of file Matrix_SymSparse.cxx.

◆ SetEntry()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::SetEntry ( 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]irow index.
[in]jcolumn index.
[in]valA(i, j) = val

Definition at line 255 of file Matrix_SymSparseInline.cxx.

◆ SetIdentity()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::SetIdentity

Sets the matrix to identity.

This method fills the diagonal of the matrix with ones.

Definition at line 1132 of file Matrix_SymSparse.cxx.

◆ Val() [1/2]

template<class T , class Prop , class Storage , class Allocator >
Matrix_SymSparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Val ( int  i,
int  j 
)

Access method.

Returns the value of element (i, j) if it can be returned as a reference.

Parameters
[in]irow index.
[in]jcolumn index.
Returns
Element (i, j) of the matrix.
Exceptions
WrongArgumentNo reference can be returned because the element is a zero entry (not stored in the matrix).

Definition at line 936 of file Matrix_SymSparse.cxx.

◆ Val() [2/2]

template<class T , class Prop , class Storage , class Allocator >
const Matrix_SymSparse< T, Prop, Storage, Allocator >::value_type & Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Val ( int  i,
int  j 
) const

Access method.

Returns the value of element (i, j) if it can be returned as a reference.

Parameters
[in]irow index.
[in]jcolumn index.
Returns
Element (i, j) of the matrix.
Exceptions
WrongArgumentNo reference can be returned because the element is a zero entry (not stored in the matrix).

Definition at line 995 of file Matrix_SymSparse.cxx.

◆ Write() [1/2]

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< 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
FileStreamoutput stream.

Definition at line 1248 of file Matrix_SymSparse.cxx.

◆ Write() [2/2]

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

Writes the matrix in a file.

Stores the matrix in a file in binary format.

Parameters
FileNameoutput file name.

Definition at line 1223 of file Matrix_SymSparse.cxx.

◆ WriteText() [1/2]

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::WriteText ( ostream &  FileStream,
bool  cplx = false 
) 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.

Parameters
FileStreamoutput file name.
cplxif true the real part and imaginary part are given in two separate columns, otherwise the complex values are written (a,b)

Definition at line 1316 of file Matrix_SymSparse.cxx.

◆ WriteText() [2/2]

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::WriteText ( string  FileName,
bool  cplx = false 
) 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.

Parameters
FileNameoutput file name.
cplxif true the real part and imaginary part are written in two separate columns, otherwise the complex values are written (a,b)

Definition at line 1284 of file Matrix_SymSparse.cxx.

◆ Zero()

template<class T , class Prop , class Storage , class Allocator >
void Seldon::Matrix_SymSparse< T, Prop, Storage, Allocator >::Zero

Resets all non-zero entries to 0-value.

The sparsity pattern remains unchanged.

Definition at line 1121 of file Matrix_SymSparse.cxx.


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