KASKADE 7 development version
|
A NUMA-aware compressed row storage matrix adhering mostly to the Dune ISTL interface (to complete...) More...
#include <threadedMatrix.hh>
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 2114 of file threadedMatrix.hh.
Public Types | |
typedef ScalarType< Entry > | Scalar |
typedef Scalar | field_type |
typedef Entry | block_type |
using | value_type = Entry |
using | size_type = Index |
typedef ThreadedMatrixDetail::NumaBCRSMatrixIterator< Entry, Index > | iterator |
iterator type stepping through the rows More... | |
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 More... | |
using | ConstColIterator = typename iterator::ConstIterator |
column iterator stepping through the const entries of a row More... | |
Public Member Functions | |
Assignment and simple in-place modifications | |
Self & | operator= (Self const &mat)=default |
Copy assignment. More... | |
Self & | operator= (Self &&mat)=default |
Move assignment. More... | |
Self & | operator= (Entry const &a) |
Assigns the given value to each entry. More... | |
Self & | operator= (typename Entry::field_type const &a) |
Assigns the given scalar value to each entry. More... | |
template<class Arguments , class Operation > | |
Self & | operator= (ThreadedMatrixDetail::NumaBCRSMatrixExpression< Arguments, Operation > const &e) |
NOT YET IMPLEMENTED Assigns the given Numa matrix expression. More... | |
template<class EntryB , class IndexB > | |
Self & | operator+= (NumaBCRSMatrix< EntryB, IndexB > const &B) |
Adds a sparse matrix to this one. More... | |
template<class EntryB , class IndexB > | |
Self & | operator-= (NumaBCRSMatrix< EntryB, IndexB > const &B) |
Subtracts a sparse matrix from this one. More... | |
template<class Factor > | |
Self & | operator*= (Factor a) |
Multiplication with a "scalar". More... | |
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 More... | |
const_iterator | begin () const |
iterator | end () |
returns an iterator to the first row More... | |
const_iterator | end () const |
row_type | operator[] (Index r) |
Subscript operator allowing random access to rows. More... | |
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. More... | |
Index | M () const |
The number of columns. More... | |
size_t | nonzeroes () const |
Returns the number of structurally nonzero elements. More... | |
std::shared_ptr< NumaCRSPattern< Index > > | getPattern () const |
Returns a pointer to the sparsity pattern. More... | |
Chunk & | chunk (int i) |
Obtains a reference to the given chunk. More... | |
bool | exists (Index r, Index c) const |
returns true if (r,c) is structurally nonzero More... | |
field_type | frobenius_norm () const |
Computes the Frobenius norm \( \|A\|_F = \sqrt{\mathrm{tr}(A^TA)} \). More... | |
field_type | frobenius_norm2 () const |
Computes the square of the Frobenius norm \( \|A\|_F^2 = \mathrm{tr}(A^TA) \). More... | |
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. More... | |
template<class X , class Y > | |
void | mtv (X const &x, Y &y) const |
Matrix-vector multiplication \( y \leftarrow A^Tx \). More... | |
template<class X , class Y > | |
void | mmv (X const &x, Y &y) const |
Matrix-vector multiplication \( y \leftarrow -Ax \). More... | |
template<class X , class Y > | |
field_type | smv (field_type const &a, X const &x, Y &y) const |
Matrix-vector multiplication \( y \leftarrow aAx \). More... | |
template<class X , class Y > | |
void | smtv (field_type const &a, X const &x, Y &y) const |
Matrix-vector multiplication \( y \leftarrow aA^Tx \). More... | |
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. More... | |
template<class X , class Y > | |
void | umtv (X const &x, Y &y) const |
Matrix-vector multiplication \( y \leftarrow y + A^Tx \). More... | |
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. More... | |
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 \). More... | |
Related Functions | |
(Note that these are not member functions.) | |
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\). More... | |
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 \) More... | |
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 \). More... | |
template<class Entry , class Index > | |
std::ostream & | operator<< (std::ostream &out, NumaBCRSMatrix< Entry, Index > const &A) |
Writes a NumaBCRSMatrix to an output stream. More... | |
template<class SparseMatrix > | |
DynamicMatrix< typename SparseMatrix::block_type > | full (SparseMatrix const &A) |
Converts a sparse NumaBCRSMatrix to a dense matrix. More... | |
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. More... | |
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. More... | |
template<class Entry , class Index > | |
auto | transpose (NumaBCRSMatrix< Entry, Index > const &A) |
Creates the transposed sparse matrix \( A^T \). More... | |
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. More... | |
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. More... | |
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. More... | |
template<class Source > | |
std::vector< size_t > | nonZeroColumns (Source const &A) |
returns all indices of nonzero columns. More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
Constructors | |
NumaBCRSMatrix () | |
Constructs an empty 0x0 matrix. More... | |
NumaBCRSMatrix (Self const &A)=default | |
Copy constructor. More... | |
NumaBCRSMatrix (Self &&A)=default | |
Move constructor. More... | |
NumaBCRSMatrix (NumaCRSPatternCreator< Index > const &creator, Entry const &init=Entry(0)) | |
Constructor creating a matrix from a given sparsity pattern creator. More... | |
NumaBCRSMatrix (std::shared_ptr< NumaCRSPattern< Index > > const &pattern_, Entry const &init=Entry(0)) | |
Constructor creating a matrix from a given sparsity pattern. More... | |
template<class Expanded , class Condensed , class Matrix > | |
NumaBCRSMatrix (Expanded const &eIndices, Condensed const &cIndices, Matrix const &mat) | |
Deprecated. Use simpler version without cIndices instead. More... | |
template<class Expanded , class Matrix > | |
NumaBCRSMatrix (Expanded const &eIndices, Matrix const &mat) | |
Indexed submatrix constructor. More... | |
template<class Matrix > | |
NumaBCRSMatrix (std::shared_ptr< NumaCRSPattern< Index > > const &pattern_, Matrix const &matrix, bool isSymmetric, bool isTransposed) | |
Constructor copying a given matrix. More... | |
template<class OtherEntry > | |
NumaBCRSMatrix (NumaBCRSMatrix< OtherEntry, Index > const &matrix) | |
Constructor copying a given matrix. More... | |
template<class Matrix > | |
NumaBCRSMatrix (Matrix const &matrix, bool isSymmetric, bool isTransposed=false, bool symmetric=false) | |
Constructor. More... | |
NumaBCRSMatrix (NumaBCRSMatrix< Entry, Index > const &matrix, bool isSymmetric, bool isTransposed=false, bool symmetric=false) | |
Constructor. More... | |
Entering data | |
template<class LMIterator > | |
void | scatter (LMIterator first, LMIterator last) |
Scatters given sub-matrices into the matrix by adding up their entries. More... | |
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. More... | |
typedef Entry Kaskade::NumaBCRSMatrix< Entry, Index >::block_type |
Definition at line 2122 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 2137 of file threadedMatrix.hh.
typedef ThreadedMatrixDetail::NumaBCRSMatrixConstIterator<Entry,Index> Kaskade::NumaBCRSMatrix< Entry, Index >::const_iterator |
Definition at line 2130 of file threadedMatrix.hh.
typedef const_iterator Kaskade::NumaBCRSMatrix< Entry, Index >::const_row_type |
Definition at line 2132 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 2140 of file threadedMatrix.hh.
typedef iterator Kaskade::NumaBCRSMatrix< Entry, Index >::ConstRowIterator |
Definition at line 2134 of file threadedMatrix.hh.
typedef Scalar Kaskade::NumaBCRSMatrix< Entry, Index >::field_type |
Definition at line 2121 of file threadedMatrix.hh.
typedef ThreadedMatrixDetail::NumaBCRSMatrixIterator<Entry,Index> Kaskade::NumaBCRSMatrix< Entry, Index >::iterator |
iterator type stepping through the rows
Definition at line 2129 of file threadedMatrix.hh.
typedef iterator Kaskade::NumaBCRSMatrix< Entry, Index >::row_type |
Definition at line 2131 of file threadedMatrix.hh.
typedef ScalarType<Entry> Kaskade::NumaBCRSMatrix< Entry, Index >::Scalar |
Definition at line 2120 of file threadedMatrix.hh.
using Kaskade::NumaBCRSMatrix< Entry, Index >::size_type = Index |
Definition at line 2124 of file threadedMatrix.hh.
using Kaskade::NumaBCRSMatrix< Entry, Index >::value_type = Entry |
Definition at line 2123 of file threadedMatrix.hh.
|
inline |
Constructs an empty 0x0 matrix.
Definition at line 2151 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 2173 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 2183 of file threadedMatrix.hh.
|
inline |
Deprecated. Use simpler version without cIndices instead.
This constructor will be made private after 2022-12.
Definition at line 2203 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 2242 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 2258 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 2281 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 2302 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 2333 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 2468 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< Entry, Index >::frobenius_norm2(), Kaskade::ThreadedMatrixDetail::getRowCount(), Kaskade::Matrix_to_Triplet< NumaBCRSMatrix< Dune::FieldMatrix< K, N, M >, Index > >::nnz(), Kaskade::NumaBCRSMatrix< Entry, Index >::operator<<(), Kaskade::writeToMatlab(), and Kaskade::writeToMatlabBinary().
|
inline |
Definition at line 2469 of file threadedMatrix.hh.
|
inline |
Obtains a reference to the given chunk.
Definition at line 2532 of file threadedMatrix.hh.
Referenced by Kaskade::ThreadedMatrixDetail::NumaBCRSRow< Entry, Index >::update().
|
inline |
returns an iterator to the first row
Definition at line 2474 of file threadedMatrix.hh.
Referenced by Kaskade::Matrix_to_Triplet< NumaBCRSMatrix< Dune::FieldMatrix< K, N, M >, Index > >::call(), Kaskade::NumaBCRSMatrix< Entry, Index >::frobenius_norm2(), Kaskade::ThreadedMatrixDetail::getRowCount(), Kaskade::Matrix_to_Triplet< NumaBCRSMatrix< Dune::FieldMatrix< K, N, M >, Index > >::nnz(), Kaskade::NumaBCRSMatrix< Entry, Index >::operator+(), Kaskade::NumaBCRSMatrix< Entry, Index >::operator<<(), Kaskade::NumaBCRSMatrix< Entry, Index >::scatter(), Kaskade::writeToMatlab(), and Kaskade::writeToMatlabBinary().
|
inline |
Definition at line 2475 of file threadedMatrix.hh.
|
inline |
returns true if (r,c) is structurally nonzero
Definition at line 2537 of file threadedMatrix.hh.
|
inline |
Computes the Frobenius norm \( \|A\|_F = \sqrt{\mathrm{tr}(A^TA)} \).
Definition at line 2546 of file threadedMatrix.hh.
|
inline |
Computes the square of the Frobenius norm \( \|A\|_F^2 = \mathrm{tr}(A^TA) \).
Definition at line 2555 of file threadedMatrix.hh.
Referenced by Kaskade::NumaBCRSMatrix< Entry, Index >::frobenius_norm().
|
inline |
Returns a pointer to the sparsity pattern.
Definition at line 2527 of file threadedMatrix.hh.
Referenced by Kaskade::insertMatrixBlockIndices(), Kaskade::NumaBCRSMatrix< Entry, Index >::operator+(), Kaskade::ThreadedMatrixDetail::NumaBCRSMatrixConstIterator< Entry, Index >::operator++(), and Kaskade::ThreadedMatrixDetail::NumaBCRSMatrixConstIterator< Entry, Index >::operator--().
|
inline |
The number of columns.
Definition at line 2514 of file threadedMatrix.hh.
Referenced by Kaskade::NumaBCRSMatrix< Entry, Index >::conjugation(), Kaskade::MGProlongation::galerkinProjection(), Kaskade::insertMatrixBlockIndices(), Kaskade::MatrixTraits< NumaBCRSMatrix< Entry, Index > >::isSquare(), Kaskade::nonNestedProlognationStack(), Kaskade::NumaBCRSMatrix< Entry, Index >::NumaBCRSMatrix(), Kaskade::NumaBCRSMatrix< Entry, Index >::operator*(), and Kaskade::writeToMatlab().
|
inline |
Matrix-vector multiplication \( y \leftarrow -Ax \).
Definition at line 2594 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 2588 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow Ax \) with computation of \( y^T x \) if A is square.
Definition at line 2577 of file threadedMatrix.hh.
|
inline |
The number of rows.
Definition at line 2509 of file threadedMatrix.hh.
Referenced by Kaskade::NumaBCRSMatrix< Entry, Index >::conjugation(), Kaskade::NumaBCRSMatrix< Entry, Index >::end(), Kaskade::MGProlongation::galerkinProjection(), Kaskade::insertMatrixBlockIndices(), Kaskade::MatrixTraits< NumaBCRSMatrix< Entry, Index > >::isSquare(), Kaskade::makeAuxiliarySpaceMultigridStack(), Kaskade::nonNestedProlognationStack(), Kaskade::NumaBCRSMatrix< Entry, Index >::NumaBCRSMatrix(), Kaskade::NumaBCRSMatrix< Entry, Index >::operator*(), Kaskade::ThreadedMatrixDetail::NumaBCRSMatrixConstIterator< Entry, Index >::operator++(), Kaskade::ThreadedMatrixDetail::NumaBCRSMatrixConstIterator< Entry, Index >::operator+=(), Kaskade::ThreadedMatrixDetail::NumaBCRSRow< Entry, Index >::update(), 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 2522 of file threadedMatrix.hh.
|
inline |
Definition at line 2492 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 2435 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 2411 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 2423 of file threadedMatrix.hh.
|
inline |
Assigns the given value to each entry.
Definition at line 2371 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 2394 of file threadedMatrix.hh.
|
inline |
Assigns the given scalar value to each entry.
Definition at line 2385 of file threadedMatrix.hh.
|
inline |
Subscript operator allowing random access to rows.
This has constant complexity.
Definition at line 2482 of file threadedMatrix.hh.
|
inline |
Definition at line 2483 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 2673 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 2609 of file threadedMatrix.hh.
|
inline |
Matrix-vector multiplication \( y \leftarrow aAx \).
Definition at line 2600 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 2624 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 2615 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 2639 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 2630 of file threadedMatrix.hh.
|
related |
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 2704 of file threadedMatrix.hh.