![]() |
MechSys
1.0
Computing library for simulations in continuum and discrete mechanics
|
#include <sparse_triplet.h>
Public Member Functions | |
Triplet () | |
Triplet (Triplet< Value_T, Index_T > const &A, Triplet< Value_T, Index_T > const &B, Triplet< Value_T, Index_T > const &C, Triplet< Value_T, Index_T > const &D) | |
~Triplet () | |
Index_T | Rows () const |
Number of rows of the matrix from which this triplet was defined. | |
Index_T | Cols () const |
Number of columns of the matrix from which this triplet was defined. | |
Index_T | Size () const |
Return the maximum number of components allowed (memory available) | |
Index_T | Top () const |
Return current position of insertion of new components == current number of components. | |
void | AllocSpace (Index_T nRows, Index_T nCols, Index_T Size) |
Allocate memory for "Size" entries == number of non-zero values, including duplicates. The number of Rows and Columns are only saved to aid further format conversions. The "Size" must be any number, even bigger than Rows*Cols, in case there are duplicates. | |
void | PushEntry (Index_T i, Index_T j, Value_T x) |
Insert an entry into the arrays (increase top; top must be smaller than Size) | |
void | ResetTop (Index_T NewTop=0) |
Set Top to NewTop => clear the triplet after NewTop. | |
Index_T | Ai (Index_T k) const |
Row index. | |
Index_T | Aj (Index_T k) const |
Column index. | |
Value_T | Ax (Index_T k) const |
Non-zero value. | |
Index_T * | GetAiPtr () |
Access row indexes (write) | |
Index_T * | GetAjPtr () |
Access column indexes (write) | |
Value_T * | GetAxPtr () |
Access non-zero values (write) | |
Index_T const * | GetAiPtr () const |
Access row indexes (read) | |
Index_T const * | GetAjPtr () const |
Access column indexes (read) | |
Value_T const * | GetAxPtr () const |
Access non-zero values (read) | |
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. | |
void | WriteSMAT (char const *FileKey, double Tol=1.0e-14) const |
Write .smat file for vismatrix. | |
void | IncIndices (Index_T Delta) |
Increment i,j indices by Delta. |
Sparse matrix in Triplet format (Duplicates allowed; May be unsorted).
Example:
_ _ rows: | 2 3 0 0 0 | <-- i=0 | 3 0 4 0 6 | <-- i=1 A = | 0 -1 -3 2 0 | <-- i=2 | 0 0 1 0 0 | <-- i=3 |_ 0 4 2 0 1 _| <-- i=4 ____ duplicates | | Ax = 1 1 3 3 -1 4 4 -3 1 2 2 6 1 Ai = 0 0 1 0 2 4 1 2 3 4 2 1 4 Aj = 0 0 0 1 1 1 2 2 2 2 3 4 4 top _| size = 13 top = 12
Example:
Sparse::Triplet< Value_T, Index_T >::Triplet | ( | ) | [inline] |
Constructor (must call AllocSpace() and PushEntry() methods later).
Sparse::Triplet< Value_T, Index_T >::Triplet | ( | Triplet< Value_T, Index_T > const & | A, |
Triplet< Value_T, Index_T > const & | B, | ||
Triplet< Value_T, Index_T > const & | C, | ||
Triplet< Value_T, Index_T > const & | D | ||
) | [inline] |
Constructing given other 4 triplets.
Sparse::Triplet< Value_T, Index_T >::~Triplet | ( | ) | [inline] |
Destructor.
Index_T Sparse::Triplet< Value_T, Index_T >::Ai | ( | Index_T | k | ) | const [inline] |
Row index.
Index_T Sparse::Triplet< Value_T, Index_T >::Aj | ( | Index_T | k | ) | const [inline] |
Column index.
void Sparse::Triplet< Value_T, Index_T >::AllocSpace | ( | Index_T | nRows, |
Index_T | nCols, | ||
Index_T | Size | ||
) | [inline] |
Allocate memory for "Size" entries == number of non-zero values, including duplicates. The number of Rows and Columns are only saved to aid further format conversions. The "Size" must be any number, even bigger than Rows*Cols, in case there are duplicates.
Value_T Sparse::Triplet< Value_T, Index_T >::Ax | ( | Index_T | k | ) | const [inline] |
Non-zero value.
Index_T Sparse::Triplet< Value_T, Index_T >::Cols | ( | ) | const [inline] |
Number of columns of the matrix from which this triplet was defined.
Index_T * Sparse::Triplet< Value_T, Index_T >::GetAiPtr | ( | ) | [inline] |
Access row indexes (write)
Index_T const * Sparse::Triplet< Value_T, Index_T >::GetAiPtr | ( | ) | const [inline] |
Access row indexes (read)
Index_T * Sparse::Triplet< Value_T, Index_T >::GetAjPtr | ( | ) | [inline] |
Access column indexes (write)
Index_T const * Sparse::Triplet< Value_T, Index_T >::GetAjPtr | ( | ) | const [inline] |
Access column indexes (read)
Value_T * Sparse::Triplet< Value_T, Index_T >::GetAxPtr | ( | ) | [inline] |
Access non-zero values (write)
Value_T const * Sparse::Triplet< Value_T, Index_T >::GetAxPtr | ( | ) | const [inline] |
Access non-zero values (read)
void Sparse::Triplet< Value_T, Index_T >::IncIndices | ( | Index_T | Delta | ) | [inline] |
Increment i,j indices by Delta.
Util::NumStream const& Sparse::Triplet< Value_T, Index_T >::NS | ( | ) | const [inline] |
Return the NumStream, a structure to aid format output of numbers.
void Sparse::Triplet< Value_T, Index_T >::PushEntry | ( | Index_T | i, |
Index_T | j, | ||
Value_T | x | ||
) | [inline] |
Insert an entry into the arrays (increase top; top must be smaller than Size)
void Sparse::Triplet< Value_T, Index_T >::ResetTop | ( | Index_T | NewTop = 0 | ) | [inline] |
Set Top to NewTop => clear the triplet after NewTop.
Index_T Sparse::Triplet< Value_T, Index_T >::Rows | ( | ) | const [inline] |
Number of rows of the matrix from which this triplet was defined.
void Sparse::Triplet< Value_T, Index_T >::SetNS | ( | Util::NumStream & | NS | ) | [inline] |
Set the NumStream, a structure to aid format output of numbers.
Index_T Sparse::Triplet< Value_T, Index_T >::Size | ( | ) | const [inline] |
Return the maximum number of components allowed (memory available)
Index_T Sparse::Triplet< Value_T, Index_T >::Top | ( | ) | const [inline] |
Return current position of insertion of new components == current number of components.
void Sparse::Triplet< Value_T, Index_T >::WriteSMAT | ( | char const * | FileKey, |
double | Tol = 1.0e-14 |
||
) | const [inline] |
Write .smat file for vismatrix.