|
Heidelberg Educational Numerics Library Version 0.27 (from 15 March 2021)
|
Sparse matrix Class with mathematical matrix operations. More...
#include <sparsematrix.hh>
Classes | |
| class | builder |
| class | column_index_iterator |
| class | const_column_index_iterator |
| class | const_row_iterator |
| class | row_iterator |
Public Types | |
| using | size_type = std::size_t |
| Types used for array indices. | |
| using | column_iterator = typename std::vector<REAL>::iterator |
| type of a regular column iterator (no access to indices) | |
| using | const_column_iterator = typename std::vector<REAL>::const_iterator |
| type of a const regular column iterator (no access to indices) | |
Public Member Functions | |
| SparseMatrix ()=default | |
| default constructor (empty SparseMatrix) | |
| SparseMatrix (const size_type _rows, const size_type _cols) | |
| constructor with added dimensions and columns | |
| size_type | rowsize () const |
| get number of rows of the matrix | |
| size_type | colsize () const |
| get number of columns of the matrix | |
| bool | scientific () const |
| pretty-print output properties | |
| row_iterator | begin () |
| get a (possibly modifying) row iterator for the sparse matrix | |
| row_iterator | end () |
| get a (possibly modifying) row iterator for the sparse matrix | |
| const_row_iterator | cbegin () const |
| get a (non modifying) row iterator for the sparse matrix | |
| const_row_iterator | cend () const |
| get a (non modifying) row iterator for the sparse matrix | |
| const_row_iterator | begin () const |
| const_row_iterator | end () const |
| void | scientific (bool b) const |
| Switch between floating point (default=true) and fixed point (false) display. | |
| size_type | iwidth () const |
| get index field width for pretty-printing | |
| size_type | width () const |
| get data field width for pretty-printing | |
| size_type | precision () const |
| get data precision for pretty-printing | |
| void | iwidth (size_type i) const |
| set index field width for pretty-printing | |
| void | width (size_type i) const |
| set data field width for pretty-printing | |
| void | precision (size_type i) const |
| set data precision for pretty-printing | |
| column_iterator | find (const size_type row_index, const size_type col_index) const |
| bool | exists (const size_type row_index, const size_type col_index) const |
| REAL & | get (const size_type row_index, const size_type col_index) |
| write access on matrix element A_ij using A.get(i,j) | |
| const REAL & | operator() (const size_type row_index, const size_type col_index) const |
| read-access on matrix element A_ij using A(i,j) | |
| bool | operator== (const SparseMatrix &other) const |
| checks whether two matricies are equal based on values and dimension | |
| bool | operator!= (const SparseMatrix &other) const |
| checks whether two matricies are unequal based on values and dimension | |
| bool | operator< (const SparseMatrix &other)=delete |
| bool | operator> (const SparseMatrix &other)=delete |
| bool | operator<= (const SparseMatrix &other)=delete |
| bool | operator>= (const SparseMatrix &other)=delete |
| SparseMatrix | transpose () const |
| SparseMatrix | operator*= (const REAL scalar) |
| SparseMatrix | operator/= (const REAL scalar) |
| template<class V > | |
| void | mv (Vector< V > &result, const Vector< V > &x) const |
| matrix vector product y = A*x | |
| Vector< REAL > | operator* (const Vector< REAL > &x) const |
| matrix vector product A*x | |
| template<class V > | |
| void | umv (Vector< V > &result, const Vector< V > &x) const |
| update matrix vector product y += A*x | |
| auto | norm_infty () const |
| calculate row sum norm | |
| std::string | to_string () const noexcept |
| void | print () const noexcept |
| SparseMatrix< REAL > | matchingIdentity () const |
| creates a matching identity | |
Static Public Member Functions | |
| static SparseMatrix | identity (const size_type dimN) |
| identity for the matrix | |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<class REAL > | |
| void | identity (SparseMatrix< REAL > &A) |
Sparse matrix Class with mathematical matrix operations.
|
default |
default constructor (empty SparseMatrix)
Example:
Output:
Matrix A has 0 rows.
|
inline |
get a (possibly modifying) row iterator for the sparse matrix
The iterator points to the first row in the matrix.
Example:
|
inline |
|
inline |
get a (non modifying) row iterator for the sparse matrix
The iterator points to the first row in the matrix.
|
inline |
get a (non modifying) row iterator for the sparse matrix
The iterator points to the row one after the last one.
|
inline |
get number of columns of the matrix
Example:
Output:
Matrix A has 4 rows.
|
inline |
get a (possibly modifying) row iterator for the sparse matrix
The iterator points to the row one after the last one.
Example:
|
inline |
|
inlinestatic |
identity for the matrix
Example:
Output:
A= 0 1 2 3 0 1.000 0.000 0.000 0.000 1 0.000 1.000 0.000 0.000 2 0.000 0.000 1.000 0.000 3 0.000 0.000 0.000 1.000
|
inline |
creates a matching identity
Example:
Output:
A= 0 1 2 3 0 1.000 0.000 0.000 0.000 1 0.000 1.000 0.000 0.000 2 0.000 0.000 1.000 0.000 3 0.000 0.000 0.000 1.000
|
inline |
calculate row sum norm
![\[
||A||_{\infty} = max_{i = 1...m} \sum_{j=1}^n |a_{ij}|
\]](form_1.png)
matrix vector product A*x
Implements A*x where x is a vectors and A is a matrix
| [in] | x | constant reference to a Vector |
|
inline |
Element-wise multiplication of the matrix
| [in] | scalar | with same type as the matrix elements |
|
inline |
Element-wise division of the matrix
| [in] | scalar | with same type as the matrix elements |
|
inline |
get number of rows of the matrix
Example:
Output:
Matrix A has 4 rows.
Switch between floating point (default=true) and fixed point (false) display.
Example:
Output:
A= 0 1 2 3 0 1.000 0.000 0.000 0.000 1 0.000 1.000 0.000 0.000 2 0.000 0.000 1.000 0.000 3 0.000 0.000 0.000 1.000
|
related |
Function: make identity matrix
| [in] | A | reference to a SparseMatrix that shall be filled with entries |
Example:
Output:
A= 0 1 2 3 0 1.00000 0.00000 0.00000 0.00000 1 0.00000 1.00000 0.00000 0.00000 2 0.00000 0.00000 1.00000 0.00000 3 0.00000 0.00000 0.00000 1.00000