KASKADE 7 development version
Loading...
Searching...
No Matches
Basic linear algebra

Classes and functions for basic vector and matrix arithmetics. More...

Topics

 Linear equations and similar problems
 Eigenvalue problems

Classes

class  Kaskade::LinearProductSpace< Scalar_, Seq >
class  Kaskade::DynamicMatrix< K >
 A LAPACK-compatible dense matrix class with shape specified at runtime. More...
class  Kaskade::LocalMatrix< Entry, diagonal, SortedRowIdx, SortedColIdx >
 Providing a matrix or array interface to LAPACK-ordered entries. More...
class  Kaskade::LocalMatrices< Entry, diagonal, SortedRowIdx, SortedColIdx, IT, IndexType >
 A structure for holding a sequence of several local matrices to be filled sequentially and to be scattered jointly. More...
class  Kaskade::LocalVector< Entry, SortedIdx >
 Providing a vector interface for contiguously stored entries. More...
class  Kaskade::LocalVectors< Entry, SortedIdx, Vector >
 A structure for holding a sequence of several local vectors to be filled sequentially and to be scattered jointly. More...
struct  Kaskade::MatrixTraits< Matrix >
 Defines domain and range types for matrix classes. More...
class  Kaskade::NumaDenseMatrix< Entry >
 A dense matrix class tailored towards NUMA architectures. More...
class  Kaskade::NumaVector< Entry >
 A vector class tailored towards NUMA architectures. This vector distributes its entries in blocks of approximately equal size to the different nodes of NUMA machines in order to exploit the larger accumulated memory bandwidth for fast vector operations. This is most beneficial for large vectors exceeding the cache of the CPUs. Modern processors (2015-01-01) have up to 6MB 3rd level cache, so this is intended for vectors of more than 50,000 doubles, say. More...
class  Kaskade::DualPairing< X, Xstar >
 Abstract base class for dual pairing of \( X \) and its dual space \( X^* \). More...
class  Kaskade::DefaultDualPairing< X, Xstar >
 Default implementation of dual pairing (relies on scalar product operator * being defined) More...
class  Kaskade::ZeroDualPairing< X, Xstar >
 Zero dual pairing implementation (mainly useful whenever a dual pairing is needed for formal language reasons, but never used) More...
class  Kaskade::SymmetricLinearOperator< X, Xstar >
 Interface for symmetric linear operators. More...
class  Kaskade::SymmetricMatrixOperator< X, Matrix >
 A symmetric operator represented by a matrix. More...
class  Kaskade::SymmetricLinearOperatorWrapper< X, Xstar >
 Wrapper class to present (hopefully) symmetric linear operators in the SymmetricLinearOperator interface. More...
class  Kaskade::SymmetricPreconditioner< X, Xstar >
 Interface for symmetric preconditioners. More...
class  Kaskade::IdentityPreconditioner< X >
 The trivial (identity) preconditioner. More...
class  Kaskade::SymmetricPreconditionerWrapper< X, Xstar >
 Wrapper class presenting a symmetric preconditioner interface for any preconditioner. More...
struct  Kaskade::StaticIndexRange< first, last >
 A compile-time index range. More...
class  Kaskade::Tensor< Entry, Size0, Sizes >
 A class for representing tensors of arbitrary static rank and extents. More...
class  Kaskade::NumaCRSPatternCreator< Index >
 A NUMA-aware creator for matrix sparsity patterns. More...
class  Kaskade::NumaCRSPattern< Index >
 A NUMA-aware compressed row storage sparsity pattern. More...
class  Kaskade::NumaBCRSMatrix< Entry, Index >
 A NUMA-aware compressed row storage matrix adhering mostly to the Dune ISTL interface (to complete...) More...
class  Kaskade::ThreadedMatrixDetail::CRSChunkPatternInfo< Index >
 A base class representing basic meta information about sparsity patterns of NUMA matrix chunks. More...
class  Kaskade::ThreadedMatrixDetail::CRSChunkPatternCreator< Index >
 A class supporting two-stage construction of sparsity patterns of NUMA matrix chunks. More...
class  Kaskade::ThreadedMatrixDetail::CRSChunkPattern< Index >
 This class maintains the sparsity structure of a couple of matrix rows (a NUMA matrix chunk). More...
class  Kaskade::ThreadedMatrixDetail::CRSChunk< Entry, Index >
 This class stores a couple of compressed row storage rows in memory allocated locally on a NUMA node. More...
class  Kaskade::MatrixAsTriplet< Scalar, SparseIndexInt >
class  Kaskade::Determinant< dim, Scalar, byValue >
 A class for computing determinants and their derivatives. More...

Typedefs

template<int m, class LinearProductSpace>
using Component = typename LinearProductSpace::template Component<m>
 The type of the m-th component of a product space.

Functions

template<class CoordType, int dim, std::enable_if_t< std::is_floating_point_v< CoordType >, int > = 0>
Dune::FieldVector< CoordType, dim > Kaskade::projectToUnitSimplex (Dune::FieldVector< CoordType, dim > x)
 Projects a vector onto the unit simplex.
template<class T, int n>
Dune::FieldVector< T, n > Dune::operator+ (Dune::FieldVector< T, n > x, Dune::FieldVector< T, n > const &y)
 Vector addition \( (x,y) \mapsto x+y \).
template<class T, int n>
Dune::FieldVector< T, n > Dune::operator- (Dune::FieldVector< T, n > x)
 Vector negation \( x \mapsto - x \).
template<class T, int n>
Dune::FieldVector< T, n > Dune::max (Dune::FieldVector< T, n > x, Dune::FieldVector< T, n > const &y)
 Componentwise maximum.
template<class T, int n>
Dune::FieldVector< T, n > Dune::min (Dune::FieldVector< T, n > x, Dune::FieldVector< T, n > const &y)
 Componentwise minimum.
template<class T, int n, int m>
Dune::FieldVector< T, n *m > Dune::asVector (Dune::FieldMatrix< T, n, m > const &x)
 Converts a matrix of size n x m to a vector of size n*m by concatenating all the columns.
template<int n, int m, class T>
Dune::FieldMatrix< T, n, m > Dune::asMatrix (Dune::FieldVector< T, n *m > const &x)
 Converts a vector of size nm to a matrix of size n x m by filling columns successively.
template<class T, int n, int m>
Dune::FieldMatrix< T, n, m > Dune::outerProduct (Dune::FieldVector< T, n > const &x, Dune::FieldVector< T, m > const &y)
 outer vector product \( (x,y) \mapsto x y^T \).
template<class T, int n>
Dune::FieldVector< T, n > Dune::normalize (Dune::FieldVector< T, n > x)
 returns the normalized vector
template<class T, int n, int m>
Dune::FieldVector< T, n+m > Dune::vertcat (Dune::FieldVector< T, n > const &x, Dune::FieldVector< T, m > const &y)
 Concatenation of vectors.
template<class T>
T Dune::vectorProduct (Dune::FieldVector< T, 2 > const &x, Dune::FieldVector< T, 2 > const &y)
 vector product \( (x,y) \mapsto x \times y \in \mathbb{R} \).
