![]() |
Reference documentation for deal.II version 9.6.0
|
#include <deal.II/lac/identity_matrix.h>
Public Types | |
using | size_type = types::global_dof_index |
Public Member Functions | |
IdentityMatrix () | |
IdentityMatrix (const size_type n) | |
void | reinit (const size_type n) |
size_type | m () const |
size_type | n () const |
template<typename OutVectorType , typename InVectorType > | |
void | vmult (OutVectorType &out, const InVectorType &in) const |
template<typename OutVectorType , typename InVectorType > | |
void | vmult_add (OutVectorType &out, const InVectorType &in) const |
template<typename OutVectorType , typename InVectorType > | |
void | Tvmult (OutVectorType &out, const InVectorType &in) const |
template<typename OutVectorType , typename InVectorType > | |
void | Tvmult_add (OutVectorType &out, const InVectorType &in) const |
Private Attributes | |
size_type | size |
Implementation of a simple class representing the identity matrix of a given size, i.e. a matrix with entries \(A_{ij}=\delta_{ij}\). While it has the most important ingredients of a matrix, in particular that one can ask for its size and perform matrix-vector products with it, a matrix of this type is really only useful in two contexts: preconditioning and initializing other matrices.
The main usefulness of this class lies in its ability to initialize other matrix, like this:
This creates a \(10\times 10\) matrix with ones on the diagonal and zeros everywhere else. Most matrix types, in particular FullMatrix and SparseMatrix, have conversion constructors and assignment operators for IdentityMatrix, and can therefore be filled rather easily with identity matrices.
No preconditioning at all is equivalent to preconditioning with preconditioning with the identity matrix. deal.II has a specialized class for this purpose, PreconditionIdentity, than can be used in a context as shown in the documentation of that class. The present class can be used in much the same way, although without any additional benefit:
Definition at line 68 of file identity_matrix.h.
Declare type for container size.
Definition at line 74 of file identity_matrix.h.
IdentityMatrix::IdentityMatrix | ( | ) |
Default constructor. Creates a zero-sized matrix that should be resized later on using the reinit() function.
|
explicit |
Constructor. Creates a identity matrix of size n.
size_type IdentityMatrix::m | ( | ) | const |
Number of rows of this matrix. For the present matrix, the number of rows and columns are equal, of course.
size_type IdentityMatrix::n | ( | ) | const |
Number of columns of this matrix. For the present matrix, the number of rows and columns are equal, of course.
void IdentityMatrix::vmult | ( | OutVectorType & | out, |
const InVectorType & | in ) const |
Matrix-vector multiplication. For the present case, this of course amounts to simply copying the input vector to the output vector.
void IdentityMatrix::vmult_add | ( | OutVectorType & | out, |
const InVectorType & | in ) const |
Matrix-vector multiplication with addition to the output vector. For the present case, this of course amounts to simply adding the input vector to the output vector.
void IdentityMatrix::Tvmult | ( | OutVectorType & | out, |
const InVectorType & | in ) const |
Matrix-vector multiplication with the transpose matrix. For the present case, this of course amounts to simply copying the input vector to the output vector.
void IdentityMatrix::Tvmult_add | ( | OutVectorType & | out, |
const InVectorType & | in ) const |
Matrix-vector multiplication with the transpose matrix, with addition to the output vector. For the present case, this of course amounts to simply adding the input vector to the output vector.
|
private |
Number of rows and columns of this matrix.
Definition at line 147 of file identity_matrix.h.