Jet  v1.3.3
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
jet::MatrixCsr< T > Class Template Reference

Compressed Sparse Row (CSR) matrix class. More...

#include <jet/matrix_csr.h>

Classes

struct  Element
 

Public Types

typedef std::vector< T > NonZeroContainerType
 
typedef NonZeroContainerType::iterator NonZeroIterator
 
typedef NonZeroContainerType::const_iterator ConstNonZeroIterator
 
typedef std::vector< size_t > IndexContainerType
 
typedef IndexContainerType::iterator IndexIterator
 
typedef IndexContainerType::const_iterator ConstIndexIterator
 

Public Member Functions

 MatrixCsr ()
 Constructs an empty matrix. More...
 
 MatrixCsr (const std::initializer_list< std::initializer_list< T >> &lst, T epsilon=std::numeric_limits< T >::epsilon())
 Compresses given initializer list lst into a sparse matrix. More...
 
template<typename E >
 MatrixCsr (const MatrixExpression< T, E > &other, T epsilon=std::numeric_limits< T >::epsilon())
 Compresses input (dense) matrix expression into a sparse matrix. More...
 
 MatrixCsr (const MatrixCsr &other)
 Copy constructor. More...
 
 MatrixCsr (MatrixCsr &&other)
 Move constructor. More...
 
void clear ()
 Clears the matrix and make it zero-dimensional. More...
 
void set (const T &s)
 Sets whole matrix with input scalar. More...
 
void set (const MatrixCsr &other)
 Copy from given sparse matrix. More...
 
void reserve (size_t rows, size_t cols, size_t numNonZeros)
 Reserves memory space of this matrix. More...
 
void compress (const std::initializer_list< std::initializer_list< T >> &lst, T epsilon=std::numeric_limits< T >::epsilon())
 Compresses given initializer list lst into a sparse matrix. More...
 
template<typename E >
void compress (const MatrixExpression< T, E > &other, T epsilon=std::numeric_limits< T >::epsilon())
 Compresses input (dense) matrix expression into a sparse matrix. More...
 
void addElement (size_t i, size_t j, const T &value)
 Adds non-zero element to (i, j). More...
 
void addElement (const Element &element)
 Adds non-zero element. More...
 
void addRow (const NonZeroContainerType &nonZeros, const IndexContainerType &columnIndices)
 
void setElement (size_t i, size_t j, const T &value)
 Sets non-zero element to (i, j). More...
 
void setElement (const Element &element)
 Sets non-zero element. More...
 
bool isEqual (const MatrixCsr &other) const
 
bool isSimilar (const MatrixCsr &other, double tol=std::numeric_limits< double >::epsilon()) const
 
bool isSquare () const
 Returns true if this matrix is a square matrix. More...
 
Size2 size () const
 Returns the size of this matrix. More...
 
size_t rows () const
 Returns number of rows of this matrix. More...
 
size_t cols () const
 Returns number of columns of this matrix. More...
 
size_t numberOfNonZeros () const
 Returns the number of non-zero elements. More...
 
const T & nonZero (size_t i) const
 Returns i-th non-zero element. More...
 
T & nonZero (size_t i)
 Returns i-th non-zero element. More...
 
const size_t & rowPointer (size_t i) const
 Returns i-th row pointer. More...
 
const size_t & columnIndex (size_t i) const
 Returns i-th column index. More...
 
T * nonZeroData ()
 Returns pointer of the non-zero elements data. More...
 
const T *const nonZeroData () const
 Returns constant pointer of the non-zero elements data. More...
 
const size_t *const rowPointersData () const
 Returns constant pointer of the row pointers data. More...
 
const size_t *const columnIndicesData () const
 Returns constant pointer of the column indices data. More...
 
NonZeroIterator nonZeroBegin ()
 Returns the begin iterator of the non-zero elements. More...
 
ConstNonZeroIterator nonZeroBegin () const
 Returns the begin const iterator of the non-zero elements. More...
 
NonZeroIterator nonZeroEnd ()
 Returns the end iterator of the non-zero elements. More...
 
ConstNonZeroIterator nonZeroEnd () const
 Returns the end const iterator of the non-zero elements. More...
 
IndexIterator rowPointersBegin ()
 Returns the begin iterator of the row pointers. More...
 
ConstIndexIterator rowPointersBegin () const
 Returns the begin const iterator of the row pointers. More...
 
IndexIterator rowPointersEnd ()
 Returns the end iterator of the row pointers. More...
 