template<class T>
Dune::FieldMatrix< T, 1, 2 > Dune::vectorProductMatrix (Dune::FieldVector< T, 2 > const &x)
 the matrix \( A(x) \in \mathbb{R}^{1\times 2}\) satisfying \( A(x) b = x\times b \) for all \( b \)
template<class T>
Dune::FieldVector< T, 3 > Dune::vectorProduct (Dune::FieldVector< T, 3 > const &x, Dune::FieldVector< T, 3 > const &y)
 vector product \( (x,y) \mapsto x \times y \).
template<class T>
Dune::FieldMatrix< T, 3, 3 > Dune::vectorProductMatrix (Dune::FieldVector< T, 3 > const &x)
 the skew-symmetric matrix \( A(x)\in \mathbb{R}^{3\times 3} \) satisfying \( A(x) b = x\times b \) for all \( b \)
template<class T, class S, int n, int m>
Dune::FieldVector< S, n > Dune::operator* (Dune::FieldMatrix< T, n, m > const &A, Dune::FieldVector< S, m > const &x)
 Matrix-vector multiplication \( (A,x) \mapsto Ax \).
template<class T, int n, int m>
Dune::FieldMatrix< T, n, m > Dune::operator- (Dune::FieldMatrix< T, n, m > const &A)
 Matrix negation \( A \mapsto - A \).
template<class Scalar, int n, class ... Rest>
auto Kaskade::horzcat (Dune::FieldVector< Scalar, n > const &a, Rest ... rest)
 Concatenates an arbitrary number of column vectors and matrices with coinciding number of rows to a larger matrix.
template<class Scalar, int n>
Dune::FieldVector< Scalar, n *n > Kaskade::vectorize (Dune::FieldMatrix< Scalar, n, n > const &A)
 matrix entries as vector, concatenating columns
template<int n, class Scalar>
Dune::FieldMatrix< Scalar, n, n > Kaskade::unvectorize (Dune::FieldVector< Scalar, n *n > const &v)
 forming quadratic matrix columns of vector segments
template<class T, int n, int m>
T Kaskade::contraction (Dune::FieldMatrix< T, n, m > const &A, Dune::FieldMatrix< T, n, m > const &B)
 Matrix contraction (Frobenius product) \( (A,B) \mapsto A:B = \sum_{i,j} A_{ij} B_{ij} \).
template<class T, int n>
T Dune::trace (Dune::FieldMatrix< T, n, n > const &A)
 Matrix trace \( A \mapsto \mathrm{tr}\,A = \sum_{i} A_{ii} \).
template<class T, int n>
Dune::FieldVector< T, n > diag (Dune::FieldMatrix< T, n, n > const &A)
 Matrix diagonal as a vector.
template<class T, int n>
Dune::FieldMatrix< T, n, n > unitMatrix ()
 Returns the identity matrix of size n \( \mapsto I \).
template<class T>
Dune::FieldMatrix< T, 3, 3 > skewMatrix (Dune::FieldVector< T, 3 > v)
 Returns the skew symmetric matrix related to the cross product with (3d) vector v.
template<class T, int n>
Dune::FieldVector< T, n > unitVector (int i)
 Returns the unit vector \( e_i \) with \( (e_i)_k = \delta_{ik} \).
template<class MatrixZ, class Matrix>
void MatMult (MatrixZ &z, Matrix const &x, Matrix const &y)
 Computes Z = X*Y. X and Y need to be compatible, i.e. X.M()==Y.N() has to hold. No aliasing may occur, i.e. &Z != &X and &Z != &Y must hold. Z is reshaped as needed.
template<class B, class A, class OutIter>
OutIter Kaskade::vectorToSequence (Dune::BlockVector< B, A > const &v, OutIter iter)
 copies the entries of a vector sequentially to the output iterator.
template<class B, class A, class InIter>
InIter Kaskade::vectorFromSequence (Dune::BlockVector< B, A > &v, InIter in)
 copies the elements obtained from the input iterator sequentially to the entries of the vector.
template<class Index>
std::vector< std::vector< Index > > Kaskade::getBCRSIndicesFromTriplet (Index nrows, std::vector< Index > const &ridx, std::vector< Index > const &cidx, int nr=1, int nc=1)
 Sorts the sparse matrix nonzero positions into row buckets.
void Kaskade::DynamicMatrixDetail::gemm (bool transposeA, bool transposeB, int m, int n, int k, double alpha, double const *A, int lda, double const *B, int ldb, double beta, double *C, int ldc)
 computes \( C \leftarrow \alpha A B + \beta C \)
template<class T, int n, int m>
Dune::FieldMatrix< T, m, n > Kaskade::transpose (Dune::FieldMatrix< T, n, m > const &A)
 Matrix transposition \( A \mapsto A^T \).
template<class Entry, int n>
Dune::FieldMatrix< Entry, n, n > Kaskade::diag (Dune::FieldVector< Entry, n > const &d)
 Creates a fixed-size diagonal matrix from the given diagonal vector.
template<int n, class Entry, int m, class A>
Dune::BlockVector< Dune::FieldVector< Entry, n > > Kaskade::reshapeBlocks (Dune::BlockVector< Dune::FieldVector< Entry, m >, A > const &x)
 Reshapes a nested block vector to differen entry sizes.
template<class Scalar, int n, class Index = size_t>
NumaBCRSMatrix< Dune::FieldMatrix< Scalar, n, n >, Index > Kaskade::sparseUnitMatrix (Index N)
 creates a unit matrix in NUMA block compressed row storage format
template<class Scalar, int n, int m, class Index = size_t>
NumaBCRSMatrix< Dune::FieldMatrix< Scalar, n, m >, Index > Kaskade::sparseZeroMatrix (Index N, Index M)
 creates a zero matrix in NUMA block compressed row storage format
template<class Scalar>
void Kaskade::deleteLowerTriangle (std::vector< int > &ridx, std::vector< int > &cidx, std::vector< Scalar > &data)
 removes subdiagonal entries from the matrix entries stored in elementary triplet format
void umfpack_triplet_to_col (int rows, int cols, std::vector< long > const &ridx, std::vector< long > const &cidx, std::vector< double > const &values, std::vector< long > &Ap, std::vector< long > &Ai, std::vector< double > &Az)
 Triplet to compressed column storage conversion . This is just a frontent to DirectType::UMFPACK utility routines.
void umfpack_triplet_to_col (int rows, int cols, std::vector< int > const &ridx, std::vector< int > const &cidx, std::vector< double > const &values, std::vector< int > &Ap, std::vector< int > &Ai, std::vector< double > &Az)
 Triplet to compressed column storage conversion . This is just a frontent to DirectType::UMFPACK utility routines.
void umfpack_col_to_triplet (std::vector< long > const &Ap, std::vector< long > &Ti)
 Compressed column storage to triplet storage conversion. This is just a frontent to DirectType::UMFPACK utility routines.
void umfpack_col_to_triplet (std::vector< int > const &Ap, std::vector< int > &Ti)
 Compressed column storage to triplet storage conversion. This is just a frontent to DirectType::UMFPACK utility routines.
template<class Scalar, int n>
Dune::FieldVector< Scalar, n > Kaskade::orthogonalTo (Dune::FieldVector< Scalar, n > const &x)
 Find an (arbitrary) vector orthogonal to the given one.
