#include <deal.II/lac/tensor_product_matrix.h>
Public Types | |
using | value_type = Number |
Public Member Functions | |
TensorProductMatrixSymmetricSum ()=default | |
template<typename T> | |
TensorProductMatrixSymmetricSum (const T &mass_matrix, const T &derivative_matrix) | |
template<typename T> | |
void | reinit (const T &mass_matrix, const T &derivative_matrix) |
unsigned int | m () const |
unsigned int | n () const |
void | vmult (const ArrayView< Number > &dst, const ArrayView< const Number > &src) const |
void | vmult (const ArrayView< Number > &dst, const ArrayView< const Number > &src, AlignedVector< Number > &tmp) const |
void | apply_inverse (const ArrayView< Number > &dst, const ArrayView< const Number > &src) const |
std::size_t | memory_consumption () const |
Static Public Attributes | |
static constexpr int | n_rows_1d_static = n_rows_1d |
Protected Attributes | |
std::array< Table< 2, Number >, dim > | mass_matrix |
std::array< Table< 2, Number >, dim > | derivative_matrix |
std::array< AlignedVector< Number >, dim > | eigenvalues |
std::array< Table< 2, Number >, dim > | eigenvectors |
Private Attributes | |
AlignedVector< Number > | tmp_array |
Threads::Mutex | mutex |
This is a special matrix class defined as the tensor product (or Kronecker product) of 1d matrices of the type
in 2d and
in 3d. The typical application setting is a discretization of the Laplacian
This class implements two basic operations, namely the usual multiplication by a vector and the inverse. For both operations, fast tensorial techniques can be applied that implement the operator evaluation in
Interestingly, the exact inverse of the matrix
where
and
This class requires LAPACK support.
n_rows_1d
to -1. The second mode of usage that is faster allows to set the template parameter as a compile time constant, giving significantly faster code in particular for small sizes of the matrix.dim | Dimension of the problem. Currently, 1D, 2d, and 3d codes are implemented. |
Number | Arithmetic type of the underlying array elements. Note that the underlying LAPACK implementation supports only float and double numbers, so only these two types are currently supported by the generic class. Nevertheless, a template specialization for the vectorized types VectorizedArray<float> and VectorizedArray<double> exists. This is necessary to perform LAPACK calculations for each vectorization lane, i.e. for the supported float and double numbers. |
n_rows_1d | Compile-time number of rows of 1d matrices (only valid if the number of rows and columns coincide for each dimension). By default at -1, which means that the number of rows is determined at run-time by means of the matrices passed to the reinit() function. |
Definition at line 112 of file tensor_product_matrix.h.
using TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::value_type = Number |
Type of matrix entries. This alias is analogous to value_type
in the standard library containers.
Definition at line 119 of file tensor_product_matrix.h.
|
default |
Default constructor.
TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::TensorProductMatrixSymmetricSum | ( | const T & | mass_matrix, |
const T & | derivative_matrix ) |
Constructor that is equivalent to the empty constructor and immediately calling reinit(mass_matrix, derivative_matrix).
void TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::reinit | ( | const T & | mass_matrix, |
const T & | derivative_matrix ) |
Initializes the tensor product matrix by copying the arrays of 1d mass matrices mass_matrix
and 1d derivative matrices derivative_matrix
into its base class counterparts, respectively, and by assembling the regarding generalized eigenvalues and eigenvectors in eigenvalues and eigenvectors, respectively. Note that the current implementation requires each
mass_matrix
and the same 1d derivative matrix derivative_matrix
for each tensor direction. unsigned int TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::m | ( | ) | const |
Return the number of rows of the tensor product matrix resulting from the Kronecker product of 1d matrices, which is described in the main documentation of TensorProductMatrixSymmetricSum.
unsigned int TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::n | ( | ) | const |
Return the number of columns of the tensor product matrix resulting from the Kronecker product of 1d matrices, which is described in the main documentation of TensorProductMatrixSymmetricSum.
void TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::vmult | ( | const ArrayView< Number > & | dst, |
const ArrayView< const Number > & | src ) const |
Implements a matrix-vector product with the underlying matrix as described in the main documentation of TensorProductMatrixSymmetricSum. This function is operating on ArrayView to allow checks of array bounds with respect to dst
and src
.
void TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::vmult | ( | const ArrayView< Number > & | dst, |
const ArrayView< const Number > & | src, | ||
AlignedVector< Number > & | tmp ) const |
Same as above but letting the user provide a user-owned temporary array, resolving the two issues described above. This array is resized internally to the needed size.
void TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::apply_inverse | ( | const ArrayView< Number > & | dst, |
const ArrayView< const Number > & | src ) const |
Implements a matrix-vector product with the underlying matrix as described in the main documentation of TensorProductMatrixSymmetricSum. This function is operating on ArrayView to allow checks of array bounds with respect to dst
and src
.
std::size_t TensorProductMatrixSymmetricSum< dim, Number, n_rows_1d >::memory_consumption | ( | ) | const |
Return the memory consumption of the allocated memory in this class.
|
staticconstexpr |
The static number of rows of the 1d matrices. For more details, see the description of the template parameter n_rows_1d
.
Definition at line 125 of file tensor_product_matrix.h.
|
protected |
An array containing a mass matrix for each tensor direction.
Definition at line 223 of file tensor_product_matrix.h.
|
protected |
An array containing a derivative matrix for each tensor direction.
Definition at line 228 of file tensor_product_matrix.h.
|
protected |
An array storing the generalized eigenvalues for each tensor direction.
Definition at line 234 of file tensor_product_matrix.h.
|
protected |
An array storing the generalized eigenvectors for each tensor direction.
Definition at line 240 of file tensor_product_matrix.h.
|
mutableprivate |
An array for temporary data.
Definition at line 246 of file tensor_product_matrix.h.
|
mutableprivate |
A mutex that guards access to the array tmp_array
.
Definition at line 251 of file tensor_product_matrix.h.