Compressed Sparse Row (CSR) matrix class. More...
#include <Core/Matrix/MatrixCSR.hpp>
Classes | |
struct | Element |
Public Types | |
using | NonZeroContainerType = std::vector< T > |
using | NonZeroIterator = typename NonZeroContainerType::iterator |
using | ConstNonZeroIterator = typename NonZeroContainerType::const_iterator |
using | IndexContainerType = std::vector< size_t > |
using | IndexIterator = IndexContainerType::iterator |
using | ConstIndexIterator = IndexContainerType::const_iterator |
Public Types inherited from CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC, MatrixCSR< T > > | |
using | ValueType = T |
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<size_t R, size_t C, typename E > | |
MatrixCSR (const MatrixExpression< T, R, C, E > &other, T epsilon=std::numeric_limits< T >::epsilon()) | |
Compresses input (dense) matrix expression into a sparse matrix. More... | |
~MatrixCSR ()=default | |
Default destructor. More... | |
MatrixCSR (const MatrixCSR &other) | |
Copy constructor. More... | |
MatrixCSR (MatrixCSR &&other) noexcept | |
Move constructor. More... | |
MatrixCSR & | operator= (const MatrixCSR &other) |
Copies to this matrix. More... | |
MatrixCSR & | operator= (MatrixCSR &&other) noexcept |
Moves to this matrix. 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<size_t R, size_t C, typename E > | |
void | Compress (const MatrixExpression< T, R, C, 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... | |
Vector2UZ | Size () const |
Returns the size of this matrix. More... | |
size_t | GetRows () const |
Returns number of rows of this matrix. More... | |
size_t | GetCols () 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 * | NonZeroData () const |
Returns constant pointer of the non-zero elements data. More... | |
const size_t * | RowPointersData () const |
Returns constant pointer of the row pointers data. More... | |
const size_t * | 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<size_t R, size_t C, typename ME > | |
MatrixCSRMatrixMul< T, ME > | Mul (const MatrixExpression< T, R, C, 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<size_t R, size_t C, typename ME > | |
void | IMul (const MatrixExpression< T, R, C, ME > &m) |
Multiplies input matrix to this matrix. More... | |
void | IDiv (const T &s) |
Divides this matrix with input scalar. More... | |
T | Sum () const |
Returns sum of all elements. More... | |
T | Avg () const |
Returns average of all elements. More... | |
T | Min () const |
Returns minimum among all elements. More... | |
T | Max () const |
Returns maximum among all elements. More... | |
T | AbsMin () const |
Returns absolute minimum among all elements. More... | |
T | AbsMax () const |
Returns absolute maximum among all elements. More... | |
T | Trace () const |
template<typename U > | |
MatrixCSR< U > | CastTo () const |
Type-casts to different value-typed matrix. More... | |
template<size_t R, size_t C, typename ME > | |
MatrixCSR & | operator= (const MatrixExpression< T, R, C, ME > &m) |
Compresses input (dense) matrix expression into a sparse matrix. More... | |
MatrixCSR & | operator+= (const T &s) |
Addition assignment with input scalar. More... | |
MatrixCSR & | operator+= (const MatrixCSR &m) |
Addition assignment with input matrix (element-wise). More... | |
MatrixCSR & | operator-= (const T &s) |
Subtraction assignment with input scalar. More... | |
MatrixCSR & | operator-= (const MatrixCSR &m) |
Subtraction assignment with input matrix (element-wise). More... | |
MatrixCSR & | operator*= (const T &s) |
Multiplication assignment with input scalar. More... | |
template<size_t R, size_t C, typename ME > | |
MatrixCSR & | operator*= (const MatrixExpression< T, R, C, ME > &m) |
Multiplication assignment with input matrix. More... | |
MatrixCSR & | operator/= (const T &s) |
Division assignment with input scalar. More... | |
T | 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... | |
template<size_t R, size_t C, typename ME > | |
MatrixCSR (const MatrixExpression< T, R, C, ME > &other, T epsilon) | |
template<size_t R, size_t C, typename E > | |
MatrixCSR< T > & | operator= (const MatrixExpression< T, R, C, E > &m) |
template<size_t R, size_t C, typename ME > | |
MatrixCSR< T > & | operator*= (const MatrixExpression< T, R, C, ME > &m) |
template<typename Op > | |
MatrixCSR< T > | BinaryOp (const MatrixCSR &m, Op op) const |
Public Member Functions inherited from CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC, MatrixCSR< T > > | |
constexpr size_t | GetRows () const |
Returns the number of rows. More... | |
constexpr size_t | GetCols () const |
Returns the number of columns. More... | |
T | Eval (size_t i, size_t j) const |
Returns the evaluated value for (i, j). More... | |
Matrix< T, Rows, Cols > | Eval () const |
bool | IsSimilar (const MatrixExpression< T, R, C, E > &m, double tol=std::numeric_limits< double >::epsilon()) const |
constexpr bool | IsSquare () const |
Returns true if this matrix is a square matrix. More... | |
ValueType | Sum () const |
ValueType | Avg () const |
ValueType | Min () const |
ValueType | Max () const |
ValueType | AbsMin () const |
ValueType | AbsMax () const |
ValueType | Trace () const |
ValueType | Determinant () const |
std::enable_if_t<(Rows > 4 &&Cols > 4)||IsMatrixSizeDynamic< Rows, Cols >), U > | Determinant (const MatrixExpression &m) |
size_t | DominantAxis () const |
size_t | SubdominantAxis () const |
ValueType | Norm () const |
ValueType | NormSquared () const |
ValueType | FrobeniusNorm () const |
ValueType | Length () const |
ValueType | LengthSquared () const |
ValueType | DistanceTo (const MatrixExpression< T, R, C, E > &other) const |
Returns the distance to the other vector. More... | |
T | DistanceTo (const MatrixExpression< T, R, C, E > &other) const |
ValueType | DistanceSquaredTo (const MatrixExpression< T, R, C, E > &other) const |
Returns the squared distance to the other vector. More... | |
T | DistanceSquaredTo (const MatrixExpression< T, R, C, E > &other) const |
MatrixScalarElemWiseBinaryOp< T, Rows, Cols, const MatrixCSR< T > &, std::divides< T > > | Normalized () const |
MatrixDiagonal< T, Rows, Cols, const MatrixCSR< T > &> | Diagonal () const |
Returns diagonal part of this matrix. More... | |
MatrixOffDiagonal< T, Rows, Cols, const MatrixCSR< T > &> | OffDiagonal () const |
Returns off-diagonal part of this matrix. More... | |
MatrixTri< T, Rows, Cols, const MatrixCSR< T > &> | StrictLowerTri () const |
Returns strictly lower triangle part of this matrix. More... | |
MatrixTri< T, Rows, Cols, const MatrixCSR< T > &> | StrictUpperTri () const |
Returns strictly upper triangle part of this matrix. More... | |
MatrixTri< T, Rows, Cols, const MatrixCSR< T > &> | LowerTri () const |
Returns lower triangle part of this matrix (including the diagonal). More... | |
MatrixTri< T, Rows, Cols, const MatrixCSR< T > &> | UpperTri () const |
Returns upper triangle part of this matrix (including the diagonal). More... | |
MatrixTranspose< T, Rows, Cols, const MatrixCSR< T > &> | Transposed () const |
Matrix< T, Rows, Cols > | Inverse () const |
Returns inverse matrix. More... | |
void | Inverse (const MatrixExpression< T, Rows, Cols, MatrixCSR< T > > &m, std::enable_if_t<(Rows > 4 &&Cols > 4)||IsMatrixSizeDynamic< Rows, Cols >(), M > &result) |
MatrixUnaryOp< U, Rows, Cols, const MatrixCSR< T > &, TypeCast< T, U > > | CastTo () const |
MatrixTypeCast< T, Rows, Cols, U, const D &> | CastTo () const |
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||Cols==1) &&(IsMatrixSizeDynamic< R, C >)||C==1), U > | Dot (const MatrixExpression< T, R, C, E > &expression) const |
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||(Rows==2 &&Cols==1)) &&(IsMatrixSizeDynamic< R, C >)||(R==2 &&C==1)), U > | Cross (const MatrixExpression< T, R, C, E > &expression) const |
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||(Rows==3 &&Cols==1)) &&(IsMatrixSizeDynamic< R, C >)||(R==3 &&C==1)), Matrix< U, 3, 1 > > | Cross (const MatrixExpression< T, R, C, E > &expression) const |
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||((Rows==2||Rows==3) &&Cols==1)) &&(IsMatrixSizeDynamic< R, C >)||((R==2||R==3) &&C==1)), Matrix< U, Rows, 1 > > | Reflected (const MatrixExpression< T, R, C, E > &normal) const |
Returns the reflection vector to the surface with given surface normal. More... | |
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||((Rows==2||Rows==3) &&Cols==1)) &&(IsMatrixSizeDynamic< R, C >)||((R==2||R==3) &&C==1)), Matrix< U, Rows, 1 > > | Projected (const MatrixExpression< T, R, C, E > &normal) const |
Returns the projected vector to the surface with given surface normal. More... | |
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||(Rows==2 &&Cols==1)), Matrix< U, 2, 1 > > | Tangential () const |
Returns the tangential vector for this vector. More... | |
std::enable_if_t<(IsMatrixSizeDynamic< Rows, Cols >)||(Rows==3 &&Cols==1)), std::tuple< Matrix< U, 3, 1 >, Matrix< U, 3, 1 > > > | Tangentials () const |
Returns the tangential vectors for this vector. More... | |
MatrixCSR< T > & | GetDerived () |
Returns actual implementation (the subclass). More... | |
const MatrixCSR< T > & | GetDerived () const |
Returns actual implementation (the subclass). More... | |
Static Public Member Functions | |
static MatrixCSR< T > | MakeIdentity (size_t m) |
Additional Inherited Members | |
Protected Member Functions inherited from CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC, MatrixCSR< T > > | |
MatrixExpression ()=default | |
Static Protected Member Functions inherited from CubbyFlow::MatrixExpression< T, MATRIX_SIZE_DYNAMIC, MATRIX_SIZE_DYNAMIC, MatrixCSR< T > > | |
static constexpr T | Determinant (const MatrixExpression< T, 1, 1, MatrixCSR< T > > &m) |
static constexpr T | Determinant (const MatrixExpression< T, 2, 2, MatrixCSR< T > > &m) |
static constexpr T | Determinant (const MatrixExpression< T, 3, 3, MatrixCSR< T > > &m) |
static constexpr T | Determinant (const MatrixExpression< T, 4, 4, MatrixCSR< T > > &m) |
static std::enable_if_t<(Rows > 4 &&Cols > 4)||IsMatrixSizeDynamic< Rows, Cols >), U > | Determinant (const MatrixExpression< T, Rows, Cols, MatrixCSR< T > > &m) |
static void | Inverse (const MatrixExpression< T, 1, 1, MatrixCSR< T > > &m, Matrix< T, Rows, Cols > &result) |
static void | Inverse (const MatrixExpression< T, 2, 2, MatrixCSR< T > > &m, Matrix< T, Rows, Cols > &result) |
static void | Inverse (const MatrixExpression< T, 3, 3, MatrixCSR< T > > &m, Matrix< T, Rows, Cols > &result) |
static void | Inverse (const MatrixExpression< T, 4, 4, MatrixCSR< T > > &m, Matrix< T, Rows, Cols > &result) |
static void | Inverse (const MatrixExpression &m, std::enable_if_t<(Rows > 4 &&Cols > 4)||IsMatrixSizeDynamic< Rows, Cols >(), M > &result) |
Detailed Description
template<typename T>
class CubbyFlow::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.
- Template Parameters
-
T Type of the element.
Member Typedef Documentation
◆ ConstIndexIterator
using CubbyFlow::MatrixCSR< T >::ConstIndexIterator = IndexContainerType::const_iterator |
◆ ConstNonZeroIterator
using CubbyFlow::MatrixCSR< T >::ConstNonZeroIterator = typename NonZeroContainerType::const_iterator |
◆ IndexContainerType
using CubbyFlow::MatrixCSR< T >::IndexContainerType = std::vector<size_t> |
◆ IndexIterator
using CubbyFlow::MatrixCSR< T >::IndexIterator = IndexContainerType::iterator |
◆ NonZeroContainerType
using CubbyFlow::MatrixCSR< T >::NonZeroContainerType = std::vector<T> |
◆ NonZeroIterator
using CubbyFlow::MatrixCSR< T >::NonZeroIterator = typename NonZeroContainerType::iterator |
Constructor & Destructor Documentation
◆ MatrixCSR() [1/6]
CubbyFlow::MatrixCSR< T >::MatrixCSR | ( | ) |
Constructs an empty matrix.
◆ MatrixCSR() [2/6]
CubbyFlow::MatrixCSR< T >::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.
This constructor will build a matrix with given initializer list lst
such as
Note the initializer has 4x3 structure which will create 4x3 matrix. During the process, zero elements (less than epsilon
) will not be stored.
- Parameters
-
lst Initializer list that should be copy to the new matrix.
◆ MatrixCSR() [3/6]
CubbyFlow::MatrixCSR< T >::MatrixCSR | ( | const MatrixExpression< T, R, C, E > & | other, |
T | 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()
|
default |
Default destructor.
◆ MatrixCSR() [4/6]
CubbyFlow::MatrixCSR< T >::MatrixCSR | ( | const MatrixCSR< T > & | other | ) |
Copy constructor.
◆ MatrixCSR() [5/6]
|
noexcept |
Move constructor.
◆ MatrixCSR() [6/6]
CubbyFlow::MatrixCSR< T >::MatrixCSR | ( | const MatrixExpression< T, R, C, ME > & | other, |
T | epsilon | ||
) |
Member Function Documentation
◆ AbsMax()
T CubbyFlow::MatrixCSR< T >::AbsMax | ( | ) | const |
Returns absolute maximum among all elements.
◆ AbsMin()
T CubbyFlow::MatrixCSR< T >::AbsMin | ( | ) | const |
Returns absolute minimum among all elements.
◆ Add() [1/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::Add | ( | const T & | s | ) | const |
Returns this matrix + input scalar.
◆ Add() [2/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::Add | ( | const MatrixCSR< T > & | m | ) | const |
Returns this matrix + input matrix (element-wise).
◆ AddElement() [1/2]
void CubbyFlow::MatrixCSR< T >::AddElement | ( | size_t | i, |
size_t | j, | ||
const T & | value | ||
) |
Adds non-zero element to (i, j).
◆ AddElement() [2/2]
void CubbyFlow::MatrixCSR< T >::AddElement | ( | const Element & | element | ) |
Adds non-zero element.
◆ AddRow()
void CubbyFlow::MatrixCSR< T >::AddRow | ( | const NonZeroContainerType & | nonZeros, |
const IndexContainerType & | columnIndices | ||
) |
◆ Avg()
T CubbyFlow::MatrixCSR< T >::Avg | ( | ) | const |
Returns average of all elements.
◆ BinaryOp()
MatrixCSR<T> CubbyFlow::MatrixCSR< T >::BinaryOp | ( | const MatrixCSR< T > & | m, |
Op | op | ||
) | const |
◆ CastTo()
MatrixCSR< U > CubbyFlow::MatrixCSR< T >::CastTo | ( | ) | const |
Type-casts to different value-typed matrix.
◆ Clear()
void CubbyFlow::MatrixCSR< T >::Clear | ( | ) |
Clears the matrix and make it zero-dimensional.
◆ ColumnIndex()
const size_t & CubbyFlow::MatrixCSR< T >::ColumnIndex | ( | size_t | i | ) | const |
Returns i-th column index.
◆ ColumnIndicesBegin() [1/2]
MatrixCSR< T >::IndexIterator CubbyFlow::MatrixCSR< T >::ColumnIndicesBegin | ( | ) |
Returns the begin iterator of the column indices.
◆ ColumnIndicesBegin() [2/2]
MatrixCSR< T >::ConstIndexIterator CubbyFlow::MatrixCSR< T >::ColumnIndicesBegin | ( | ) | const |
Returns the begin const iterator of the column indices.
◆ ColumnIndicesData()
const size_t * CubbyFlow::MatrixCSR< T >::ColumnIndicesData | ( | ) | const |
Returns constant pointer of the column indices data.
◆ ColumnIndicesEnd() [1/2]
MatrixCSR< T >::IndexIterator CubbyFlow::MatrixCSR< T >::ColumnIndicesEnd | ( | ) |
Returns the end iterator of the column indices.
◆ ColumnIndicesEnd() [2/2]
MatrixCSR< T >::ConstIndexIterator CubbyFlow::MatrixCSR< T >::ColumnIndicesEnd | ( | ) | const |
Returns the end const iterator of the column indices.
◆ Compress() [1/2]
void CubbyFlow::MatrixCSR< T >::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.
This function will fill the matrix with given initializer list lst
such as
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
-
lst Initializer list that should be copy to the new matrix.
◆ Compress() [2/2]
void CubbyFlow::MatrixCSR< T >::Compress | ( | const MatrixExpression< T, R, C, E > & | other, |
T | 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.
◆ Div()
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::Div | ( | const T & | s | ) | const |
Returns this matrix / input scalar.
◆ GetCols()
size_t CubbyFlow::MatrixCSR< T >::GetCols | ( | ) | const |
Returns number of columns of this matrix.
◆ GetRows()
size_t CubbyFlow::MatrixCSR< T >::GetRows | ( | ) | const |
Returns number of rows of this matrix.
◆ IAdd() [1/2]
void CubbyFlow::MatrixCSR< T >::IAdd | ( | const T & | s | ) |
Adds input scalar to this matrix.
◆ IAdd() [2/2]
void CubbyFlow::MatrixCSR< T >::IAdd | ( | const MatrixCSR< T > & | m | ) |
Adds input matrix to this matrix (element-wise).
◆ IDiv()
void CubbyFlow::MatrixCSR< T >::IDiv | ( | const T & | s | ) |
Divides this matrix with input scalar.
◆ IMul() [1/2]
void CubbyFlow::MatrixCSR< T >::IMul | ( | const T & | s | ) |
Multiplies input scalar to this matrix.
◆ IMul() [2/2]
void CubbyFlow::MatrixCSR< T >::IMul | ( | const MatrixExpression< T, R, C, ME > & | m | ) |
Multiplies input matrix to this matrix.
◆ IsEqual()
bool CubbyFlow::MatrixCSR< T >::IsEqual | ( | const MatrixCSR< T > & | other | ) | const |
◆ IsSimilar()
bool CubbyFlow::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()
bool CubbyFlow::MatrixCSR< T >::IsSquare | ( | ) | const |
Returns true if this matrix is a square matrix.
◆ ISub() [1/2]
void CubbyFlow::MatrixCSR< T >::ISub | ( | const T & | s | ) |
Subtracts input scalar from this matrix.
◆ ISub() [2/2]
void CubbyFlow::MatrixCSR< T >::ISub | ( | const MatrixCSR< T > & | m | ) |
Subtracts input matrix from this matrix (element-wise).
◆ MakeIdentity()
|
static |
Makes a m x m matrix with all diagonal elements to 1, and other elements to 0.
◆ Max()
T CubbyFlow::MatrixCSR< T >::Max | ( | ) | const |
Returns maximum among all elements.
◆ Min()
T CubbyFlow::MatrixCSR< T >::Min | ( | ) | const |
Returns minimum among all elements.
◆ Mul() [1/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::Mul | ( | const T & | s | ) | const |
Returns this matrix * input scalar.
◆ Mul() [2/2]
MatrixCSRMatrixMul< T, ME > CubbyFlow::MatrixCSR< T >::Mul | ( | const MatrixExpression< T, R, C, ME > & | m | ) | const |
Returns this matrix * input matrix.
◆ NonZero() [1/2]
const T & CubbyFlow::MatrixCSR< T >::NonZero | ( | size_t | i | ) | const |
Returns i-th non-zero element.
◆ NonZero() [2/2]
T & CubbyFlow::MatrixCSR< T >::NonZero | ( | size_t | i | ) |
Returns i-th non-zero element.
◆ NonZeroBegin() [1/2]
MatrixCSR< T >::NonZeroIterator CubbyFlow::MatrixCSR< T >::NonZeroBegin | ( | ) |
Returns the begin iterator of the non-zero elements.
◆ NonZeroBegin() [2/2]
MatrixCSR< T >::ConstNonZeroIterator CubbyFlow::MatrixCSR< T >::NonZeroBegin | ( | ) | const |
Returns the begin const iterator of the non-zero elements.
◆ NonZeroData() [1/2]
T * CubbyFlow::MatrixCSR< T >::NonZeroData | ( | ) |
Returns pointer of the non-zero elements data.
◆ NonZeroData() [2/2]
const T * CubbyFlow::MatrixCSR< T >::NonZeroData | ( | ) | const |
Returns constant pointer of the non-zero elements data.
◆ NonZeroEnd() [1/2]
MatrixCSR< T >::NonZeroIterator CubbyFlow::MatrixCSR< T >::NonZeroEnd | ( | ) |
Returns the end iterator of the non-zero elements.
◆ NonZeroEnd() [2/2]
MatrixCSR< T >::ConstNonZeroIterator CubbyFlow::MatrixCSR< T >::NonZeroEnd | ( | ) | const |
Returns the end const iterator of the non-zero elements.
◆ NumberOfNonZeros()
size_t CubbyFlow::MatrixCSR< T >::NumberOfNonZeros | ( | ) | const |
Returns the number of non-zero elements.
◆ operator!=()
bool CubbyFlow::MatrixCSR< T >::operator!= | ( | const MatrixCSR< T > & | m | ) | const |
Returns true if is not equal to m.
◆ operator()()
T CubbyFlow::MatrixCSR< T >::operator() | ( | size_t | i, |
size_t | j | ||
) | const |
Returns (i,j) element.
◆ operator*=() [1/3]
MatrixCSR< T > & CubbyFlow::MatrixCSR< T >::operator*= | ( | const T & | s | ) |
Multiplication assignment with input scalar.
◆ operator*=() [2/3]
MatrixCSR& CubbyFlow::MatrixCSR< T >::operator*= | ( | const MatrixExpression< T, R, C, ME > & | m | ) |
Multiplication assignment with input matrix.
◆ operator*=() [3/3]
MatrixCSR<T>& CubbyFlow::MatrixCSR< T >::operator*= | ( | const MatrixExpression< T, R, C, ME > & | m | ) |
◆ operator+=() [1/2]
MatrixCSR< T > & CubbyFlow::MatrixCSR< T >::operator+= | ( | const T & | s | ) |
Addition assignment with input scalar.
◆ operator+=() [2/2]
MatrixCSR< T > & CubbyFlow::MatrixCSR< T >::operator+= | ( | const MatrixCSR< T > & | m | ) |
Addition assignment with input matrix (element-wise).
◆ operator-=() [1/2]
MatrixCSR< T > & CubbyFlow::MatrixCSR< T >::operator-= | ( | const T & | s | ) |
Subtraction assignment with input scalar.
◆ operator-=() [2/2]
MatrixCSR< T > & CubbyFlow::MatrixCSR< T >::operator-= | ( | const MatrixCSR< T > & | m | ) |
Subtraction assignment with input matrix (element-wise).
◆ operator/=()
MatrixCSR< T > & CubbyFlow::MatrixCSR< T >::operator/= | ( | const T & | s | ) |
Division assignment with input scalar.
◆ operator=() [1/4]
MatrixCSR< T > & CubbyFlow::MatrixCSR< T >::operator= | ( | const MatrixCSR< T > & | other | ) |
Copies to this matrix.
◆ operator=() [2/4]
|
noexcept |
Moves to this matrix.
◆ operator=() [3/4]
MatrixCSR& CubbyFlow::MatrixCSR< T >::operator= | ( | const MatrixExpression< T, R, C, ME > & | 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=() [4/4]
MatrixCSR<T>& CubbyFlow::MatrixCSR< T >::operator= | ( | const MatrixExpression< T, R, C, E > & | m | ) |
◆ operator==()
bool CubbyFlow::MatrixCSR< T >::operator== | ( | const MatrixCSR< T > & | m | ) | const |
Returns true if is equal to m.
◆ RAdd() [1/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::RAdd | ( | const T & | s | ) | const |
Returns input scalar + this matrix.
◆ RAdd() [2/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::RAdd | ( | const MatrixCSR< T > & | m | ) | const |
Returns input matrix + this matrix (element-wise).
◆ RDiv()
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::RDiv | ( | const T & | s | ) | const |
Returns input matrix / this scalar.
◆ Reserve()
void CubbyFlow::MatrixCSR< T >::Reserve | ( | size_t | rows, |
size_t | cols, | ||
size_t | numNonZeros | ||
) |
Reserves memory space of this matrix.
◆ RMul()
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::RMul | ( | const T & | s | ) | const |
Returns input scalar * this matrix.
◆ RowPointer()
const size_t & CubbyFlow::MatrixCSR< T >::RowPointer | ( | size_t | i | ) | const |
Returns i-th row pointer.
◆ RowPointersBegin() [1/2]
MatrixCSR< T >::IndexIterator CubbyFlow::MatrixCSR< T >::RowPointersBegin | ( | ) |
Returns the begin iterator of the row pointers.
◆ RowPointersBegin() [2/2]
MatrixCSR< T >::ConstIndexIterator CubbyFlow::MatrixCSR< T >::RowPointersBegin | ( | ) | const |
Returns the begin const iterator of the row pointers.
◆ RowPointersData()
const size_t * CubbyFlow::MatrixCSR< T >::RowPointersData | ( | ) | const |
Returns constant pointer of the row pointers data.
◆ RowPointersEnd() [1/2]
MatrixCSR< T >::IndexIterator CubbyFlow::MatrixCSR< T >::RowPointersEnd | ( | ) |
Returns the end iterator of the row pointers.
◆ RowPointersEnd() [2/2]
MatrixCSR< T >::ConstIndexIterator CubbyFlow::MatrixCSR< T >::RowPointersEnd | ( | ) | const |
Returns the end const iterator of the row pointers.
◆ RSub() [1/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::RSub | ( | const T & | s | ) | const |
Returns input scalar - this matrix.
◆ RSub() [2/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::RSub | ( | const MatrixCSR< T > & | m | ) | const |
Returns input matrix - this matrix (element-wise).
◆ Set() [1/2]
void CubbyFlow::MatrixCSR< T >::Set | ( | const T & | s | ) |
Sets whole matrix with input scalar.
◆ Set() [2/2]
void CubbyFlow::MatrixCSR< T >::Set | ( | const MatrixCSR< T > & | other | ) |
Copy from given sparse matrix.
◆ SetElement() [1/2]
void CubbyFlow::MatrixCSR< T >::SetElement | ( | size_t | i, |
size_t | j, | ||
const T & | value | ||
) |
Sets non-zero element to (i, j).
◆ SetElement() [2/2]
void CubbyFlow::MatrixCSR< T >::SetElement | ( | const Element & | element | ) |
Sets non-zero element.
◆ Size()
Vector2UZ CubbyFlow::MatrixCSR< T >::Size | ( | ) | const |
Returns the size of this matrix.
◆ Sub() [1/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::Sub | ( | const T & | s | ) | const |
Returns this matrix - input scalar.
◆ Sub() [2/2]
MatrixCSR< T > CubbyFlow::MatrixCSR< T >::Sub | ( | const MatrixCSR< T > & | m | ) | const |
Returns this matrix - input matrix (element-wise).
◆ Sum()
T CubbyFlow::MatrixCSR< T >::Sum | ( | ) | const |
Returns sum of all elements.
◆ Trace()
T CubbyFlow::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 files:
- Core/Matrix/MatrixCSR.hpp
- Core/Matrix/MatrixCSR-Impl.hpp