template<int m, class Scalar, class Sequence>
auto const & component (LinearProductSpace< Scalar, Sequence > const &x)
 Provides access to the m-th component of a product space.
template<class X0, class ... Xs>
auto cartesianProduct (X0 const &x0, Xs const &... xs)
 Creates a cartesian product of the given vectors, i.e. a LinearProductSpace object.
template<class Scalar, class Seq, class OutIter>
OutIter vectorToSequence (LinearProductSpace< Scalar, Seq > const &v, OutIter i)
 writes the coefficients of a vector to a flat scalar sequence <Scalar,Seq>
template<class Scalar, class Seq, class InIter>
InIter vectorFromSequence (LinearProductSpace< Scalar, Seq > &v, InIter i)
 reads the coefficients of a vector from a flat scalar sequence <Scalar,Seq>
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 Entry>
DynamicMatrix< typename EntryTraits< Entry >::transpose_type > transpose (DynamicMatrix< Entry > const &A)
 Computes the transpose of a matrix \( A \mapsto A^T \).
template<class Entry>
std::tuple< DynamicMatrix< Dune::FieldMatrix< typename EntryTraits< Entry >::field_type, 1, 1 > >, std::vector< typename EntryTraits< Entry >::real_type >, DynamicMatrix< Dune::FieldMatrix< typename EntryTraits< Entry >::field_type, 1, 1 > > > svd (DynamicMatrix< Entry > const &A, bool fullU=true, bool fullV=true)
 Computes the singular value decomposition \( A = U \Sigma V^T \).
template<class Entry>
EntryTraits< Entry >::real_type two_norm (DynamicMatrix< Entry > const &A)
 Computes the spectral norm of the given matrix.
template<class Entry>
EntryTraits< Entry >::real_type condition (DynamicMatrix< Entry > const &A)
 Computes the condition number of the given square matrix.
template<class Scalar, int d>
bool makePositiveSemiDefinite (Dune::FieldMatrix< Scalar, d, d > &A)
 Computes a positive semi-definite approximation to \( A \) by cutting off negative eigenvalues.
template<class Entry>
bool makePositiveSemiDefinite (DynamicMatrix< Entry > &A, typename ScalarTraits< typename EntryTraits< Entry >::field_type >::Real threshold=0)
 Computes a positive semi-definite approximation to \( A \) by cutting off negative eigenvalues.
template<class MEntry, class VEntry>
auto operator* (DynamicMatrix< MEntry > const &A, Dune::DynamicVector< VEntry > const &x)
 matrix-vector product \( Ax \)
template<class MEntry, class VEntry>
auto operator* (DynamicMatrix< MEntry > const &A, Dune::BlockVector< VEntry > const &x)
 matrix-vector product \( Ax \)
template<class MEntry>
auto operator* (typename Dune::FieldTraits< DynamicMatrix< MEntry > >::field_type x, DynamicMatrix< MEntry > A)
 multiplication with scalar
template<class MEntry>
auto operator- (DynamicMatrix< MEntry > const &A)
 Multiplication with -1.
template<class MEntry>
auto operator- (DynamicMatrix< MEntry > A, DynamicMatrix< MEntry > const &B)
 matrix subtraction \( A-B \)
template<class MEntry>
auto operator+ (DynamicMatrix< MEntry > A, DynamicMatrix< MEntry > const &B)
 matrix addition \( A+B \)
template<class EntryA, class EntryB>
void matrixMatrixProduct (DynamicMatrix< EntryA > const &A, DynamicMatrix< EntryB > const &B, DynamicMatrix< typename DynamicMatrixDetail::ProductTraits< EntryA, EntryB >::type > &C)
 matrix-matrix product \( A B \)
template<class EntryA, class EntryB>
DynamicMatrix< typename DynamicMatrixDetail::ProductTraits< EntryA, EntryB >::type > operator* (DynamicMatrix< EntryA > const &A, DynamicMatrix< EntryB > const &B)
 matrix-matrix product \( A B \)
template<class MEntry>
DynamicMatrix< MEntry > submatrix (DynamicMatrix< MEntry > const &A, int rowstart, int rowend, int colstart, int colend)
 extracts contiguous submatrices, copying the data
template<class EntryA, class EntryB>
auto kron (DynamicMatrix< EntryA > const &A, DynamicMatrix< EntryB > const &B)
 Computes the Kronecker product of two matrices.
template<class EntryA, class EntryB>
auto horzcat (DynamicMatrix< EntryA > const &A, DynamicMatrix< EntryB > const &B)
 Concatenates two matrices horizontally.
template<class EntryX, class EntryY>
auto vertcat (Dune::DynamicVector< EntryX > const &x, Dune::DynamicVector< EntryY > const &y)
 Concatenes two (column) vectors vertically.
template<class Entry>
DynamicMatrix< Entry > vertcat (DynamicMatrix< Entry > const &A, DynamicMatrix< Entry > const &B)
 Concatenates two matrices vertically.
template<class Entry>
auto dynamicUnitMatrix (Entry const &d, int n)
 Returns the diagonal matrix with the given entry replicated on the diagonal.
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, int Size0, int ... Sizes>
Tensor< Entry, Size0, Sizes... > operator* (typename EntryTraits< Entry >::field_type a, Tensor< Entry, Size0, Sizes... > A)
 Scalar times tensor multiplication.
template<class Entry, int n>
Entry trace (Tensor< Entry, n, n > const &A)
 Trace of a square matrix-shaped tensor.
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

Variables

constexpr StaticIndexRange< 0, std::numeric_limits< int >::max()> _
 Convenience static range denoting the full available range, analogous to Matlab's :.
template<class T>
constexpr int Kaskade::rank = ScalarDetail::Rank<T>::value
 Reports the rank of vector, matrix, and tensor types of static size.

Detailed Description

Classes and functions for basic vector and matrix arithmetics.

Typedef Documentation

◆ Component

template<class Scalar_, class Seq>
template<int m, class LinearProductSpace>
using Component = typename LinearProductSpace::template Component<m>
related

The type of the m-th component of a product space.

Todo
: restrict this to actual instances of LinearProductSpace

Definition at line 476 of file linearspace.hh.

Function Documentation

◆ asMatrix()

template<int n, int m, class T>
Dune::FieldMatrix< T, n, m > Dune::asMatrix ( Dune::FieldVector< T, n *m > const & x)

Converts a vector of size nm to a matrix of size n x m by filling columns successively.

Definition at line 112 of file fixdune.hh.

◆ asVector()

template<class T, int n, int m>
Dune::FieldVector< T, n *m > Dune::asVector ( Dune::FieldMatrix< T, n, m > const & x)

Converts a matrix of size n x m to a vector of size n*m by concatenating all the columns.

Definition at line 98 of file fixdune.hh.

◆ cartesianProduct()

template<class X0, class ... Xs>
auto cartesianProduct ( X0 const & x0,
Xs const &... xs )
related

Creates a cartesian product of the given vectors, i.e. a LinearProductSpace object.

Definition at line 488 of file linearspace.hh.

◆ component()

template<int m, class Scalar, class Sequence>
auto const & component ( LinearProductSpace< Scalar, Sequence > const & x)
related

