
Public Member Functions | |
| template<class MATRIX , class PRECONDITION > | |
| void | initialize (const MATRIX &, const PRECONDITION &) |
| void | clear () |
| void | vmult (VECTOR &dst, const VECTOR &src) const |
Public Attributes | |
| SolverSelector< VECTOR > | solver |
Private Attributes | |
| std_cxx1x::shared_ptr < PointerMatrixBase< VECTOR > > | matrix |
| std_cxx1x::shared_ptr < PointerMatrixBase< VECTOR > > | preconditioner |
| std_cxx1x::shared_ptr < PointerMatrixBase< VECTOR > > | transpose_matrix |
| std_cxx1x::shared_ptr < PointerMatrixBase< VECTOR > > | transpose_preconditioner |
Implementation of the inverse of a matrix, using an iterative method.
The function vmult() of this class starts an iterative solver in order to approximate the action of the inverse matrix.
Krylov space methods like SolverCG or SolverBicgstab become inefficient if soution down to machine accuracy is needed. This is due to the fact, that round-off errors spoil the orthogonality of the vector sequences. Therefore, a nested iteration of two methods is proposed: The outer method is SolverRichardson, since it is robust with respect to round-of errors. The inner loop is an appropriate Krylov space method, since it is fast.
// Declare related objects SparseMatrix<double> A; Vector<double> x; Vector<double> b; GrowingVectorMemory<Vector<double> > mem; ReductionControl inner_control (10, 1.e-30, 1.e-2); PreconditionSSOR <SparseMatrix<double> > inner_precondition; inner_precondition.initialize (A, 1.2); IterativeInverse<Vector<double> > precondition; precondition.initialize (A, inner_precondition); precondition.solver.select("cg"); precondition.solver.set_control(inner_control); SolverControl outer_control(100, 1.e-16); SolverRichardson<Vector<double> > outer_iteration; outer_iteration.solve (A, x, b, precondition);
Each time we call the inner loop, reduction of the residual by a factor 1.e-2 is attempted. Since the right hand side vector of the inner iteration is the residual of the outer loop, the relative errors are far from machine accuracy, even if the errors of the outer loop are in the range of machine accuracy.
Definition at line 76 of file iterative_inverse.h.
| void IterativeInverse< VECTOR >::initialize | ( | const MATRIX & | m, |
| const PRECONDITION & | p | ||
| ) | [inline] |
Initialization function. Provide a matrix and preconditioner for th solve in vmult().
Definition at line 140 of file iterative_inverse.h.
References LAPACKSupport::matrix, and PointerMatrixAux< MATRIX, VECTOR >::new_pointer_matrix_base().
| void IterativeInverse< VECTOR >::clear | ( | ) | [inline] |
Delete the pointers to matrix and preconditioner.
Definition at line 152 of file iterative_inverse.h.
References LAPACKSupport::matrix.
| void IterativeInverse< VECTOR >::vmult | ( | VECTOR & | dst, |
| const VECTOR & | src | ||
| ) | const [inline] |
Solve for right hand side src.
Definition at line 161 of file iterative_inverse.h.
References Assert, StandardExceptions::ExcNotInitialized(), and LAPACKSupport::matrix.
| SolverSelector<VECTOR> IterativeInverse< VECTOR >::solver |
Solve the transposed system for right hand side src. The solver, which allows selection of the actual solver as well as adjuxtment of parameters.
Definition at line 112 of file iterative_inverse.h.
std_cxx1x::shared_ptr<PointerMatrixBase<VECTOR> > IterativeInverse< VECTOR >::matrix [private] |
The matrix in use.
Definition at line 118 of file iterative_inverse.h.
std_cxx1x::shared_ptr<PointerMatrixBase<VECTOR> > IterativeInverse< VECTOR >::preconditioner [private] |
The preconditioner to use.
Definition at line 123 of file iterative_inverse.h.
std_cxx1x::shared_ptr<PointerMatrixBase<VECTOR> > IterativeInverse< VECTOR >::transpose_matrix [private] |
The transpose of the matrix in use.
Definition at line 127 of file iterative_inverse.h.
std_cxx1x::shared_ptr<PointerMatrixBase<VECTOR> > IterativeInverse< VECTOR >::transpose_preconditioner [private] |
The transpose of the preconditioner to use.
Definition at line 132 of file iterative_inverse.h.
documentation generated on Fri Feb 3 2012 06:04:09 by
doxygen
1.7.2