SymSparseMatrix Class Reference
Last update: 16.07.2025Symmetric sparse matrix class with selfadjoint storage. More...
Public Types | |
| typedef Eigen::SparseMatrix< TScalar > | Base |
| the underlying Eigen sparse matrix type | |
| enum | some_enums { EIGENFLAGS = Eigen::ColMajor|Eigen::SelfAdjoint|Eigen::Lower, EIGENSYM = Eigen::Lower } |
| defines Eigen flags to be used for modfying Eigen's algebra operators More... | |
| typedef Base::Index | TEigenIndex |
| index type for Eigen matrices | |
| typedef number | TScalar |
| the data type of the coefficients (real number) | |
| typedef number | TUnsignedIndex |
| an unsigned index type | |
Public Member Functions | |
| SymSparseMatrix | __neg__ () const |
| char * | __str__ () |
| transforms this objects into a string, required by SWIG More... | |
| Assign (SymSparseMatrix other, bool keep_data=true) | |
| assigns a new matrix to this object More... | |
| Base | cast () const |
| TUnsignedIndex | Cols () |
| TUnsignedIndex | InnerSize () |
| TUnsignedIndex | NonZeros () |
| Matrix | operator* (Matrix x) const |
| Matrix | operator* (MatrixBlock x) const |
| sparse::SparseMatrix | operator* (SymSparseMatrix x) const |
| SymSparseMatrix | operator* (number x) const |
| SymSparseMatrix | operator+ (SymSparseMatrix x) const |
| SymSparseMatrix | operator- (SymSparseMatrix x) const |
| SymSparseMatrix | operator/ (number x) const |
| TUnsignedIndex | OuterSize () |
| Print (string format="%g ", TUnsignedIndex rows=20, TUnsignedIndex cols=20) const | |
| Prune (TScalar reference) | |
| sets all elements with absolute value <= reference to zero and removes from storage More... | |
| Prune (TScalar reference, TScalar epsilon) | |
| sets all elements with absolute value <= reference*epsilon to zero and removes from storage More... | |
| TUnsignedIndex | Rows () |
| SetZero () | |
| sets the object to zero (clears it) | |
| Swap (SymSparseMatrix other) | |
| swaps the contents of this object More... | |
| SymSparseMatrix (SymSparseMatrix ar, bool keep_data=true) | |
| destructor More... | |
| SymSparseMatrix (SymSparseMatrix ar) | |
| copy constructor More... | |
| SymSparseMatrix (sparse::SparseMatrix ar, bool keep_data=true) | |
| copy constructor More... | |
| SymSparseMatrix | Transpose () |
Detailed Description
Symmetric sparse matrix class with selfadjoint storage.
This class represents a symmetric sparse matrix. Only the lower triangular part and the diagonal are stored. The upper triangular part is "emulated".
Member Enumeration Documentation
◆ some_enums
| enum some_enums |
Constructor & Destructor Documentation
◆ SymSparseMatrix() [1/3]
| SymSparseMatrix | ( | SymSparseMatrix | ar, |
| bool | keep_data = true |
||
| ) |
destructor
copy constructor
- Parameters
-
ar the source matrix keep_data if true, this is a copy constructor. If false, the source matrix will be empty afterwards
◆ SymSparseMatrix() [2/3]
copy constructor
- Parameters
-
ar the source matrix
◆ SymSparseMatrix() [3/3]
| SymSparseMatrix | ( | sparse::SparseMatrix | ar, |
| bool | keep_data = true |
||
| ) |
copy constructor
- Parameters
-
ar the source matrix keep_data if true, this is a copy constructor. If false, the source matrix will be empty afterwards
Member Function Documentation
◆ __neg__()
| SymSparseMatrix __neg__ | ( | ) | const |
- Returns
- returns the unary minus (i.e. B = -A = -(*this)) of this matric
◆ __str__()
| char* __str__ | ( | ) |
transforms this objects into a string, required by SWIG
- Returns
- a 0-terminated string
◆ Assign()
| Assign | ( | SymSparseMatrix | other, |
| bool | keep_data = true |
||
| ) |
assigns a new matrix to this object
- Parameters
-
other the other sparse matrix keep_data if false, then the other matrix will be cleared
◆ cast()
| Base cast | ( | ) | const |
- Returns
- a reference to this object, casted to the base class
◆ Cols()
| TUnsignedIndex Cols | ( | ) |
- Returns
- the number of columns
◆ InnerSize()
| TUnsignedIndex InnerSize | ( | ) |
- Returns
- the number of inner elements
◆ NonZeros()
| TUnsignedIndex NonZeros | ( | ) |
- Returns
- the number of nonzeros
◆ operator*() [1/4]
overrides the sparsematrix-densematrix product.
- Returns
- returns the product of *this and another dense matrix
- Parameters
-
x the other dense matrix
◆ operator*() [2/4]
| Matrix operator* | ( | MatrixBlock | x | ) | const |
- Returns
- returns the product of *this and another dense matrix
- Parameters
-
x the other dense matrix
◆ operator*() [3/4]
| sparse::SparseMatrix operator* | ( | SymSparseMatrix | x | ) | const |
- Returns
- SparseMatrix returns the product of *this and another symmetric sparse matrix
- Parameters
-
x the other sparse matrix
◆ operator*() [4/4]
| SymSparseMatrix operator* | ( | number | x | ) | const |
- Returns
- returns the product of *this and a scalar
- Parameters
-
x the other scalar
◆ operator+()
| SymSparseMatrix operator+ | ( | SymSparseMatrix | x | ) | const |
- Returns
- returns the sum of two sparse matrices
- Parameters
-
x the other matrix
◆ operator-()
| SymSparseMatrix operator- | ( | SymSparseMatrix | x | ) | const |
- Returns
- returns the subtraction of two sparse matrices
- Parameters
-
x the other matrix
◆ operator/()
| SymSparseMatrix operator/ | ( | number | x | ) | const |
- Returns
- returns the division of *this by a scalar
- Parameters
-
x the other sparse matrix
◆ OuterSize()
| TUnsignedIndex OuterSize | ( | ) |
- Returns
- the number of sparse column vectors
◆ Print()
| ( | string | format = "%g ", |
|
| TUnsignedIndex | rows = 20, |
||
| TUnsignedIndex | cols = 20 |
||
| ) | const |
prints the sparse matrix up to the given rows and columns (internally a temporary dense matrix will be created)
- Parameters
-
format the format of a single element, see printf for details rows only print the first rows rows cols only print the first cols columns
◆ Prune() [1/2]
| Prune | ( | TScalar | reference | ) |
sets all elements with absolute value <= reference to zero and removes from storage
- Parameters
-
reference the reference value (tolerance)
◆ Prune() [2/2]
sets all elements with absolute value <= reference*epsilon to zero and removes from storage
- Parameters
-
reference the reference value epsilon epsilon
◆ Rows()
| TUnsignedIndex Rows | ( | ) |
- Returns
- the number of rows
◆ Swap()
| Swap | ( | SymSparseMatrix | other | ) |
swaps the contents of this object
- Parameters
-
other the other object
◆ Transpose()
| SymSparseMatrix Transpose | ( | ) |
- Returns
- the transpose