Provides access to the m-th component of a product space.

This simplifies the access to individual components of a product space, e.g., a variable set of finite element functions. Instead of

boost::fusion::at_c<m>(x.data)

one can write

auto const & component(LinearProductSpace< Scalar, Sequence > const &x)
Provides access to the m-th component of a product space.
Template Parameters
mthe index of the component (nonnegative)
Scalara scalar type
Sequencea boost::fusion sequence type
Returns
a reference to the m-th component

Definition at line 458 of file linearspace.hh.

◆ condition()

template<class Entry>
EntryTraits< Entry >::real_type condition ( DynamicMatrix< Entry > const & A)
related

Computes the condition number of the given square matrix.

For invertible matrices, the condition number is given as \( \kappa(A) = \|A\| \, \|A^{-1}\| \). For singular matrices, \( +\infty \) is returned.

Currently, the condition is computed via the signular value decomposition, and takes \( O(n^3) \) time.

Definition at line 877 of file dynamicMatrix.hh.

◆ conjugation()

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 )
related

Creates the conjugation product \( P^T A P\).

Note that for typical multigrid Galerkin projections the memory access patterns of the conjugation are quite bad for performance. Consider assembling the projected matrix directly on the coarser discretization.

Parameters
onlyLowerTriangle.If true, we will only touch the lower triangle of A and only create the lower triangle of the resulting matrix P^T A P
createDiagonal.If true, the diagonal of the result will be structurally nonzero, even if not resulting from the sparsity patterns of P and A.
Returns
the sparse matrix \( P^T A P \)

Definition at line 123 of file conjugation.hh.

◆ contraction()

template<class T, int n, int m>
T Kaskade::contraction ( Dune::FieldMatrix< T, n, m > const & A,
Dune::FieldMatrix< T, n, m > const & B )

◆ deleteLowerTriangle()

template<class Scalar>
void Kaskade::deleteLowerTriangle ( std::vector< int > & ridx,
std::vector< int > & cidx,
std::vector< Scalar > & data )

removes subdiagonal entries from the matrix entries stored in elementary triplet format

Definition at line 747 of file triplet.hh.

◆ diag() [1/2]

template<class T, int n>
Dune::FieldVector< T, n > diag ( Dune::FieldMatrix< T, n, n > const & A)

Matrix diagonal as a vector.

Definition at line 493 of file fixdune.hh.

Referenced by dstev().

◆ diag() [2/2]

template<class Entry, int n>
Dune::FieldMatrix< Entry, n, n > Kaskade::diag ( Dune::FieldVector< Entry, n > const & d)

Creates a fixed-size diagonal matrix from the given diagonal vector.

Definition at line 351 of file dynamicMatrixOps.hh.

Referenced by Kaskade::CGBase< X, Xstar, CGImplementationType::STANDARD, TimerPolicy >::cond(), and Kaskade::CG_Detail::stev().

◆ diagcat()

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 )
related

concatenate two matrices diagonally, resulting matrix is zero on the off block-diagonal

Requires the matrices to have same number of entry types of Dune::FieldMatrix<double,blockrows,blockcols>

Parameters
ANumaBRCSMatrix, first submatrix (top left)
BNumaBRCSMatrix, second matrix (bottom right)

Definition at line 2132 of file threadedMatrix.hh.

◆ dynamicUnitMatrix()

template<class Entry>
auto dynamicUnitMatrix ( Entry const & d,
int n )
related

Returns the diagonal matrix with the given entry replicated on the diagonal.

In order to obtain a unit matrix with m by m unit matrix entries on the diagonal, use

Dune::FieldMatrix< T, n, n > unitMatrix()
Returns the identity matrix of size n .
Definition fixdune.hh:506
auto dynamicUnitMatrix(Entry const &d, int n)
Returns the diagonal matrix with the given entry replicated on the diagonal.

Definition at line 334 of file dynamicMatrixOps.hh.

◆ eraseCols()

template<class Target, class Source, class ColIndices>
Target eraseCols ( Source const & A,
ColIndices const & ci )
related

"deletes" columns by extracting a copy of the matrix keeping only the non-deleted columns.

Template Parameters
Targetthe target matrix format , usually Dune::BCRSMatrix.
Sourcethe source matrix, usually Dune::BCRSMatrix or NumaBCRSMatrix.
ColIndicesan STL sequence type

Definition at line 1929 of file threadedMatrix.hh.

◆ eraseRows()

template<class Target, class Source, class RowIndices>
Target eraseRows ( Source const & A,
RowIndices const & ri )
related

"deletes" rows by extracting a copy of the matrix keeping only the non-deleted rows.

Template Parameters
Targetthe target matrix format , usually Dune::BCRSMatrix.
Sourcethe source matrix, usually Dune::BCRSMatrix or NumaBCRSMatrix.
RowIndicesan STL sequence type

Definition at line 1909 of file threadedMatrix.hh.

◆ eraseRowsNCols()

template<class Target, class Source, class RowIndices, class ColIndices>
Target eraseRowsNCols ( Source const & A,
RowIndices const & ri,
ColIndices const & ci )
related

"deletes" rows/columns by extracting a copy of the matrix keeping the non-deleted rows/columns.

Template Parameters
Targetthe target matrix format , usually Dune::BCRSMatrix.
Sourcethe source matrix, usually Dune::BCRSMatrix or NumaBCRSMatrix.
RowIndicesan STL sequence type
ColIndicesan STL sequence type

Definition at line 1878 of file threadedMatrix.hh.

◆ full() [1/2]

template<class SparseMatrix>
DynamicMatrix< typename SparseMatrix::block_type > full ( SparseMatrix const & A)
related

Converts a sparse NumaBCRSMatrix to a dense matrix.

Be aware that, depending on the number of nonzeros in the sparse matrix, the memory requirement of the dense matrix may be much higher. Use this only for matrices up to 1000x1000, and rather less.

Definition at line 1713 of file threadedMatrix.hh.

◆ full() [2/2]

template<class SparseMatrix, class RowRange, class ColRange>
DynamicMatrix< typename SparseMatrix::block_type > full ( SparseMatrix const & A,
RowRange const & rows,
ColRange const & cols )
related

Converts a subrange of a sparse matrix to a dense matrix.

This is equivalent to Matlab's full(A(rows,cols)) (except that we index 0-based).

Template Parameters
SparseMatrixa sparse matrix type adhering to the Dune::BCRSMatrix interface (e.g., NumaBCRSMatrix)
Parameters
rowsan STL range of row indices
colsan STL range of column indices

The row and column index ranges need not be sorted, but cols must not contain duplicates.

Be aware that, depending on the number of nonzeros in the sparse matrix, the memory requirement of the dense matrix may be much higher. Use this only for matrices up to 1000x1000, and rather less.

Definition at line 1740 of file threadedMatrix.hh.

◆ gemm()

void Kaskade::DynamicMatrixDetail::gemm ( bool transposeA,
bool transposeB,
int m,
int n,
int k,
double alpha,
double const * A,
int lda,
double const * B,
int ldb,
double beta,
double * C,
int ldc )

computes \( C \leftarrow \alpha A B + \beta C \)

\( A\in\R^{m\times k}, B\in\R^{k\times n}, C\in\R^{m\times n} \)