ConstIndexIterator rowPointersEnd () const
 Returns the end const iterator of the row pointers. More...
 
IndexIterator columnIndicesBegin ()
 Returns the begin iterator of the column indices. More...
 
ConstIndexIterator columnIndicesBegin () const
 Returns the begin const iterator of the column indices. More...
 
IndexIterator columnIndicesEnd ()
 Returns the end iterator of the column indices. More...
 
ConstIndexIterator columnIndicesEnd () const
 Returns the end const iterator of the column indices. More...
 
MatrixCsr add (const T &s) const
 Returns this matrix + input scalar. More...
 
MatrixCsr add (const MatrixCsr &m) const
 Returns this matrix + input matrix (element-wise). More...
 
MatrixCsr sub (const T &s) const
 Returns this matrix - input scalar. More...
 
MatrixCsr sub (const MatrixCsr &m) const
 Returns this matrix - input matrix (element-wise). More...
 
MatrixCsr mul (const T &s) const
 Returns this matrix * input scalar. More...
 
template<typename VE >
MatrixCsrVectorMul< T, VE > mul (const VectorExpression< T, VE > &v) const
 Returns this matrix * input vector. More...
 
template<typename ME >
MatrixCsrMatrixMul< T, ME > mul (const MatrixExpression< T, ME > &m) const
 Returns this matrix * input matrix. More...
 
MatrixCsr div (const T &s) const
 Returns this matrix / input scalar. More...
 
MatrixCsr radd (const T &s) const
 Returns input scalar + this matrix. More...
 
MatrixCsr radd (const MatrixCsr &m) const
 Returns input matrix + this matrix (element-wise). More...
 
MatrixCsr rsub (const T &s) const
 Returns input scalar - this matrix. More...
 
MatrixCsr rsub (const MatrixCsr &m) const
 Returns input matrix - this matrix (element-wise). More...
 
MatrixCsr rmul (const T &s) const
 Returns input scalar * this matrix. More...
 
MatrixCsr rdiv (const T &s) const
 Returns input matrix / this scalar. More...
 
void iadd (const T &s)
 Adds input scalar to this matrix. More...
 
void iadd (const MatrixCsr &m)
 Adds input matrix to this matrix (element-wise). More...
 
void isub (const T &s)
 Subtracts input scalar from this matrix. More...
 
void isub (const MatrixCsr &m)
 Subtracts input matrix from this matrix (element-wise). More...
 
void imul (const T &s)
 Multiplies input scalar to this matrix. More...
 
template<typename ME >
void imul (const MatrixExpression< T, ME > &m)
 Multiplies input matrix to this matrix. More...
 
void idiv (const T &s)
 Divides this matrix with input scalar. More...
 
sum () const
 Returns sum of all elements. More...
 
avg () const
 Returns average of all elements. More...
 
min () const
 Returns minimum among all elements. More...
 
max () const
 Returns maximum among all elements. More...
 
absmin () const
 Returns absolute minimum among all elements. More...
 
absmax () const
 Returns absolute maximum among all elements. More...
 
trace () const
 
template<typename U >
MatrixCsr< U > castTo () const
 Type-casts to different value-typed matrix. More...
 
template<typename E >
MatrixCsroperator= (const E &m)
 Compresses input (dense) matrix expression into a sparse matrix. More...
 
MatrixCsroperator= (const MatrixCsr &other)
 Copies to this matrix. More...
 
MatrixCsroperator= (MatrixCsr &&other)
 Moves to this matrix. More...
 
MatrixCsroperator+= (const T &s)
 Addition assignment with input scalar. More...
 
MatrixCsroperator+= (const MatrixCsr &m)
 Addition assignment with input matrix (element-wise). More...
 
MatrixCsroperator-= (const T &s)
 Subtraction assignment with input scalar. More...
 
MatrixCsroperator-= (const MatrixCsr &m)
 Subtraction assignment with input matrix (element-wise). More...
 
MatrixCsroperator*= (const T &s)
 Multiplication assignment with input scalar. More...
 
template<typename ME >
MatrixCsroperator*= (const MatrixExpression< T, ME > &m)
 Multiplication assignment with input matrix. More...
 
MatrixCsroperator/= (const T &s)
 Division assignment with input scalar. More...
 
operator() (size_t i, size_t j) const
 Returns (i,j) element. More...
 
bool operator== (const MatrixCsr &m) const
 Returns true if is equal to m. More...
 
