Public Member Functions | |
IdentityMatrix () | |
IdentityMatrix (const unsigned int n) | |
void | reinit (const unsigned int n) |
unsigned int | m () const |
unsigned int | n () const |
template<class VECTOR1 , class VECTOR2 > | |
void | vmult (VECTOR1 &out, const VECTOR2 &in) const |
template<class VECTOR1 , class VECTOR2 > | |
void | vmult_add (VECTOR1 &out, const VECTOR2 &in) const |
template<class VECTOR1 , class VECTOR2 > | |
void | Tvmult (VECTOR1 &out, const VECTOR2 &in) const |
template<class VECTOR1 , class VECTOR2 > | |
void | Tvmult_add (VECTOR1 &out, const VECTOR2 &in) const |
Private Attributes | |
unsigned int | size |
The main usefulness of this class lies in its ability to initialize other matrix, like this:
FullMatrix<double> identity (IdentityMatrix(10));
This creates a 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:
SolverControl solver_control (1000, 1e-12); SolverCG<> cg (solver_control); cg.solve (system_matrix, solution, system_rhs, IdentityMatrix(solution.size()));
IdentityMatrix::IdentityMatrix | ( | ) |
Default constructor. Creates a zero-sized matrix that should be resized later on using the reinit() function.
Constructor. Creates a identity matrix of size n.
Number of rows of this matrix. For the present matrix, the number of rows and columns are equal, of course.
Number of columns of this matrix. For the present matrix, the number of rows and columns are equal, of course.
void IdentityMatrix::vmult | ( | VECTOR1 & | out, | |
const VECTOR2 & | in | |||
) | const [inline] |
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 | ( | VECTOR1 & | out, | |
const VECTOR2 & | in | |||
) | const [inline] |
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 | ( | VECTOR1 & | out, | |
const VECTOR2 & | in | |||
) | const [inline] |
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 | ( | VECTOR1 & | out, | |
const VECTOR2 & | in | |||
) | const [inline] |
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.
unsigned int IdentityMatrix::size [private] |
Number of rows and columns of this matrix.