◆ getBCRSIndicesFromTriplet()

template<class Index>
std::vector< std::vector< Index > > Kaskade::getBCRSIndicesFromTriplet ( Index nrows,
std::vector< Index > const & ridx,
std::vector< Index > const & cidx,
int nr = 1,
int nc = 1 )

Sorts the sparse matrix nonzero positions into row buckets.

From the row and column indices of a sparse matrix with scalar entries, e.g., in triplet format, obtain the row and column indices of a sparse matrix with nr-by-nc block-entries, as in Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,nr,nc>>. The indices are stored by row.

Parameters
nrowsnumber of rows of BCRS target matrix (i.e. rows of triplet source / nr)
ridxvector of row indices
cidxvector of column indices
nrrow size of sparse matrix entries
nccolumn size of sparse matrix entries

Definition at line 440 of file crsutil.hh.

Referenced by Kaskade::AssemblyDetail::Fill< Dune::BCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Allocator > >::apply().

◆ horzcat() [1/3]

template<class EntryA, class EntryB>
auto horzcat ( DynamicMatrix< EntryA > const & A,
DynamicMatrix< EntryB > const & B )
related

Concatenates two matrices horizontally.

A and B must have the same number of scalar rows.

Definition at line 285 of file dynamicMatrixOps.hh.

◆ horzcat() [2/3]

template<class Scalar, int n, class ... Rest>
auto Kaskade::horzcat ( Dune::FieldVector< Scalar, n > const & a,
Rest ... rest )

Concatenates an arbitrary number of column vectors and matrices with coinciding number of rows to a larger matrix.

This works as Matlab's [x,y,z] construction.

Definition at line 304 of file fixdune.hh.

◆ horzcat() [3/3]

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 )
related

concatenate two matrices horizontally

Requires the matrices to have same number of rows and entry types of Dune::FieldMatrix<Scalar,blockrows,blockcols>

Parameters
ANumaBRCSMatrix, first submatrix (left)
BNumaBRCSMatrix, second matrix (right)

Definition at line 2039 of file threadedMatrix.hh.

◆ kron()

template<class EntryA, class EntryB>
auto kron ( DynamicMatrix< EntryA > const & A,
DynamicMatrix< EntryB > const & B )
related

Computes the Kronecker product of two matrices.

kron(A,B) with \( A\in \mathbf{R}^{n_a\times m_a} \) and \( B\in \mathbf{R}^{n_b\times m_b} \) computes a block matrix \( C \in\mathbf{R}^{n_a n_b \times m_a m_b}\) with \( n_b \times m_b \) blocks such that the \( (i,j)\)-block is \( A_{ij} B \). This is compatible with Matlab's kron function.

The entry types of A and B must be multiplicable.

Definition at line 206 of file dynamicMatrixOps.hh.

◆ makePositiveSemiDefinite() [1/2]

template<class Scalar, int d>
bool makePositiveSemiDefinite ( Dune::FieldMatrix< Scalar, d, d > & A)
related

Computes a positive semi-definite approximation to \( A \) by cutting off negative eigenvalues.

\( A \) has to be symmetric.

◆ makePositiveSemiDefinite() [2/2]

template<class Entry>
bool makePositiveSemiDefinite ( DynamicMatrix< Entry > & A,
typename ScalarTraits< typename EntryTraits< Entry >::field_type >::Real threshold = 0 )
related

Computes a positive semi-definite approximation to \( A \) by cutting off negative eigenvalues.

\( A \) has to be symmetric.

◆ MatMult()

template<class MatrixZ, class Matrix>
void MatMult ( MatrixZ & z,
Matrix const & x,
Matrix const & y )

Computes Z = X*Y. X and Y need to be compatible, i.e. X.M()==Y.N() has to hold. No aliasing may occur, i.e. &Z != &X and &Z != &Y must hold. Z is reshaped as needed.

Definition at line 565 of file fixdune.hh.

Referenced by Kaskade::TransferData< Space, CoarseningPolicy >::transferMatrix().

◆ matrixMatrixProduct()

template<class EntryA, class EntryB>
void matrixMatrixProduct ( DynamicMatrix< EntryA > const & A,
DynamicMatrix< EntryB > const & B,
DynamicMatrix< typename DynamicMatrixDetail::ProductTraits< EntryA, EntryB >::type > & C )
related

matrix-matrix product \( A B \)

Warning
this creates a temporary

Definition at line 123 of file dynamicMatrixOps.hh.

◆ max()

template<class T, int n>
Dune::FieldVector< T, n > Dune::max ( Dune::FieldVector< T, n > x,
Dune::FieldVector< T, n > const & y )

Componentwise maximum.

Definition at line 73 of file fixdune.hh.

Referenced by Kaskade::boundingBox(), and Kaskade::maxOrder().

◆ min()

template<class T, int n>
Dune::FieldVector< T, n > Dune::min ( Dune::FieldVector< T, n > x,
Dune::FieldVector< T, n > const & y )

Componentwise minimum.

Definition at line 85 of file fixdune.hh.

Referenced by Kaskade::boundingBox().

◆ nonZeroColumns()

template<class Source>
std::vector< size_t > nonZeroColumns ( Source const & A)
related

returns all indices of nonzero columns.

Template Parameters
Sourcethe source matrix, usually Dune::BCRSMatrix or NumaBCRSMatrix.

Definition at line 1948 of file threadedMatrix.hh.

◆ normalize()

template<class T, int n>
Dune::FieldVector< T, n > Dune::normalize ( Dune::FieldVector< T, n > x)

returns the normalized vector

Definition at line 141 of file fixdune.hh.

◆ operator*() [1/7]

template<class T, class S, int n, int m>
Dune::FieldVector< S, n > Dune::operator* ( Dune::FieldMatrix< T, n, m > const & A,
Dune::FieldVector< S, m > const & x )

Matrix-vector multiplication \( (A,x) \mapsto Ax \).

Definition at line 227 of file fixdune.hh.

◆ operator*() [2/7]

template<class EntryA, class EntryB>
DynamicMatrix< typename DynamicMatrixDetail::ProductTraits< EntryA, EntryB >::type > operator* ( DynamicMatrix< EntryA > const & A,
DynamicMatrix< EntryB > const & B )
related

matrix-matrix product \( A B \)

Warning
this creates a new matrix. If a target matrix \( C \) already exists, consider using matrixMatrixProduct(A,B,C) for performance reasons. Remember, though, that the product takes O(n^3) time, whereas the matrix allocation and copy takes O(n^2) time. For sufficiently large matrices, the extra allocation/copy overhead will be negligible.

Definition at line 155 of file dynamicMatrixOps.hh.

◆ operator*() [3/7]

template<class MEntry, class VEntry>
auto operator* ( DynamicMatrix< MEntry > const & A,
Dune::BlockVector< VEntry > const & x )
related

matrix-vector product \( Ax \)

Warning
This creates a new vector that is returned. For in-place computation with existing target vector, consider using A.mv(x,y), which offers higher performance.

Definition at line 51 of file dynamicMatrixOps.hh.

◆ operator*() [4/7]

template<class MEntry, class VEntry>
auto operator* ( DynamicMatrix< MEntry > const & A,
Dune::DynamicVector< VEntry > const & x )
related