bool operator!= (const MatrixCsr &m) const
 Returns true if is not equal to m. More...
 

Static Public Member Functions

static MatrixCsr< T > makeIdentity (size_t m)
 

Detailed Description

template<typename T>
class jet::MatrixCsr< T >

Compressed Sparse Row (CSR) matrix class.

This class defines Compressed Sparse Row (CSR) matrix using arrays of non-zero elements, row pointers, and column indices.

See also
http://www.netlib.org/utk/people/JackDongarra/etemplates/node373.html
Template Parameters
TType of the element.

Member Typedef Documentation

◆ ConstIndexIterator

template<typename T >
typedef IndexContainerType::const_iterator jet::MatrixCsr< T >::ConstIndexIterator

◆ ConstNonZeroIterator

template<typename T >
typedef NonZeroContainerType::const_iterator jet::MatrixCsr< T >::ConstNonZeroIterator

◆ IndexContainerType

template<typename T >
typedef std::vector<size_t> jet::MatrixCsr< T >::IndexContainerType

◆ IndexIterator

template<typename T >
typedef IndexContainerType::iterator jet::MatrixCsr< T >::IndexIterator

◆ NonZeroContainerType

template<typename T >
typedef std::vector<T> jet::MatrixCsr< T >::NonZeroContainerType

◆ NonZeroIterator

template<typename T >
typedef NonZeroContainerType::iterator jet::MatrixCsr< T >::NonZeroIterator

Constructor & Destructor Documentation

◆ MatrixCsr() [1/5]

template<typename T >
jet::MatrixCsr< T >::MatrixCsr ( )

Constructs an empty matrix.

◆ MatrixCsr() [2/5]

template<typename T >
jet::MatrixCsr< T >::MatrixCsr ( const std::initializer_list< std::initializer_list< T >> &  lst,
epsilon = std::numeric_limits< T >::epsilon() 
)

Compresses given initializer list lst into a sparse matrix.

This constructor will build a matrix with given initializer list lst such as

MatrixCsr<float> mat = {
{1.f, 0.f, 0.f, 3.f},
{0.f, 3.f, 5.f, 1.f},
{4.f, 0.f, 1.f, 5.f}
};

Note the initializer has 4x3 structure which will create 4x3 matrix. During the process, zero elements (less than epsilon) will not be stored.

Parameters
lstInitializer list that should be copy to the new matrix.

◆ MatrixCsr() [3/5]

template<typename T >
template<typename E >
jet::MatrixCsr< T >::MatrixCsr ( const MatrixExpression< T, E > &  other,
epsilon = std::numeric_limits< T >::epsilon() 
)

Compresses input (dense) matrix expression into a sparse matrix.

This function sets this sparse matrix with dense input matrix. During the process, zero elements (less than epsilon) will not be stored.

◆ MatrixCsr() [4/5]

template<typename T >
jet::MatrixCsr< T >::MatrixCsr ( const MatrixCsr< T > &  other)

Copy constructor.

◆ MatrixCsr() [5/5]

template<typename T >
jet::MatrixCsr< T >::MatrixCsr ( MatrixCsr< T > &&  other)

Move constructor.

Member Function Documentation

◆ absmax()

template<typename T >
T jet::MatrixCsr< T >::absmax ( ) const

Returns absolute maximum among all elements.

◆ absmin()

template<typename T >
T jet::MatrixCsr< T >::absmin ( ) const

Returns absolute minimum among all elements.

◆ add() [1/2]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::add ( const MatrixCsr< T > &  m) const

Returns this matrix + input matrix (element-wise).

◆ add() [2/2]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::add ( const T &  s) const

Returns this matrix + input scalar.

◆ addElement() [1/2]

template<typename T >
void jet::MatrixCsr< T >::addElement ( const Element element)

Adds non-zero element.

◆ addElement() [2/2]

template<typename T >
void jet::MatrixCsr< T >::addElement ( size_t  i,
size_t  j,
const T &  value 
)

Adds non-zero element to (i, j).

◆ addRow()

template<typename T >
void jet::MatrixCsr< T >::addRow ( const NonZeroContainerType nonZeros,
const IndexContainerType columnIndices 
)

Adds a row to the sparse matrix.

Parameters
nonZeros- Array of non-zero elements for the row.
columnIndices- Array of column indices for the row.

◆ avg()

template<typename T >
T jet::MatrixCsr< T >::avg ( ) const

Returns average of all elements.

◆ castTo()

