![]() |
KASKADE 7 development version
|
A NUMA-aware compressed row storage matrix adhering mostly to the Dune ISTL interface (to complete...) More...
#include <threadedMatrix.hh>
Public Types | |
| typedef ScalarType< Entry > | Scalar |
| using | field_type = Scalar |
| using | block_type = Entry |
| using | value_type = Entry |
| using | size_type = Index |
| typedef ThreadedMatrixDetail::NumaBCRSMatrixIterator< Entry, Index > | iterator |
| iterator type stepping through the rows | |
| typedef ThreadedMatrixDetail::NumaBCRSMatrixConstIterator< Entry, Index > | const_iterator |
| typedef iterator | row_type |
| typedef const_iterator | const_row_type |
| typedef iterator | ConstRowIterator |
| using | ColIterator = typename iterator::Iterator |
| column iterator stepping through the entries of a row | |
| using | ConstColIterator = typename iterator::ConstIterator |
| column iterator stepping through the const entries of a row | |
Public Member Functions | |
Assignment and simple in-place modifications | |
| Self & | operator= (Self const &mat)=default |
| Copy assignment. | |
| Self & | operator= (Self &&mat)=default |
| Move assignment. | |
| template<class EntryA, class IndexA, typename = std::enable_if_t<std::is_convertible_v<EntryA,Entry>>> | |
| Self & | operator= (NumaBCRSMatrix< EntryA, IndexA > const &A) |
| Copy assignment from another NumaBCRSMatrix, with compatible entry and index types. | |
| Self & | operator= (Entry const &a) |
| Assigns the given value to each entry. | |
| Self & | operator= (typename Entry::field_type const &a) |
| Assigns the given scalar value to each entry. | |
| template<class Arguments, class Operation> | |
| Self & | operator= (ThreadedMatrixDetail::NumaBCRSMatrixExpression< Arguments, Operation > const &e) |
| NOT YET IMPLEMENTED Assigns the given Numa matrix expression. | |
| template<class EntryB, class IndexB> | |
| Self & | operator+= (NumaBCRSMatrix< EntryB, IndexB > const &B) |
| Adds a sparse matrix to this one. | |
| template<class EntryB, class IndexB> | |
| Self & | operator-= (NumaBCRSMatrix< EntryB, IndexB > const &B) |
| Subtracts a sparse matrix from this one. | |
| template<class Factor> | |
| Self & | operator*= (Factor a) |
| Multiplication with a "scalar". | |
Element access | |
Matrix entries can be accessed via iterators or by direct access. Iterators allow row-major scanning of existing matrix entries, with an iterator iterating over the rows and for each row an iterator iterating over the entries in that row. Direct access is provided by the subscript operator [], which returns a row (reference), which in turn provides a subscript operator for selecting the column, e.g., A[i][j] = 42;
Note that the second (column) subscript has logarithmic complexity in the number of entries in the row. | |
| iterator | begin () |
| returns an iterator to the first row | |
| const_iterator | begin () const |
| iterator | end () |
| returns an iterator to the first row | |
| const_iterator | end () const |
| row_type | operator[] (Index r) |
| Subscript operator allowing random access to rows. | |
| const_row_type | operator[] (Index r) const |
Submatrix extraction | |
| template<class RowIndices, class ColIndices> | |
| Self | operator() (RowIndices const &ri, ColIndices const &ci) const |
General matrix information. | |
| Index | N () const |
| The number of rows. | |
| Index | M () const |
| The number of columns. | |
| size_t | nonzeroes () const |
| Returns the number of structurally nonzero elements. | |
| std::shared_ptr< NumaCRSPattern< Index > > | getPattern () const |
| Returns a pointer to the sparsity pattern. | |
| Chunk & | chunk (int i) |
| Obtains a reference to the given chunk. | |
| Chunk const & | chunk (int i) const |
| bool | exists (Index r, Index c) const |
| returns true if (r,c) is structurally nonzero | |
| field_type | frobenius_norm () const |
| Computes the Frobenius norm \( \|A\|_F = \sqrt{\mathrm{tr}(A^TA)} \). | |
| field_type | frobenius_norm2 () const |
| Computes the square of the Frobenius norm \( \|A\|_F^2 = \mathrm{tr}(A^TA) \). | |
Matrix-vector operations | |
| template<class X, class Y> | |
| field_type | mv (X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow Ax \) with computation of \( y^T x \) if A is square. | |
| template<class X, class Y> | |
| void | mtv (X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow A^Tx \). | |
| template<class X, class Y> | |
| void | mmv (X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow -Ax \). | |
| template<class X, class Y> | |
| field_type | smv (field_type const &a, X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow aAx \). | |
| template<class X, class Y> | |
| void | smtv (field_type const &a, X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow aA^Tx \). | |
| template<class X, class Y> | |
| field_type | umv (X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow y + Ax \) and subsequent computation of \( y^T x \) if A is square. | |
| template<class X, class Y> | |
| void | umtv (X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow y + A^Tx \). | |
| template<class X, class Y> | |
| field_type | usmv (field_type const &a, X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow y + aAx \) and subsequent computation of \( y^T x \) if A is square. | |
| template<class X, class Y> | |
| void | usmtv (field_type const &a, X const &x, Y &y) const |
| Matrix-vector multiplication \( y \leftarrow y + aA^Tx \). | |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<class IndexP, class EntryP, class IndexA, class EntryA> | |
| auto | conjugation (NumaBCRSMatrix< EntryP, IndexP > const &P, NumaBCRSMatrix< EntryA, IndexA > const &A, bool onlyLowerTriangle=false, bool createDiagonal=false) |
| Creates the conjugation product \( P^T A P\). | |
| template<class Target, class Source, class RowIndices, class ColIndices> | |
| Target | submatrix (Source const &A, RowIndices const &ri, ColIndices const &ci) |
| extracts a sparse or dense submatrix of \( A \) | |
| template<class EntryA, class EntryB, class IndexA, class IndexB> | |
| auto | operator* (NumaBCRSMatrix< EntryA, IndexA > const &A, NumaBCRSMatrix< EntryB, IndexB > const &B) |
| Computes the matrix-matrix product \( (A,B) \mapsto AB \). | |
| template<class Entry, class Index> | |
| std::ostream & | operator<< (std::ostream &out, NumaBCRSMatrix< Entry, Index > const &A) |
| Writes a NumaBCRSMatrix to an output stream. | |
| template<class SparseMatrix> | |
| DynamicMatrix< typename SparseMatrix::block_type > | full (SparseMatrix const &A) |
| Converts a sparse NumaBCRSMatrix to a dense matrix. | |
| template<class SparseMatrix, class RowRange, class ColRange> | |
| DynamicMatrix< typename SparseMatrix::block_type > | full (SparseMatrix const &A, RowRange const &rows, ColRange const &cols) |
| Converts a subrange of a sparse matrix to a dense matrix. | |
| template<class Entry, class Index, class Index2> | |
| NumaBCRSMatrix< Entry, Index > | operator+ (NumaBCRSMatrix< Entry, Index > const &A, NumaBCRSMatrix< Entry, Index2 > const &B) |
| Matrix addition \( (A,B) \mapsto A+B \). The sparsity patterns of both matrices can be different. The size of the matrices have to be the same. Both must not have symmetric storage. | |
| template<class Entry, class Index> | |
| auto | transpose (NumaBCRSMatrix< Entry, Index > const &A) |
| Creates the transposed sparse matrix \( A^T \). | |
| template<class Target, class Source, class RowIndices, class ColIndices> | |
| Target | eraseRowsNCols (Source const &A, RowIndices const &ri, ColIndices const &ci) |
| "deletes" rows/columns by extracting a copy of the matrix keeping the non-deleted rows/columns. | |
| template<class Target, class Source, class RowIndices> | |
| Target | eraseRows (Source const &A, RowIndices const &ri) |
| "deletes" rows by extracting a copy of the matrix keeping only the non-deleted rows. | |
| template<class Target, class Source, class ColIndices> | |
| Target | eraseCols (Source const &A, ColIndices const &ci) |
| "deletes" columns by extracting a copy of the matrix keeping only the non-deleted columns. | |
| template<class Source> | |
| std::vector< size_t > | nonZeroColumns (Source const &A) |
| returns all indices of nonzero columns. | |
| template<int row2, int col2, int row1, int col1, class Scalar, class Index> | |
| NumaBCRSMatrix< Dune::FieldMatrix< Scalar, row2, col2 >, Index > | reshapeBlocks (NumaBCRSMatrix< Dune::FieldMatrix< Scalar, row1, col1 >, Index > const &A) |
| reshapes NumaBRCSMAtrix entry block structure | |
| template<int blockrows, int blockcols, class Scalar, class Index> | |
| NumaBCRSMatrix< Dune::FieldMatrix< Scalar, blockrows, blockcols >, Index > | horzcat (NumaBCRSMatrix< Dune::FieldMatrix< Scalar, blockrows, blockcols >, Index > const &A, NumaBCRSMatrix< Dune::FieldMatrix< Scalar, blockrows, blockcols >, Index > const &B) |
| concatenate two matrices horizontally | |
| template<int blockrows, int blockcols, class Scalar, class Index> | |
| NumaBCRSMatrix< Dune::FieldMatrix< Scalar, blockrows, blockcols >, Index > | vertcat (NumaBCRSMatrix< Dune::FieldMatrix< Scalar, blockrows, blockcols >, Index > const &A, NumaBCRSMatrix< Dune::FieldMatrix< Scalar, blockrows, blockcols >, Index > const &B) |
| concatenate two matrices vertically | |
| template<int blockrows, int blockcols, class Index = size_t> | |
| NumaBCRSMatrix< Dune::FieldMatrix< double, blockrows, blockcols >, Index > | diagcat (NumaBCRSMatrix< Dune::FieldMatrix< double, blockrows, blockcols >, Index > const &A, NumaBCRSMatrix< Dune::FieldMatrix< double, blockrows, blockcols >, Index > const &B) |
| concatenate two matrices diagonally, resulting matrix is zero on the off block-diagonal | |
Constructors | |
| NumaBCRSMatrix () | |
| Constructs an empty 0x0 matrix. | |
| NumaBCRSMatrix (Self const &A)=default | |
| Copy constructor. | |
| NumaBCRSMatrix (Self &&A)=default | |
| Move constructor. | |
| NumaBCRSMatrix (NumaCRSPatternCreator< Index > const &creator, Entry const &init=Entry(0)) | |
| Constructor creating a matrix from a given sparsity pattern creator. | |
| NumaBCRSMatrix (std::shared_ptr< NumaCRSPattern< Index > > const &pattern_, Entry const &init=Entry(0)) | |
| Constructor creating a matrix from a given sparsity pattern. | |
| template<class Expanded, class Condensed, class Matrix> | |
| NumaBCRSMatrix (Expanded const &eIndices, Condensed const &cIndices, Matrix const &mat) | |
| Deprecated. Use simpler version without cIndices instead. | |
| template<class Expanded, class Matrix> | |
| NumaBCRSMatrix (Expanded const &eIndices, Matrix const &mat) | |
| Indexed submatrix constructor. | |
| template<class Matrix> | |
| NumaBCRSMatrix (std::shared_ptr< NumaCRSPattern< Index > > const &pattern_, Matrix const &matrix, bool isSymmetric, bool isTransposed) | |
| Constructor copying a given matrix. | |
| template<class OtherEntry> | |
| NumaBCRSMatrix (NumaBCRSMatrix< OtherEntry, Index > const &matrix) | |
| Constructor copying a given matrix. | |
| template<class Matrix> | |
| NumaBCRSMatrix (Matrix const &matrix, bool isSymmetric, bool isTransposed=false, bool symmetric=false) | |
| Constructor. | |
| NumaBCRSMatrix (NumaBCRSMatrix< Entry, Index > const &matrix, bool isSymmetric, bool isTransposed=false, bool symmetric=false) | |
| Constructor. | |
| template<class TripletIndex, class TripletScalar> | |
| NumaBCRSMatrix (std::vector< TripletIndex > const &ridx, std::vector< TripletIndex > const &cidx, TripletIndex nRows, TripletIndex nCols, std::vector< TripletScalar > const &entries) | |
| Constructor. | |
Entering data | |
| template<class LMIterator> | |
| void | scatter (LMIterator first, LMIterator last) |
| Scatters given sub-matrices into the matrix by adding up their entries. | |
| template<class RowIndices, class ColIndices, class BinaryOp = std::plus<Entry>> | |
| void | scatter (DynamicMatrix< Entry > const &B, RowIndices const &rows, ColIndices const &cols, BinaryOp const &op=BinaryOp()) |
| Scatters given submarix into the matrix. | |
A NUMA-aware compressed row storage matrix adhering mostly to the Dune ISTL interface (to complete...)
This class distributes the matrix rows block-wise across available NUMA nodes to exploit the higher memory bandwidth in parallelized matrix-vector products and similar operations.
As the distribution of matrix entries to the NUMA nodes is optimized for equidistribution of storage size and computational effort in matrix vector products, transpose times vector multiplications are much slower than plain matrix-vector multiplications (roughly factor 6).
If the matrix is a priori specified as being symmetric, only the lower triangular elements are stored and can be accessed. Nevertheless, all linear algebra operations (i.e., matrix vector products) act on the complete symmetric matrix. Note that symmetric storage incurs a significant performance penalty for matrix-vector products (roughly factor 3), and should only be used if those operations are rare. In contrast, transpose times vector multiplications do not suffer.
For creating a NumaBCRSMatrix, a sparsity pattern (NumaCRSPattern) has to be provided. This in turn is created using a creator object (NumaCRSPatternCreator). This multi-stage creation allows efficient creation while avoiding stateful interfaces (incompletely created objects). The matrix creation can be done as follows:
Concurrent calls to one NumaBCRSMatrix object are not safe.
| Entry | the type of matrix elements (in general Dune::FieldMatrix<double,n,m>) |
| Index | integral type for row/column indices (usually int, long, or size_t), defaults to size_t |
Definition at line 920 of file threadedMatrix.hh.
| using Kaskade::NumaBCRSMatrix< Entry, Index >::block_type = Entry |
Definition at line 928 of file threadedMatrix.hh.
| using Kaskade::NumaBCRSMatrix< Entry, Index >::ColIterator = typename iterator::Iterator |
column iterator stepping through the entries of a row
Definition at line 943 of file threadedMatrix.hh.
| typedef ThreadedMatrixDetail::NumaBCRSMatrixConstIterator<Entry,Index> Kaskade::NumaBCRSMatrix< Entry, Index >::const_iterator |
Definition at line 936 of file threadedMatrix.hh.
| typedef const_iterator Kaskade::NumaBCRSMatrix< Entry, Index >::const_row_type |
Definition at line 938 of file threadedMatrix.hh.
| using Kaskade::NumaBCRSMatrix< Entry, Index >::ConstColIterator = typename iterator::ConstIterator |
column iterator stepping through the const entries of a row
Definition at line 946 of file threadedMatrix.hh.
| typedef iterator Kaskade::NumaBCRSMatrix< Entry, Index >::ConstRowIterator |
Definition at line 940 of file threadedMatrix.hh.
| using Kaskade::NumaBCRSMatrix< Entry, Index >::field_type = Scalar |
Definition at line 927 of file threadedMatrix.hh.
| typedef ThreadedMatrixDetail::NumaBCRSMatrixIterator<Entry,Index> Kaskade::NumaBCRSMatrix< Entry, Index >::iterator |
iterator type stepping through the rows
Definition at line 935 of file threadedMatrix.hh.
| typedef iterator Kaskade::NumaBCRSMatrix< Entry, Index >::row_type |
Definition at line 937 of file threadedMatrix.hh.
| typedef ScalarType<Entry> Kaskade::NumaBCRSMatrix< Entry, Index >::Scalar |
Definition at line 926 of file threadedMatrix.hh.
| using Kaskade::NumaBCRSMatrix< Entry, Index >::size_type = Index |
Definition at line 930 of file threadedMatrix.hh.
| using Kaskade::NumaBCRSMatrix< Entry, Index >::value_type = Entry |
Definition at line 929 of file threadedMatrix.hh.
|
inline |
Constructs an empty 0x0 matrix.
Definition at line 957 of file threadedMatrix.hh.
|
default |
Copy constructor.
|
default |
Move constructor.
|
inline |
Constructor creating a matrix from a given sparsity pattern creator.
This is a convenience constructor that creates a new pattern under the hood.
| creator | the sparsity pattern creatorof the matrix to be constructed |
| init | initialization value for the entries |
Definition at line 979 of file threadedMatrix.hh.
|
inline |
Constructor creating a matrix from a given sparsity pattern.
| pattern | the sparsity pattern of the matrix to be constructed |
| init | initialization value for the entries |
Definition at line 989 of file threadedMatrix.hh.
|
inline |
Deprecated. Use simpler version without cIndices instead.
This constructor will be made private after 2022-12.
Definition at line 1009 of file threadedMatrix.hh.
|
inline |
Indexed submatrix constructor.
This works like Matlab A(idx,idx), where idx is given by eIndices. It creates a \( n \times n \) matrix \( a \) from the \( N \times N\) matrix \( A \), where \( a_{ij} = A_{e_ie_j} \). Of course, \( n \le N \) has to hold.
| Expanded | an array type with value type convertible to Index |
| eIndices | sorted global array of size \( n \) of expanded indices |
| mat | a square matrix with BCRSMatrix interface |
Definition at line 1048 of file threadedMatrix.hh.
|
inline |
Constructor copying a given matrix.
| Matrix | the type of the supplied matrix to copy (usually a Dune::BCRSMatrix or a NumaBCRSMatrix with different scalar type). |
| pattern | the sparsity pattern to use |
| matrix | the matrix to be copied (shall have the given sparsity pattern) |
| isSymmetric | whether the supplied matrix is symmetric (then only its lower triangular part is accessed) |
| isTransposed | whether the supplied matrix is transposed |
Definition at line 1065 of file threadedMatrix.hh.
|
inline |
Constructor copying a given matrix.
| OtherEntry | The entry type of the matrix to be copied. The entries shall have the same dimension (but possibly different scalar type). |
| matrix | the matrix to be copied (shall conform to the Dune::BCRSMatrix interface) |
Use this for switching between different entry types (e.g. float vs double). The sparsity pattern is shared between both matrices.
The number of chunks created is the number of NUMA nodes as reported by NumaThreadPool.
Definition at line 1088 of file threadedMatrix.hh.
|
inline |
Constructor.
| Matrix | the type of the supplied matrix to copy (shall conform to the Dune::BCRSMatrix interface) |
| matrix | the matrix to be copied |
| isSymmetric | whether the supplied matrix is symmetric (then only its lower triangular part is accessed, requires square matrix and entries) |
| isTransposed | whether the supplied matrix is transposed |
| symmetric | whether only the lower triangular part should be stored (requires a square matrix and entries) |
This is a convenience constructor that creates a new sparsity pattern from scratch. The number of chunks created is the number of NUMA nodes as reported by NumaThreadPool.
Note that !isSymmetric && symmetric is highly questionable and hence not allowed.
Definition at line 1110 of file threadedMatrix.hh.
|
inline |
Constructor.
| matrix | the matrix to be copied (shall conform to the Dune::BCRSMatrix interface) |
| isSymmetric | whether the supplied matrix is symmetric (then only its lower triangular part is accessed, requires square matrix and entries) |
| isTransposed | whether the supplied matrix is transposed |
| symmetric | whether only the lower triangular part should be stored (requires a square matrix and entries) |
This is a convenience constructor that creates a new sparsity pattern from scratch. Use it for switching between symmetric/normal storage patterns and for creating transposed matrices.
The number of chunks created is the number of NUMA nodes as reported by NumaThreadPool.
Note that !isSymmetric && symmetric is highly questionable and hence not allowed.
Definition at line 1141 of file threadedMatrix.hh.
|
inline |
Constructor.
Creates a NumaBCRSMatrix from explicitly given row and column indices and scalar entries. If we create a matrix with non-scalar entries, the provided scalar entries are assembled into the sub-entries of the block-entries.
| ridx | row indices |
| cidx | column indices |
| nRows | number of (block) rows of the constructed matrix |
| nCols | number of (block) columns of the constructed matrix |
| entries | scalar matrix entries |
Definition at line 1167 of file threadedMatrix.hh.
|
inline |
returns an iterator to the first row
In symmetric storage, the iterators iterate only through the lower triangular part that is actually stored.
Definition at line 1342 of file threadedMatrix.hh.
Referenced by Kaskade::Matrix_to_Triplet< NumaBCRSMatrix< Dune::FieldMatrix< K, N, M >, Index > >::call(), Kaskade::ThreadedMatrixDetail::CRSChunk< Entry, Index >::entrywiseOp(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::frobenius_norm2(), Kaskade::ThreadedMatrixDetail::getRowCount(), Kaskade::Matrix_to_Triplet< NumaBCRSMatrix< Dune::FieldMatrix< K, N, M >, Index > >::nnz(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator<<(), Kaskade::writeToMatlab(), Kaskade::writeToMatlab(), and Kaskade::writeToMatlabBinary().
|
inline |
Definition at line 1343 of file threadedMatrix.hh.
|
inline |
Obtains a reference to the given chunk.
Definition at line 1412 of file threadedMatrix.hh.
Referenced by Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator=(), and Kaskade::ThreadedMatrixDetail::NumaBCRSRow< Entry, Index >::update().
|
inline |
Definition at line 1417 of file threadedMatrix.hh.
|
inline |
returns an iterator to the first row
Definition at line 1348 of file threadedMatrix.hh.
Referenced by Kaskade::Matrix_to_Triplet< NumaBCRSMatrix< Dune::FieldMatrix< K, N, M >, Index > >::call(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::frobenius_norm2(), Kaskade::ThreadedMatrixDetail::getRowCount(), Kaskade::Matrix_to_Triplet< NumaBCRSMatrix< Dune::FieldMatrix< K, N, M >, Index > >::nnz(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator+(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator<<(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::scatter(), Kaskade::writeToMatlab(), Kaskade::writeToMatlab(), and Kaskade::writeToMatlabBinary().
|
inline |
Definition at line 1349 of file threadedMatrix.hh.
|
inline |
returns true if (r,c) is structurally nonzero
Definition at line 1425 of file threadedMatrix.hh.
|
inline |
Computes the Frobenius norm \( \|A\|_F = \sqrt{\mathrm{tr}(A^TA)} \).
Definition at line 1434 of file threadedMatrix.hh.
|
inline |
Computes the square of the Frobenius norm \( \|A\|_F^2 = \mathrm{tr}(A^TA) \).
Definition at line 1443 of file threadedMatrix.hh.
Referenced by Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::frobenius_norm().
|
inline |
Returns a pointer to the sparsity pattern.
Definition at line 1404 of file threadedMatrix.hh.
Referenced by Kaskade::insertMatrixBlockIndices(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator+(), and Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator=().
|
inline |
The number of columns.
Definition at line 1388 of file threadedMatrix.hh.
Referenced by Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::conjugation(), Kaskade::MGProlongation::galerkinProjection(), Kaskade::insertMatrixBlockIndices(), Kaskade::MatrixTraits< NumaBCRSMatrix< Entry, Index > >::isSquare(), Kaskade::nonNestedProlognationStack(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::NumaBCRSMatrix(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator*(), Kaskade::writeToMatlab(), and Kaskade::writeToMatlab().
|
inline |
Matrix-vector multiplication \( y \leftarrow -Ax \).
Definition at line 1482 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow A^Tx \).
Note that transpose times vector operations are quite expensive (a factor of 6 slower than matrix-vector operations) and should be avoided. If you need transpose times vector products, consider storing a transposed matrix directly.
Definition at line 1476 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow Ax \) with computation of \( y^T x \) if A is square.
Definition at line 1465 of file threadedMatrix.hh.
|
inline |
The number of rows.
Definition at line 1383 of file threadedMatrix.hh.
Referenced by Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::conjugation(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::end(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::end(), Kaskade::MGProlongation::galerkinProjection(), Kaskade::insertMatrixBlockIndices(), Kaskade::MatrixTraits< NumaBCRSMatrix< Entry, Index > >::isSquare(), Kaskade::makeAuxiliarySpaceMultigridStack(), Kaskade::nonNestedProlognationStack(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::NumaBCRSMatrix(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator*(), Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator+(), Kaskade::ThreadedMatrixDetail::NumaBCRSRow< Entry, Index >::update(), Kaskade::writeToMatlab(), and Kaskade::writeToMatlab().
|
inline |
Returns the number of structurally nonzero elements.
In symmetric storage, the number of actually stored entries is smaller, usually by a factor of almost two.
Definition at line 1396 of file threadedMatrix.hh.
|
inline |
Definition at line 1366 of file threadedMatrix.hh.
|
inline |
Multiplication with a "scalar".
The factor a can be a scalar or a quadratic matrix of compatible static size.
Definition at line 1309 of file threadedMatrix.hh.
|
inline |
Adds a sparse matrix to this one.
The sparsity pattern of B must be a subset of our sparsity pattern.
Definition at line 1285 of file threadedMatrix.hh.
|
inline |
Subtracts a sparse matrix from this one.
The sparsity pattern of B must be a subset of our sparsity pattern.
Definition at line 1297 of file threadedMatrix.hh.
|
inline |
Assigns the given value to each entry.
Definition at line 1245 of file threadedMatrix.hh.
|
inline |
Copy assignment from another NumaBCRSMatrix, with compatible entry and index types.
The matrix becomes a copy of the given one, no matter what its previous structure or size was. The sparsity pattern is shared between both matrices if both index types agree.
Definition at line 1224 of file threadedMatrix.hh.
|
default |
Move assignment.
The matrices need not be of same size or sparsity pattern.
|
default |
Copy assignment.
The matrix becomes a copy of the given one, no matter what its previous structure or size was. The sparsity pattern is shared between both matrices.
|
inline |
NOT YET IMPLEMENTED Assigns the given Numa matrix expression.
Definition at line 1268 of file threadedMatrix.hh.
|
inline |
Assigns the given scalar value to each entry.
Definition at line 1259 of file threadedMatrix.hh.
|
inline |
Subscript operator allowing random access to rows.
This has constant complexity.
Definition at line 1356 of file threadedMatrix.hh.
|
inline |
Definition at line 1357 of file threadedMatrix.hh.
|
inline |
Scatters given sub-matrices into the matrix by adding up their entries.
| LMIterator | a forward iterator with value type of LocalMatrix (requirements see below). |
Local matrices \( a \) in the range [first,last[ are scattered into the global matrix as follows:
\[ A_{I_k,J_l} \leftarrow A_{I_k,J_l} + a_{i_k,j_l} \quad 0\le k < r, 0\le l < c \]
The possibly different ordering of entries in the local and global matrices is taken into account by the indirect indexing via \( (I_k,J_k) \) for the global indices and \( (i_k,j_l) \) for the local indices.
Objects a of LocalMatrix type have to provide the following access:
In case LocalMatrix::lumped is true, then ridx()==cidx() shall hold and only the diagonal of \( a \) is to be scattered.
In contrast to the other methods, this method can (and should) be called concurrently from different threads.
Definition at line 1561 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow aA^Tx \).
Note that transpose times vector operations are quite expensive (a factor of 6 slower than matrix-vector operations) and should be avoided. If you need transpose times vector products, consider storing a transposed matrix directly.
Definition at line 1497 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow aAx \).
Definition at line 1488 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow y + A^Tx \).
Note that transpose times vector operations are quite expensive (a factor of 6 slower than matrix-vector operations) and should be avoided. If you need transpose times vector products, consider storing a transposed matrix directly.
Definition at line 1512 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow y + Ax \) and subsequent computation of \( y^T x \) if A is square.
Definition at line 1503 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow y + aA^Tx \).
Note that transpose times vector operations are quite expensive (a factor of 6 slower than matrix-vector operations) and should be avoided. If you need transpose times vector products, consider storing a transposed matrix directly.
Definition at line 1527 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow y + aAx \) and subsequent computation of \( y^T x \) if A is square.
Definition at line 1518 of file threadedMatrix.hh.
|
Scatters given submarix into the matrix.
This performs \( A_{r_i c_j} = A_{r_i c_j} \circ B_{ij} \) for \( i,j \) indexing the provided matrix \( B \). Here, \( \circ \) denotes the given binary operation, which defaults to addition (the classical scatter operation).
| RowIndices | an STL sequence type with value_type convertible to Index |
| ColIndices | an STL sequence type with value_type convertible to Index |
| BinaryOp | a binary callable type with op(Entry const, Entry const) convertible to Entry. |
| B | the given matrix data |
| rows | the target row indices \( r_i \) for ourselves |
| cols | the target col indices \( c_i \) for ourselves |
| op | an arbitrary binary operation on Entry, defaults to plus |
Note that all entries \( A_{r_ic_i} \) must exist in this matrix.
As long as the row or column indices do not overlap, this method can safely be called concurrently.
Definition at line 1592 of file threadedMatrix.hh.