matrix-vector product \( Ax \)

Warning
This creates a new vector that is returned. For in-place computation with existing target vector, consider using A.mv(x,y), which offers higher performance.

Definition at line 34 of file dynamicMatrixOps.hh.

◆ operator*() [5/7]

template<class MEntry>
auto operator* ( typename Dune::FieldTraits< DynamicMatrix< MEntry > >::field_type x,
DynamicMatrix< MEntry > A )
related

multiplication with scalar

Definition at line 65 of file dynamicMatrixOps.hh.

◆ operator*() [6/7]

template<class EntryA, class EntryB, class IndexA, class IndexB>
auto operator* ( NumaBCRSMatrix< EntryA, IndexA > const & A,
NumaBCRSMatrix< EntryB, IndexB > const & B )
related

Computes the matrix-matrix product \( (A,B) \mapsto AB \).

Template Parameters
EntryAthe type of entries of matrix A. Usually Dune::FieldMatrix<Real,na,ma>.
EntryBthe type of entries of matrix B. Usually Dune::FieldMatrix<Real,nb,mb>.

As matrix entries \( A_{ij} B_{jk}\) have to be multiplied, the entry size must be compatible, i.e. ma==nb. As an extension, if entries of A or B are scalar (i.e. na==ma==1), we treat them implicitly as multiples of the unit matrix of compatible size.

Definition at line 37 of file matrixProduct.hh.

◆ operator*() [7/7]

template<class Entry, int Size0, int ... Sizes>
Tensor< Entry, Size0, Sizes... > operator* ( typename EntryTraits< Entry >::field_type a,
Tensor< Entry, Size0, Sizes... > A )
related

Scalar times tensor multiplication.

Definition at line 281 of file tensor.hh.

◆ operator+() [1/3]

template<class T, int n>
Dune::FieldVector< T, n > Dune::operator+ ( Dune::FieldVector< T, n > x,
Dune::FieldVector< T, n > const & y )

Vector addition \( (x,y) \mapsto x+y \).

Definition at line 50 of file fixdune.hh.

◆ operator+() [2/3]

template<class MEntry>
auto operator+ ( DynamicMatrix< MEntry > A,
DynamicMatrix< MEntry > const & B )
related

matrix addition \( A+B \)

Definition at line 109 of file dynamicMatrixOps.hh.

◆ operator+() [3/3]

template<class Entry, class Index, class Index2>
NumaBCRSMatrix< Entry, Index > operator+ ( NumaBCRSMatrix< Entry, Index > const & A,
NumaBCRSMatrix< Entry, Index2 > const & B )
related

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.

Definition at line 1784 of file threadedMatrix.hh.

◆ operator-() [1/4]

template<class T, int n, int m>
Dune::FieldMatrix< T, n, m > Dune::operator- ( Dune::FieldMatrix< T, n, m > const & A)

Matrix negation \( A \mapsto - A \).

Definition at line 243 of file fixdune.hh.

◆ operator-() [2/4]

template<class T, int n>
Dune::FieldVector< T, n > Dune::operator- ( Dune::FieldVector< T, n > x)

Vector negation \( x \mapsto - x \).

Definition at line 61 of file fixdune.hh.

◆ operator-() [3/4]

template<class MEntry>
auto operator- ( DynamicMatrix< MEntry > A,
DynamicMatrix< MEntry > const & B )
related

matrix subtraction \( A-B \)

Definition at line 93 of file dynamicMatrixOps.hh.

◆ operator-() [4/4]

template<class MEntry>
auto operator- ( DynamicMatrix< MEntry > const & A)
related

Multiplication with -1.

Definition at line 82 of file dynamicMatrixOps.hh.

◆ operator<<()

template<class Entry, class Index>
std::ostream & operator<< ( std::ostream & out,
NumaBCRSMatrix< Entry, Index > const & A )
related

Writes a NumaBCRSMatrix to an output stream.

The matrix is written as text in triplet format, one scalar entry per row.

Definition at line 1683 of file threadedMatrix.hh.

◆ orthogonalTo()

template<class Scalar, int n>
Dune::FieldVector< Scalar, n > Kaskade::orthogonalTo ( Dune::FieldVector< Scalar, n > const & x)

Find an (arbitrary) vector orthogonal to the given one.

Definition at line 52 of file vectorOps.hh.

◆ outerProduct()

template<class T, int n, int m>
Dune::FieldMatrix< T, n, m > Dune::outerProduct ( Dune::FieldVector< T, n > const & x,
Dune::FieldVector< T, m > const & y )

outer vector product \( (x,y) \mapsto x y^T \).

Definition at line 127 of file fixdune.hh.

◆ projectToUnitSimplex()

template<class CoordType, int dim, std::enable_if_t< std::is_floating_point_v< CoordType >, int > = 0>
Dune::FieldVector< CoordType, dim > Kaskade::projectToUnitSimplex ( Dune::FieldVector< CoordType, dim > x)

Projects a vector onto the unit simplex.

Definition at line 64 of file barycentric.hh.

◆ reshapeBlocks() [1/2]

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)
related

reshapes NumaBRCSMAtrix entry block structure

Converts a NumaBCRSMAtrix with entry-type Dune::FieldMatrix<Scalar,row1,col1> to entry type Dune::FieldMatrix<Scalar,row2,col2>, i.e. the size of the contained blocks are reshaped. Row size row1 must be divisible by row2 and column size col1 must be divisible by col2.

Template Parameters
row1number of rows in input block
col1number of columns in input block
row2desired number of block-rows
col2desired number of column-rows
Parameters
ANumaBRCSMatrix whose entry-type is to be reshaped

Definition at line 1986 of file threadedMatrix.hh.

◆ reshapeBlocks() [2/2]

template<int n, class Entry, int m, class A>
Dune::BlockVector< Dune::FieldVector< Entry, n > > Kaskade::reshapeBlocks ( Dune::BlockVector< Dune::FieldVector< Entry, m >, A > const & x)

Reshapes a nested block vector to differen entry sizes.

Use this to convert a vector [[1,2],[3,4]] to [1,2,3,4] or [[1],[2],[3],[4]].

Template Parameters
nthe static block size of the nested result vector
Entrythe type of entries in the nested vector
mthe static length of the nested source vector
Parameters
xa nested dynamic block vector

n and x must be compatible, i.e. there must be some integer S such that n*S = m*N, where N is the size of the given block vector.

Definition at line 45 of file reshape.hh.

◆ skewMatrix()

template<class T>
Dune::FieldMatrix< T, 3, 3 > skewMatrix ( Dune::FieldVector< T, 3 > v)

Returns the skew symmetric matrix related to the cross product with (3d) vector v.

Definition at line 519 of file fixdune.hh.

◆ sparseUnitMatrix()

template<class Scalar, int n, class Index = size_t>
NumaBCRSMatrix< Dune::FieldMatrix< Scalar, n, n >, Index > Kaskade::sparseUnitMatrix ( Index N)

creates a unit matrix in NUMA block compressed row storage format

The entries are fixed-dimensional unit matrices.

Template Parameters
Scalarthe field type of entries
ndimension of the entries
Parameters
Nthe size of the matrix to create (N blocks of size n each)

