![]() |
MechSys
1.0
Computing library for simulations in continuum and discrete mechanics
|
#include <sparse_crmatrix.h>
Public Member Functions | |
CRMatrix () | |
~CRMatrix () | |
CRMatrix (Triplet< Value_T, Index_T > const &T) | |
void | Set (Triplet< Value_T, Index_T > const &T) |
(Re)set this matrix for a given triplet (with duplicates) | |
void | Set (Index_T nRows, Index_T nCols, Index_T nZ, String const &strAy, String const &strAj, String const &strAq) |
nRows: Number of rows, nCols: Number of columns, nZ: Number of non-zero values, Ay: Non-zero values, Aj: Columns indexes, Aq: Pointers to the column indexes | |
Index_T | Rows () const |
Number of rows. | |
Index_T | Cols () const |
Number of columns. | |
Index_T | nZ () const |
Number of non-zero values. | |
Value_T | Ay (Index_T iNz) const |
Returns non-zero values. | |
Index_T | Aj (Index_T iNz) const |
Returns the columns indexes. | |
Index_T | Aq (Index_T iRow) const |
Returns the pointers to columns indexes. | |
Value_T * | GetAyPtr () |
Access values (write) | |
Index_T * | GetAjPtr () |
Access columns indexes (write) | |
Index_T * | GetAqPtr () |
Access pointers to columns indexes (write) | |
Value_T const * | GetAyPtr () const |
Access values (read) | |
Index_T const * | GetAjPtr () const |
Access columns indexes (read) | |
Index_T const * | GetAqPtr () const |
Access pointers to columns indexes (read) | |
void | GetDense (Mat_t &D) const |
Convert this sparse structure to a Dense matrix. | |
void | SetNS (Util::NumStream &NS) |
Set the NumStream, a structure to aid format output of numbers. | |
Util::NumStream const & | NS () const |
Return the NumStream, a structure to aid format output of numbers. |
Sparse matrix in Compressed-row (CR) format (sorted).
Example:
rows: _ _ Ay: Aj: Aq: i=0 --> | 2 3 0 0 0 | 2 3 0 1 0 i=1 --> | 3 0 4 0 6 | 3 4 6 0 2 4 2 A = i=2 --> | 0 -1 -3 2 0 | -1 -3 2 1 2 3 5 i=3 --> | 0 0 1 0 0 | 1 2 8 i=4 --> |_ 0 4 2 0 1 _| 4 2 1 1 2 4 9 12 n = 5 (nrows==ncols) nz = 12 (number of non-zero values) Ay.size == nz == 12 : Non-zero values Aj.size == nz == 12 : Column indexes of the non-zero values Aq.size == nrows+1 == 6 : Pointers (indexes) to the columns indexes of non-zero values inside Aj
Example:
Sparse::CRMatrix< Value_T, Index_T >::CRMatrix | ( | ) | [inline] |
Constructor (must call Set() method later).
Sparse::CRMatrix< Value_T, Index_T >::~CRMatrix | ( | ) | [inline] |
Destructor.
Sparse::CRMatrix< Value_T, Index_T >::CRMatrix | ( | Triplet< Value_T, Index_T > const & | T | ) | [inline] |
Alternative constructor. Convert triplet (with duplicates) to compressed-row format
Index_T Sparse::CRMatrix< Value_T, Index_T >::Aj | ( | Index_T | iNz | ) | const [inline] |
Returns the columns indexes.
Index_T Sparse::CRMatrix< Value_T, Index_T >::Aq | ( | Index_T | iRow | ) | const [inline] |
Returns the pointers to columns indexes.
Value_T Sparse::CRMatrix< Value_T, Index_T >::Ay | ( | Index_T | iNz | ) | const [inline] |
Returns non-zero values.
Index_T Sparse::CRMatrix< Value_T, Index_T >::Cols | ( | ) | const [inline] |
Number of columns.
Index_T * Sparse::CRMatrix< Value_T, Index_T >::GetAjPtr | ( | ) | [inline] |
Access columns indexes (write)
Index_T const * Sparse::CRMatrix< Value_T, Index_T >::GetAjPtr | ( | ) | const [inline] |
Access columns indexes (read)
Index_T * Sparse::CRMatrix< Value_T, Index_T >::GetAqPtr | ( | ) | [inline] |
Access pointers to columns indexes (write)
Index_T const * Sparse::CRMatrix< Value_T, Index_T >::GetAqPtr | ( | ) | const [inline] |
Access pointers to columns indexes (read)
Value_T * Sparse::CRMatrix< Value_T, Index_T >::GetAyPtr | ( | ) | [inline] |
Access values (write)
Value_T const * Sparse::CRMatrix< Value_T, Index_T >::GetAyPtr | ( | ) | const [inline] |
Access values (read)
void Sparse::CRMatrix< Value_T, Index_T >::GetDense | ( | Mat_t & | D | ) | const [inline] |
Convert this sparse structure to a Dense matrix.
Util::NumStream const& Sparse::CRMatrix< Value_T, Index_T >::NS | ( | ) | const [inline] |
Return the NumStream, a structure to aid format output of numbers.
Index_T Sparse::CRMatrix< Value_T, Index_T >::nZ | ( | ) | const [inline] |
Number of non-zero values.
Index_T Sparse::CRMatrix< Value_T, Index_T >::Rows | ( | ) | const [inline] |
Number of rows.
void Sparse::CRMatrix< Value_T, Index_T >::Set | ( | Triplet< Value_T, Index_T > const & | T | ) | [inline] |
(Re)set this matrix for a given triplet (with duplicates)
void Sparse::CRMatrix< Value_T, Index_T >::Set | ( | Index_T | nRows, |
Index_T | nCols, | ||
Index_T | nZ, | ||
String const & | strAy, | ||
String const & | strAj, | ||
String const & | strAq | ||
) | [inline] |
nRows: Number of rows, nCols: Number of columns, nZ: Number of non-zero values, Ay: Non-zero values, Aj: Columns indexes, Aq: Pointers to the column indexes
void Sparse::CRMatrix< Value_T, Index_T >::SetNS | ( | Util::NumStream & | NS | ) | [inline] |
Set the NumStream, a structure to aid format output of numbers.