template<typename T >
template<typename U >
MatrixCsr<U> jet::MatrixCsr< T >::castTo ( ) const

Type-casts to different value-typed matrix.

◆ clear()

template<typename T >
void jet::MatrixCsr< T >::clear ( )

Clears the matrix and make it zero-dimensional.

◆ cols()

template<typename T >
size_t jet::MatrixCsr< T >::cols ( ) const

Returns number of columns of this matrix.

◆ columnIndex()

template<typename T >
const size_t& jet::MatrixCsr< T >::columnIndex ( size_t  i) const

Returns i-th column index.

◆ columnIndicesBegin() [1/2]

template<typename T >
IndexIterator jet::MatrixCsr< T >::columnIndicesBegin ( )

Returns the begin iterator of the column indices.

◆ columnIndicesBegin() [2/2]

template<typename T >
ConstIndexIterator jet::MatrixCsr< T >::columnIndicesBegin ( ) const

Returns the begin const iterator of the column indices.

◆ columnIndicesData()

template<typename T >
const size_t* const jet::MatrixCsr< T >::columnIndicesData ( ) const

Returns constant pointer of the column indices data.

◆ columnIndicesEnd() [1/2]

template<typename T >
IndexIterator jet::MatrixCsr< T >::columnIndicesEnd ( )

Returns the end iterator of the column indices.

◆ columnIndicesEnd() [2/2]

template<typename T >
ConstIndexIterator jet::MatrixCsr< T >::columnIndicesEnd ( ) const

Returns the end const iterator of the column indices.

◆ compress() [1/2]

template<typename T >
template<typename E >
void jet::MatrixCsr< T >::compress ( const MatrixExpression< T, E > &  other,
epsilon = std::numeric_limits< T >::epsilon() 
)

Compresses input (dense) matrix expression into a sparse matrix.

This function sets this sparse matrix with dense input matrix. During the process, zero elements (less than epsilon) will not be stored.

◆ compress() [2/2]

template<typename T >
void jet::MatrixCsr< T >::compress ( const std::initializer_list< std::initializer_list< T >> &  lst,
epsilon = std::numeric_limits< T >::epsilon() 
)

Compresses given initializer list lst into a sparse matrix.

This function will fill the matrix with given initializer list lst such as

MatrixCsr<float> mat;
mat.compress({
{1.f, 0.f, 0.f, 3.f},
{0.f, 3.f, 5.f, 1.f},
{4.f, 0.f, 1.f, 5.f}
});

Note the initializer has 4x3 structure which will resize to 4x3 matrix. During the process, zero elements (less than epsilon) will not be stored.

Parameters
lstInitializer list that should be copy to the new matrix.

◆ div()

template<typename T >
MatrixCsr jet::MatrixCsr< T >::div ( const T &  s) const

Returns this matrix / input scalar.

◆ iadd() [1/2]

template<typename T >
void jet::MatrixCsr< T >::iadd ( const MatrixCsr< T > &  m)

Adds input matrix to this matrix (element-wise).

◆ iadd() [2/2]

template<typename T >
void jet::MatrixCsr< T >::iadd ( const T &  s)

Adds input scalar to this matrix.

◆ idiv()

template<typename T >
void jet::MatrixCsr< T >::idiv ( const T &  s)

Divides this matrix with input scalar.

◆ imul() [1/2]

template<typename T >
template<typename ME >
void jet::MatrixCsr< T >::imul ( const MatrixExpression< T, ME > &  m)

Multiplies input matrix to this matrix.

◆ imul() [2/2]

template<typename T >
void jet::MatrixCsr< T >::imul ( const T &  s)

Multiplies input scalar to this matrix.

◆ isEqual()

template<typename T >
bool jet::MatrixCsr< T >::isEqual ( const MatrixCsr< T > &  other) const

◆ isSimilar()

template<typename T >
bool jet::MatrixCsr< T >::isSimilar ( const MatrixCsr< T > &  other,
double  tol = std::numeric_limits< double >::epsilon() 
) const

Returns true if this matrix is similar to the input matrix within the given tolerance.

◆ isSquare()

template<typename T >
bool jet::MatrixCsr< T >::isSquare ( ) const

Returns true if this matrix is a square matrix.

◆ isub() [1/2]

template<typename T >
void jet::MatrixCsr< T >::isub ( const MatrixCsr< T > &  m)

Subtracts input matrix from this matrix (element-wise).

◆ isub() [2/2]