Definition at line 1817 of file threadedMatrix.hh.

Referenced by makeJointPstack().

◆ sparseZeroMatrix()

template<class Scalar, int n, int m, class Index = size_t>
NumaBCRSMatrix< Dune::FieldMatrix< Scalar, n, m >, Index > Kaskade::sparseZeroMatrix ( Index N,
Index M )

creates a zero matrix in NUMA block compressed row storage format

This is an empty sparsity pattern - all entries are structurally zero.

Template Parameters
Scalarthe field type of entries
ndimension of the entries
Parameters
N,Mthe size of the matrix to create (NxM blocks of size n each)

Definition at line 1841 of file threadedMatrix.hh.

◆ submatrix() [1/2]

template<class MEntry>
DynamicMatrix< MEntry > submatrix ( DynamicMatrix< MEntry > const & A,
int rowstart,
int rowend,
int colstart,
int colend )
related

extracts contiguous submatrices, copying the data

The submatrix is defined by half-open row and column ranges.

Definition at line 178 of file dynamicMatrixOps.hh.

◆ submatrix() [2/2]

template<class Target, class Source, class RowIndices, class ColIndices>
Target submatrix ( Source const & A,
RowIndices const & ri,
ColIndices const & ci )
related

extracts a sparse or dense submatrix of \( A \)

This works as Matlab's A(ri,ci) submatrix extraction.

Template Parameters
Targetthe target matrix format, usually Dune::BCRSMatrix, NumaBCRSMatrix, or DynamicMatrix.
Sourcethe source matrix, usually Dune::BCRSMatrix or NumaBCRSMatrix.
RowIndicesan STL sequence type
ColIndicesan STL sequence type

Complexity

For target Dune::BCRSMatrix, the complexity is \( n_r n_c \log n_s \), where \( n_r \) is the size of ri, \( n_c \) the size of ci, and \( n_s \) the number of nonzeros per row in A.

Definition at line 183 of file matrixOps.hh.

Referenced by Kaskade::NumaBCRSMatrix< Dune::FieldMatrix< Scalar, 1, 1 >, Index >::operator()().

◆ svd()

template<class Entry>
std::tuple< DynamicMatrix< Dune::FieldMatrix< typename EntryTraits< Entry >::field_type, 1, 1 > >, std::vector< typename EntryTraits< Entry >::real_type >, DynamicMatrix< Dune::FieldMatrix< typename EntryTraits< Entry >::field_type, 1, 1 > > > svd ( DynamicMatrix< Entry > const & A,
bool fullU = true,
bool fullV = true )
related

Computes the singular value decomposition \( A = U \Sigma V^T \).

If \( A \) is a \( n \times m \) matrix, then the SVD computes orthonormal \( U, V \) of size \( n\times n \) and \( m\times m\), respectively, and a \( n\times m\) matrix \( \Sigma \) with only nonnegative diagonal entries. Let \( k := \min(n,m) \).

Parameters
Athe matrix to be factored
fullUif true, \( U \) is returned as a full \( n\times n\) matrix, otherwise only the first \( k \) columns corresponding to the first \( k \) left singular vectors are returned as a \( n\times k\) matrix.
fullVif true, \( V \) is returned as a full \( m\times m\) matrix, otherwise only the first \( k \) columns corresponding to the first \( k \) right singular vectors are returned as a \( m\times k\) matrix.
Returns
the tuple (U,sigma,V), where sigma is a std::vector of the \( \min(n,m) \) real-valued diagonal entries of \( \Sigma \).

Definition at line 840 of file dynamicMatrix.hh.

◆ trace() [1/2]

template<class T, int n>
T Dune::trace ( Dune::FieldMatrix< T, n, n > const & A)

Matrix trace \( A \mapsto \mathrm{tr}\,A = \sum_{i} A_{ii} \).

Note: Instead of trace(A*B) use the equivalent, but faster contraction(A,B).

Definition at line 478 of file fixdune.hh.

◆ trace() [2/2]

template<class Entry, int n>
Entry trace ( Tensor< Entry, n, n > const & A)
related

Trace of a square matrix-shaped tensor.

Definition at line 295 of file tensor.hh.

◆ transpose() [1/3]

template<class Entry>
DynamicMatrix< typename EntryTraits< Entry >::transpose_type > transpose ( DynamicMatrix< Entry > const & A)
related

Computes the transpose of a matrix \( A \mapsto A^T \).

This is a deep transpose, i.e. if the entries are non-scalar, they are transposed, too.

Warning
this creates a temporary

Definition at line 790 of file dynamicMatrix.hh.

Referenced by Kaskade::DynamicMatrix< Dune::FieldMatrix< Scalar, 1, 1 > >::usmtv().

◆ transpose() [2/3]

template<class Entry, class Index>
auto transpose ( NumaBCRSMatrix< Entry, Index > const & A)
related

Creates the transposed sparse matrix \( A^T \).

Definition at line 1855 of file threadedMatrix.hh.

◆ transpose() [3/3]

template<class T, int n, int m>
Dune::FieldMatrix< T, m, n > Kaskade::transpose ( Dune::FieldMatrix< T, n, m > const & A)

Matrix transposition \( A \mapsto A^T \).

This is a deep transpose, i.e. if the entries are non-scalar, they are transposed, too.

Definition at line 771 of file dynamicMatrix.hh.

◆ two_norm()

template<class Entry>
EntryTraits< Entry >::real_type two_norm ( DynamicMatrix< Entry > const & A)
related

Computes the spectral norm of the given matrix.

This computes \( \max_{\|v\|_2=1} \|Av\|_2 \).

Todo
Currently, the norm is computed inefficiently via the signular value decomposition, and takes \( O(n^3) \) time. Consider implementing a power iteration.

Definition at line 857 of file dynamicMatrix.hh.

◆ umfpack_col_to_triplet() [1/2]

void umfpack_col_to_triplet ( std::vector< int > const & Ap,
std::vector< int > & Ti )

Compressed column storage to triplet storage conversion. This is just a frontent to DirectType::UMFPACK utility routines.

◆ umfpack_col_to_triplet() [2/2]

void umfpack_col_to_triplet ( std::vector< long > const & Ap,
std::vector< long > & Ti )

Compressed column storage to triplet storage conversion. This is just a frontent to DirectType::UMFPACK utility routines.

Referenced by Kaskade::MatrixAsTriplet< Scalar, SparseIndexInt >::operator+=(), and Kaskade::MatrixAsTriplet< Scalar, SparseIndexInt >::operator-=().

◆ umfpack_triplet_to_col() [1/2]

void umfpack_triplet_to_col ( int rows,
int cols,
std::vector< int > const & ridx,
std::vector< int > const & cidx,
std::vector< double > const & values,
std::vector< int > & Ap,
std::vector< int > & Ai,
std::vector< double > & Az )

Triplet to compressed column storage conversion . This is just a frontent to DirectType::UMFPACK utility routines.

◆ umfpack_triplet_to_col() [2/2]

void umfpack_triplet_to_col ( int rows,
int cols,
std::vector< long > const & ridx,
std::vector< long > const & cidx,
std::vector< double > const & values,
std::vector< long > & Ap,
std::vector< long > & Ai,
std::vector< double > & Az )

