![]() |
Eigen-Contrib
5.0.1-dev+master
|
#include <contrib/Eigen/src/StructuredMatrices/KroneckerSparseView.h>
A KroneckerOperator or KroneckerSum as a lazy sparse expression.
The view is a SparseMatrixBase expression whose inner vectors are iterated straight from the factors, so the operator takes part in sparse expressions, products and assignments without being materialized first. A product follows Eigen's cost model for its operands like any sparse expression: a sparse-sparse product, or one with a row-major dense right-hand side, revisits every inner vector of the view and evaluates it into a temporary first when an entry costs more to recompute than to read (complex scalars, whose multiply is dearer than a read).
Inner vector kA*n2' + kB of \( A \otimes B \) (n2' the outer size of B) is the product of inner vectors kA of A and kB of B, so an iterator walks the stored entries of two factor inner vectors; for \( A \oplus B \) it merges the entries of \( A \otimes I \) and \( I \otimes B \). The view stores exactly the entries a sparse materialization would: every stored entry of a factor, explicit zeros included, and nothing is pruned. It is the operand for sparse expressions and assembly; a product with a dense right-hand side is faster through the operator itself, which applies whole factors instead of one entry at a time.
The view owns a copy of the operator, with sparse factors converted to its storage order Options (ColMajor or RowMajor, which must match the other operands of a sparse binary expression). Like a SparseMatrix it is nested by reference in the expressions built from it, so an expression must not outlive a temporary view. Its StorageIndex, the index type of the temporaries Eigen evaluates it into, is the widest of its sparse factors' (int without any) and must hold its dimensions and stored-entry count; 64-bit sparse factors give a 64-bit view. Its InnerIterator is also the interface the coefficient-reading preconditioners take, e.g. DiagonalPreconditioner::compute(view). The view is not a matrix type for the iterative solvers themselves, which bind theirs through Ref; give them the operator (matrix-free, IdentityPreconditioner) or a materialized SparseMatrix.
| OperatorType | the KroneckerOperator or KroneckerSum type. |
| Options | ColMajor or RowMajor, the storage order of the view. |
Inheritance diagram for Eigen::KroneckerSparseView< OperatorType, Options >:Classes | |
| class | InnerIterator |
Public Member Functions | |
| const ViewOperator & | nestedOperator () const |
|
inline |