Public Types | |
typedef void(MATRIX::* | function_ptr )(VECTOR &, const VECTOR &) const |
Public Member Functions | |
PreconditionUseMatrix (const MATRIX &M, const function_ptr method) | |
void | vmult (VECTOR &dst, const VECTOR &src) const |
Private Attributes | |
const MATRIX & | matrix |
const function_ptr | precondition |
It seems that all builtin preconditioners have a relaxation parameter, so please use PreconditionRelaxation for these.
You will usually not want to create a named object of this type, although possible. The most common use is like this:
SolverGMRES<SparseMatrix<double>, Vector<double> > gmres(control,memory,500); gmres.solve (matrix, solution, right_hand_side, PreconditionUseMatrix<SparseMatrix<double>,Vector<double> > (matrix,&SparseMatrix<double>::template precondition_Jacobi<double>));
precondition_Jacobi
taking two vectors (source and destination) as parameters (Actually, there is no function like that, the existing function takes a third parameter, denoting the relaxation parameter; this example is therefore only meant to illustrate the general idea).Note that due to the default template parameters, the above example could be written shorter as follows:
... gmres.solve (matrix, solution, right_hand_side, PreconditionUseMatrix<> (matrix,&SparseMatrix<double>::template precondition_Jacobi<double>));
typedef void( MATRIX::* PreconditionUseMatrix< MATRIX, VECTOR >::function_ptr)(VECTOR &, const VECTOR &) const |
Type of the preconditioning function of the matrix.
PreconditionUseMatrix< MATRIX, VECTOR >::PreconditionUseMatrix | ( | const MATRIX & | M, | |
const function_ptr | method | |||
) |
Constructor. This constructor stores a reference to the matrix object for later use and selects a preconditioning method, which must be a member function of that matrix.
void PreconditionUseMatrix< MATRIX, VECTOR >::vmult | ( | VECTOR & | dst, | |
const VECTOR & | src | |||
) | const |
Execute preconditioning. Calls the function passed to the constructor of this object with the two arguments given here.
const MATRIX& PreconditionUseMatrix< MATRIX, VECTOR >::matrix [private] |
Pointer to the matrix in use.
const function_ptr PreconditionUseMatrix< MATRIX, VECTOR >::precondition [private] |
Pointer to the preconditioning function.