Triplet to compressed column storage conversion . This is just a frontent to DirectType::UMFPACK utility routines.

Parameters
rowsnumber of rows
colsnumber of columns
[in]ridxrow indices of matrix entries
[in]cidxcolumn indices of matrix entries
[in]valuesmatrix entries
[out]Apcolumn start array
[out]Airow indices
[out]Azmatrix entries

The output arrays

  • Ap,
  • Ai, and
  • Az are resized as needed.

Referenced by Kaskade::BoomerAMG< Op >::BoomerAMG(), Kaskade::Euclid< Op >::Euclid(), Kaskade::MatrixAsTriplet< Scalar, SparseIndexInt >::operator+=(), and Kaskade::MatrixAsTriplet< Scalar, SparseIndexInt >::operator-=().

◆ unitMatrix()

◆ unitVector()

template<class T, int n>
Dune::FieldVector< T, n > unitVector ( int i)

Returns the unit vector \( e_i \) with \( (e_i)_k = \delta_{ik} \).

Definition at line 536 of file fixdune.hh.

◆ unvectorize()

template<int n, class Scalar>
Dune::FieldMatrix< Scalar, n, n > Kaskade::unvectorize ( Dune::FieldVector< Scalar, n *n > const & v)

forming quadratic matrix columns of vector segments

Definition at line 438 of file fixdune.hh.

◆ vectorFromSequence() [1/2]

template<class Scalar, class Seq, class InIter>
InIter vectorFromSequence ( LinearProductSpace< Scalar, Seq > & v,
InIter i )
related

reads the coefficients of a vector from a flat scalar sequence <Scalar,Seq>

Definition at line 515 of file linearspace.hh.

Referenced by Kaskade::LinearProductSpace< Scalar, Functions >::read().

◆ vectorFromSequence() [2/2]

template<class B, class A, class InIter>
InIter Kaskade::vectorFromSequence ( Dune::BlockVector< B, A > & v,
InIter in )

copies the elements obtained from the input iterator sequentially to the entries of the vector.

The value type of the input iterator must be convertible to the scalar entries of the vector. The input iterator is advanced by the number of scalar entries in the vector.

Definition at line 127 of file crsutil.hh.

◆ vectorize()

template<class Scalar, int n>
Dune::FieldVector< Scalar, n *n > Kaskade::vectorize ( Dune::FieldMatrix< Scalar, n, n > const & A)

matrix entries as vector, concatenating columns

Definition at line 422 of file fixdune.hh.

◆ vectorProduct() [1/2]

template<class T>
T Dune::vectorProduct ( Dune::FieldVector< T, 2 > const & x,
Dune::FieldVector< T, 2 > const & y )

vector product \( (x,y) \mapsto x \times y \in \mathbb{R} \).

Definition at line 172 of file fixdune.hh.

◆ vectorProduct() [2/2]

template<class T>
Dune::FieldVector< T, 3 > Dune::vectorProduct ( Dune::FieldVector< T, 3 > const & x,
Dune::FieldVector< T, 3 > const & y )

vector product \( (x,y) \mapsto x \times y \).

Definition at line 194 of file fixdune.hh.

◆ vectorProductMatrix() [1/2]

template<class T>
Dune::FieldMatrix< T, 1, 2 > Dune::vectorProductMatrix ( Dune::FieldVector< T, 2 > const & x)

the matrix \( A(x) \in \mathbb{R}^{1\times 2}\) satisfying \( A(x) b = x\times b \) for all \( b \)

Definition at line 182 of file fixdune.hh.

◆ vectorProductMatrix() [2/2]

template<class T>
Dune::FieldMatrix< T, 3, 3 > Dune::vectorProductMatrix ( Dune::FieldVector< T, 3 > const & x)

the skew-symmetric matrix \( A(x)\in \mathbb{R}^{3\times 3} \) satisfying \( A(x) b = x\times b \) for all \( b \)

Definition at line 207 of file fixdune.hh.

◆ vectorToSequence() [1/2]

template<class Scalar, class Seq, class OutIter>
OutIter vectorToSequence ( LinearProductSpace< Scalar, Seq > const & v,
OutIter i )
related

writes the coefficients of a vector to a flat scalar sequence <Scalar,Seq>

Definition at line 503 of file linearspace.hh.

Referenced by Kaskade::LinearProductSpace< Scalar, Functions >::write().

◆ vectorToSequence() [2/2]

template<class B, class A, class OutIter>
OutIter Kaskade::vectorToSequence ( Dune::BlockVector< B, A > const & v,
OutIter iter )

copies the entries of a vector sequentially to the output iterator.

The Vector type can be Dune::BlockVector<B,A>, Dune::FieldVector<K,size>, or a finite element function. The type of the scalar entries of the vector must be convertible to the value type of the output iterator.

Definition at line 76 of file crsutil.hh.

◆ vertcat() [1/4]

template<class T, int n, int m>
Dune::FieldVector< T, n+m > Dune::vertcat ( Dune::FieldVector< T, n > const & x,
Dune::FieldVector< T, m > const & y )

Concatenation of vectors.

Definition at line 154 of file fixdune.hh.

◆ vertcat() [2/4]

template<class EntryX, class EntryY>
auto vertcat ( Dune::DynamicVector< EntryX > const & x,
Dune::DynamicVector< EntryY > const & y )
related

Concatenes two (column) vectors vertically.

Definition at line 296 of file dynamicMatrixOps.hh.

◆ vertcat() [3/4]

template<class Entry>
DynamicMatrix< Entry > vertcat ( DynamicMatrix< Entry > const & A,
DynamicMatrix< Entry > const & B )
related

Concatenates two matrices vertically.

A and B must have the same number of columns.

Definition at line 309 of file dynamicMatrixOps.hh.

◆ vertcat() [4/4]

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 )
related

concatenate two matrices vertically

Requires the matrices to have same number of rows and entry types of Dune::FieldMatrix<Scalar,blockrows,blockcols>

Parameters
ANumaBRCSMatrix, first submatrix (top)
BNumaBRCSMatrix, second matrix (bottom)

Definition at line 2086 of file threadedMatrix.hh.

Variable Documentation

◆ _

StaticIndexRange<0,std::numeric_limits<int>::max()> _
constexpr

Convenience static range denoting the full available range, analogous to Matlab's :.

Use this to take complete dimensions when slicing tensors:

Tensor<double,2,2,2> t(0.0);
using TensorAccess::_;
std::cout << "vector is " << t(_,_,1);
constexpr StaticIndexRange< 0, std::numeric_limits< int >::max()> _
Convenience static range denoting the full available range, analogous to Matlab's :.
Definition tensor.hh:74

Definition at line 74 of file tensor.hh.

Referenced by Kaskade::writeMarc().

◆ rank

template<class T>
int Kaskade::rank = ScalarDetail::Rank<T>::value
constexpr

Reports the rank of vector, matrix, and tensor types of static size.

Definition at line 153 of file scalar.hh.

Referenced by Kaskade::BDDC::MpiNodeTopology::configure(), horzcat(), horzcat(), and Kaskade::BDDC::MpiRoutingTraffic::printGlobal().