template<typename T >
void jet::MatrixCsr< T >::isub ( const T &  s)

Subtracts input scalar from this matrix.

◆ makeIdentity()

template<typename T >
static MatrixCsr<T> jet::MatrixCsr< T >::makeIdentity ( size_t  m)
static

Makes a m x m matrix with all diagonal elements to 1, and other elements to 0.

◆ max()

template<typename T >
T jet::MatrixCsr< T >::max ( ) const

Returns maximum among all elements.

◆ min()

template<typename T >
T jet::MatrixCsr< T >::min ( ) const

Returns minimum among all elements.

◆ mul() [1/3]

template<typename T >
template<typename ME >
MatrixCsrMatrixMul<T, ME> jet::MatrixCsr< T >::mul ( const MatrixExpression< T, ME > &  m) const

Returns this matrix * input matrix.

◆ mul() [2/3]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::mul ( const T &  s) const

Returns this matrix * input scalar.

◆ mul() [3/3]

template<typename T >
template<typename VE >
MatrixCsrVectorMul<T, VE> jet::MatrixCsr< T >::mul ( const VectorExpression< T, VE > &  v) const

Returns this matrix * input vector.

◆ nonZero() [1/2]

template<typename T >
T& jet::MatrixCsr< T >::nonZero ( size_t  i)

Returns i-th non-zero element.

◆ nonZero() [2/2]

template<typename T >
const T& jet::MatrixCsr< T >::nonZero ( size_t  i) const

Returns i-th non-zero element.

◆ nonZeroBegin() [1/2]

template<typename T >
NonZeroIterator jet::MatrixCsr< T >::nonZeroBegin ( )

Returns the begin iterator of the non-zero elements.

◆ nonZeroBegin() [2/2]

template<typename T >
ConstNonZeroIterator jet::MatrixCsr< T >::nonZeroBegin ( ) const

Returns the begin const iterator of the non-zero elements.

◆ nonZeroData() [1/2]

template<typename T >
T* jet::MatrixCsr< T >::nonZeroData ( )

Returns pointer of the non-zero elements data.

◆ nonZeroData() [2/2]

template<typename T >
const T* const jet::MatrixCsr< T >::nonZeroData ( ) const

Returns constant pointer of the non-zero elements data.

◆ nonZeroEnd() [1/2]

template<typename T >
NonZeroIterator jet::MatrixCsr< T >::nonZeroEnd ( )

Returns the end iterator of the non-zero elements.

◆ nonZeroEnd() [2/2]

template<typename T >
ConstNonZeroIterator jet::MatrixCsr< T >::nonZeroEnd ( ) const

Returns the end const iterator of the non-zero elements.

◆ numberOfNonZeros()

template<typename T >
size_t jet::MatrixCsr< T >::numberOfNonZeros ( ) const

Returns the number of non-zero elements.

◆ operator!=()

template<typename T >
bool jet::MatrixCsr< T >::operator!= ( const MatrixCsr< T > &  m) const

Returns true if is not equal to m.

◆ operator()()

template<typename T >
T jet::MatrixCsr< T >::operator() ( size_t  i,
size_t  j 
) const

Returns (i,j) element.

◆ operator*=() [1/2]

template<typename T >
template<typename ME >
MatrixCsr& jet::MatrixCsr< T >::operator*= ( const MatrixExpression< T, ME > &  m)

Multiplication assignment with input matrix.

◆ operator*=() [2/2]

template<typename T >
MatrixCsr& jet::MatrixCsr< T >::operator*= ( const T &  s)

Multiplication assignment with input scalar.

◆ operator+=() [1/2]

template<typename T >
MatrixCsr& jet::MatrixCsr< T >::operator+= ( const MatrixCsr< T > &  m)

Addition assignment with input matrix (element-wise).

◆ operator+=() [2/2]

template<typename T >
MatrixCsr& jet::MatrixCsr< T >::operator+= ( const T &  s)

Addition assignment with input scalar.

◆ operator-=() [1/2]

template<typename T >
MatrixCsr& jet::MatrixCsr< T >::operator-= ( const MatrixCsr< T > &  m)

Subtraction assignment with input matrix (element-wise).

◆ operator-=() [2/2]

template<typename T >
MatrixCsr& jet::MatrixCsr< T >::operator-= ( const T &  s)

Subtraction assignment with input scalar.

◆ operator/=()

template<typename T >
MatrixCsr& jet::MatrixCsr< T >::operator/= ( const T &  s)

Division assignment with input scalar.

