Public Member Functions | |
PreconditionLACSolver () | |
void | initialize (SOLVER &, const MATRIX &, const PRECONDITION &) |
template<class VECTOR > | |
void | vmult (VECTOR &, const VECTOR &) const |
Private Attributes | |
SmartPointer< SOLVER > | solver |
SmartPointer< const MATRIX > | matrix |
SmartPointer< const PRECONDITION > | precondition |
Usually, the use of ReductionControl is preferred over the use of the basic SolverControl in defining this solver.
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) SolverCG<Vector<double> > inner_iteration (inner_control, mem); PreconditionSSOR <SparseMatrix<double> > inner_precondition; inner_precondition.initialize (A, 1.2); PreconditionLACSolver precondition; precondition.initialize (inner_iteration, A, inner_precondition); 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.
PreconditionLACSolver< SOLVER, MATRIX, PRECONDITION >::PreconditionLACSolver | ( | ) |
Constructor. All work is done in initialize.
void PreconditionLACSolver< SOLVER, MATRIX, PRECONDITION >::initialize | ( | SOLVER & | , | |
const MATRIX & | , | |||
const PRECONDITION & | ||||
) |
Initialization function. Provide a solver object, a matrix, and another preconditioner for this.
void PreconditionLACSolver< SOLVER, MATRIX, PRECONDITION >::vmult | ( | VECTOR & | , | |
const VECTOR & | ||||
) | const [inline] |
Execute preconditioning.
SmartPointer<SOLVER> PreconditionLACSolver< SOLVER, MATRIX, PRECONDITION >::solver [private] |
The solver object to use.
SmartPointer<const MATRIX> PreconditionLACSolver< SOLVER, MATRIX, PRECONDITION >::matrix [private] |
The matrix in use.
SmartPointer<const PRECONDITION> PreconditionLACSolver< SOLVER, MATRIX, PRECONDITION >::precondition [private] |
The preconditioner to use.