Dune Core Modules (unstable)
scaledidmatrix.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
144 typedef ContainerWrapperIterator<const WrapperType, const_reference, const_reference> ConstIterator;
235 return ScaledIdentityMatrix<typename PromotionTraits<K,Scalar>::PromotedType, n>{matrix.scalar()*scalar};
243 return ScaledIdentityMatrix<typename PromotionTraits<Scalar,K>::PromotedType, n>{scalar*matrix.scalar()};
Iterator class for sparse vector-like containers.
Definition: diagonalmatrix.hh:1078
A multiple of the identity matrix of static size.
Definition: scaledidmatrix.hh:42
void usmhv(const K &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition: scaledidmatrix.hh:448
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition: scaledidmatrix.hh:400
ScaledIdentityMatrix & operator-=(const ScaledIdentityMatrix &y)
Vector space subtraction.
Definition: scaledidmatrix.hh:190
const_row_type::ConstIterator ConstColIterator
rename the iterators for easier access
Definition: scaledidmatrix.hh:150
ConstIterator end() const
end iterator
Definition: scaledidmatrix.hh:159
static constexpr std::integral_constant< size_type, n > rows
The number of matrix rows.
Definition: scaledidmatrix.hh:73
bool operator!=(const ScaledIdentityMatrix &other) const
Test for inequality.
Definition: scaledidmatrix.hh:322
void mmv(const X &x, Y &y) const
y -= A x
Definition: scaledidmatrix.hh:388
std::size_t size_type
The type used for the indices and sizes.
Definition: scaledidmatrix.hh:55
void usmv(const K &alpha, const X &x, Y &y) const
y += alpha A x
Definition: scaledidmatrix.hh:424
row_type::Iterator ColIterator
rename the iterators for easier access
Definition: scaledidmatrix.hh:114
void mv(const X &x, Y &y) const
y = A x
Definition: scaledidmatrix.hh:333
void umtv(const X &x, Y &y) const
y += A^T x
Definition: scaledidmatrix.hh:364
void umhv(const X &x, Y &y) const
y += A^H x
Definition: scaledidmatrix.hh:376
DiagonalRowVector< K, n > row_type
Type of a single matrix row.
Definition: scaledidmatrix.hh:65
ContainerWrapperIterator< const WrapperType, reference, reference > Iterator
Iterator class for sequential access.
Definition: scaledidmatrix.hh:108
K determinant() const
Calculates the determinant of this matrix.
Definition: scaledidmatrix.hh:514
K field_type
The type representing numbers.
Definition: scaledidmatrix.hh:49
void usmtv(const K &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition: scaledidmatrix.hh:436
Iterator iterator
typedef for stl compliant access
Definition: scaledidmatrix.hh:110
static constexpr std::integral_constant< size_type, n > cols
The number of matrix columns.
Definition: scaledidmatrix.hh:76
const K & scalar() const
Get const reference to the scalar diagonal value.
Definition: scaledidmatrix.hh:583
friend auto operator+(const FieldMatrix< OtherScalar, n, n > &fieldMatrix, const ScaledIdentityMatrix &matrix)
Addition of ScaledIdentityMatrix to FieldMatrix.
Definition: scaledidmatrix.hh:261
void umv(const X &x, Y &y) const
y += A x
Definition: scaledidmatrix.hh:352
const K & diagonal(size_type) const
Get const reference to diagonal entry.
Definition: scaledidmatrix.hh:570
ScaledIdentityMatrix & operator=(const K &k)
Assignment from scalar.
Definition: scaledidmatrix.hh:91
ContainerWrapperIterator< const WrapperType, const_reference, const_reference > ConstIterator
Iterator class for sequential access.
Definition: scaledidmatrix.hh:144
K & diagonal(size_type)
Get reference to diagonal entry.
Definition: scaledidmatrix.hh:576
void solve(V &x, const V &b) const
Solve linear system A x = b.
Definition: scaledidmatrix.hh:500
bool exists(size_type i, size_type j) const
Return true if (i,j) is in the matrix pattern, i.e., if i==j.
Definition: scaledidmatrix.hh:535
Iterator RowIterator
rename the iterators for easier access
Definition: scaledidmatrix.hh:112
ConstIterator const_iterator
typedef for stl compliant access
Definition: scaledidmatrix.hh:146
ScaledIdentityMatrix()
Default constructor.
Definition: scaledidmatrix.hh:81
bool operator==(const ScaledIdentityMatrix &other) const
Test for equality.
Definition: scaledidmatrix.hh:316
ConstIterator beforeBegin() const
Definition: scaledidmatrix.hh:173
ScaledIdentityMatrix & operator/=(const K &k)
Vector space division by scalar.
Definition: scaledidmatrix.hh:224
friend std::ostream & operator<<(std::ostream &s, const ScaledIdentityMatrix< K, n > &a)
Sends the matrix to an output stream.
Definition: scaledidmatrix.hh:547
FieldTraits< field_type >::real_type frobenius_norm2() const
The square of the Frobenius norm.
Definition: scaledidmatrix.hh:472
FieldTraits< field_type >::real_type frobenius_norm() const
The Frobenius norm.
Definition: scaledidmatrix.hh:466
FieldTraits< field_type >::real_type infinity_norm() const
The row sum norm.
Definition: scaledidmatrix.hh:482
ConstIterator ConstRowIterator
rename the iterators for easier access
Definition: scaledidmatrix.hh:148
ConstIterator beforeEnd() const
Definition: scaledidmatrix.hh:166
size_type M() const
number of blocks in column direction
Definition: scaledidmatrix.hh:527
const_reference operator[](size_type i) const
Return const_reference object as row replacement.
Definition: scaledidmatrix.hh:564
ScaledIdentityMatrix(const K &k)
Constructor initializing the whole matrix with a scalar.
Definition: scaledidmatrix.hh:85
friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar)
Vector space multiplication with scalar.
Definition: scaledidmatrix.hh:233
FieldTraits< field_type >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition: scaledidmatrix.hh:488
ScaledIdentityMatrix & operator*=(const K &k)
Vector space multiplication with scalar.
Definition: scaledidmatrix.hh:217
bool identical(const ScaledIdentityMatrix< K, n > &other) const
Check if matrix is identical to other matrix.
Definition: scaledidmatrix.hh:101
K & scalar()
Get reference to the scalar diagonal value.
Definition: scaledidmatrix.hh:590
K block_type
The type representing matrix entries (which may be matrices themselves)
Definition: scaledidmatrix.hh:52
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition: scaledidmatrix.hh:412
ScaledIdentityMatrix & operator+=(const ScaledIdentityMatrix &y)
Vector space addition.
Definition: scaledidmatrix.hh:183
DiagonalRowVectorConst< K, n > const_row_type
Const type of a single row.
Definition: scaledidmatrix.hh:69
void mtv(const X &x, Y &y) const
y = A^T x
Definition: scaledidmatrix.hh:345
reference operator[](size_type i)
Return reference object as row replacement.
Definition: scaledidmatrix.hh:558
ConstIterator begin() const
begin iterator
Definition: scaledidmatrix.hh:153
size_type N() const
number of blocks in row direction
Definition: scaledidmatrix.hh:521
This file implements a quadratic diagonal matrix of fixed size.
A few common exception classes.
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Type traits to determine the type of reals (when working with complex numbers)
const K & diagonal(size_type i) const
Get const reference to diagonal entry.
Definition: diagonalmatrix.hh:580
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
Element type of some SIMD type.
Definition: interface.hh:235
constexpr K conjugateComplex(const K &x)
compute conjugate complex of x
Definition: math.hh:146