◆ operator=() [1/3]

template<typename T >
template<typename E >
MatrixCsr& jet::MatrixCsr< T >::operator= ( const E &  m)

Compresses input (dense) matrix expression into a sparse matrix.

This function sets this sparse matrix with dense input matrix. During the process, zero elements (less than epsilon) will not be stored.

◆ operator=() [2/3]

template<typename T >
MatrixCsr& jet::MatrixCsr< T >::operator= ( const MatrixCsr< T > &  other)

Copies to this matrix.

◆ operator=() [3/3]

template<typename T >
MatrixCsr& jet::MatrixCsr< T >::operator= ( MatrixCsr< T > &&  other)

Moves to this matrix.

◆ operator==()

template<typename T >
bool jet::MatrixCsr< T >::operator== ( const MatrixCsr< T > &  m) const

Returns true if is equal to m.

◆ radd() [1/2]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::radd ( const MatrixCsr< T > &  m) const

Returns input matrix + this matrix (element-wise).

◆ radd() [2/2]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::radd ( const T &  s) const

Returns input scalar + this matrix.

◆ rdiv()

template<typename T >
MatrixCsr jet::MatrixCsr< T >::rdiv ( const T &  s) const

Returns input matrix / this scalar.

◆ reserve()

template<typename T >
void jet::MatrixCsr< T >::reserve ( size_t  rows,
size_t  cols,
size_t  numNonZeros 
)

Reserves memory space of this matrix.

◆ rmul()

template<typename T >
MatrixCsr jet::MatrixCsr< T >::rmul ( const T &  s) const

Returns input scalar * this matrix.

◆ rowPointer()

template<typename T >
const size_t& jet::MatrixCsr< T >::rowPointer ( size_t  i) const

Returns i-th row pointer.

◆ rowPointersBegin() [1/2]

template<typename T >
IndexIterator jet::MatrixCsr< T >::rowPointersBegin ( )

Returns the begin iterator of the row pointers.

◆ rowPointersBegin() [2/2]

template<typename T >
ConstIndexIterator jet::MatrixCsr< T >::rowPointersBegin ( ) const

Returns the begin const iterator of the row pointers.

◆ rowPointersData()

template<typename T >
const size_t* const jet::MatrixCsr< T >::rowPointersData ( ) const

Returns constant pointer of the row pointers data.

◆ rowPointersEnd() [1/2]

template<typename T >
IndexIterator jet::MatrixCsr< T >::rowPointersEnd ( )

Returns the end iterator of the row pointers.

◆ rowPointersEnd() [2/2]

template<typename T >
ConstIndexIterator jet::MatrixCsr< T >::rowPointersEnd ( ) const

Returns the end const iterator of the row pointers.

◆ rows()

template<typename T >
size_t jet::MatrixCsr< T >::rows ( ) const

Returns number of rows of this matrix.

◆ rsub() [1/2]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::rsub ( const MatrixCsr< T > &  m) const

Returns input matrix - this matrix (element-wise).

◆ rsub() [2/2]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::rsub ( const T &  s) const

Returns input scalar - this matrix.

◆ set() [1/2]

template<typename T >
void jet::MatrixCsr< T >::set ( const MatrixCsr< T > &  other)

Copy from given sparse matrix.

◆ set() [2/2]

template<typename T >
void jet::MatrixCsr< T >::set ( const T &  s)

Sets whole matrix with input scalar.

◆ setElement() [1/2]

template<typename T >
void jet::MatrixCsr< T >::setElement ( const Element element)

Sets non-zero element.

◆ setElement() [2/2]

template<typename T >
void jet::MatrixCsr< T >::setElement ( size_t  i,
size_t  j,
const T &  value 
)

Sets non-zero element to (i, j).

◆ size()

template<typename T >
Size2 jet::MatrixCsr< T >::size ( ) const

Returns the size of this matrix.

◆ sub() [1/2]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::sub ( const MatrixCsr< T > &  m) const

Returns this matrix - input matrix (element-wise).

◆ sub() [2/2]

template<typename T >
MatrixCsr jet::MatrixCsr< T >::sub ( const T &  s) const

Returns this matrix - input scalar.

◆ sum()

template<typename T >
T jet::MatrixCsr< T >::sum ( ) const

Returns sum of all elements.

◆ trace()

template<typename T >
T jet::MatrixCsr< T >::trace ( ) const

Returns sum of all diagonal elements.

Warning
Should be a square matrix.

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