Classes | |
struct | AdditionalData |
Public Member Functions | |
SolverBicgstab (SolverControl &cn, VectorMemory< VECTOR > &mem, const AdditionalData &data=AdditionalData()) | |
SolverBicgstab (SolverControl &cn, const AdditionalData &data=AdditionalData()) | |
virtual | ~SolverBicgstab () |
template<class MATRIX , class PRECONDITIONER > | |
void | solve (const MATRIX &A, VECTOR &x, const VECTOR &b, const PRECONDITIONER &precondition) |
Protected Member Functions | |
template<class MATRIX > | |
double | criterion (const MATRIX &A, const VECTOR &x, const VECTOR &b) |
virtual void | print_vectors (const unsigned int step, const VECTOR &x, const VECTOR &r, const VECTOR &d) const |
Protected Attributes | |
VECTOR * | Vx |
VECTOR * | Vr |
VECTOR * | Vrbar |
VECTOR * | Vp |
VECTOR * | Vy |
VECTOR * | Vz |
VECTOR * | Vs |
VECTOR * | Vt |
VECTOR * | Vv |
const VECTOR * | Vb |
double | alpha |
double | beta |
double | omega |
double | rho |
double | rhobar |
unsigned int | step |
double | res |
AdditionalData | additional_data |
Private Member Functions | |
template<class MATRIX > | |
SolverControl::State | start (const MATRIX &A) |
template<class MATRIX , class PRECONDITIONER > | |
bool | iterate (const MATRIX &A, const PRECONDITIONER &precondition) |
For the requirements on matrices and vectors in order to work with this class, see the documentation of the Solver base class.
Like all other solver classes, this class has a local structure called AdditionalData
which is used to pass additional parameters to the solver, like damping parameters or the number of temporary vectors. We use this additional structure instead of passing these values directly to the constructor because this makes the use of the SolverSelector
and other classes much easier and guarantees that these will continue to work even if number or type of the additional parameters for a certain solver changes.
The Bicgstab-method has two additional parameters: the first is a boolean, deciding whether to compute the actual residual in each step (true
) or to use the length of the computed orthogonal residual (false
). Remark, that computing the residual causes a third matrix-vector-multiplication, though no additional preconditioning, in each step. The reason for doing this is, that the size of the orthogonalized residual computed during the iteration may be larger by orders of magnitude than the true residual. This is due to numerical instabilities related to badly conditioned matrices. Since this instability results in a bad stopping criterion, the default for this parameter is true
. Whenever the user knows that the estimated residual works reasonably as well, it the flag should be set to false
in order to increase the performance of the solver.
The second parameter is the size of a breakdown criterion. It is difficult to find a general good criterion, so if things do not work for you, try to change this value.
SolverBicgstab< VECTOR >::SolverBicgstab | ( | SolverControl & | cn, | |
VectorMemory< VECTOR > & | mem, | |||
const AdditionalData & | data = AdditionalData() | |||
) |
Constructor.
SolverBicgstab< VECTOR >::SolverBicgstab | ( | SolverControl & | cn, | |
const AdditionalData & | data = AdditionalData() | |||
) |
Constructor. Use an object of type GrowingVectorMemory as a default to allocate memory.
virtual SolverBicgstab< VECTOR >::~SolverBicgstab | ( | ) | [virtual] |
Virtual destructor.
void SolverBicgstab< VECTOR >::solve | ( | const MATRIX & | A, | |
VECTOR & | x, | |||
const VECTOR & | b, | |||
const PRECONDITIONER & | precondition | |||
) | [inline] |
Solve primal problem only.
Referenced by SolverSelector< VECTOR >::solve().
double SolverBicgstab< VECTOR >::criterion | ( | const MATRIX & | A, | |
const VECTOR & | x, | |||
const VECTOR & | b | |||
) | [inline, protected] |
Computation of the stopping criterion.
virtual void SolverBicgstab< VECTOR >::print_vectors | ( | const unsigned int | step, | |
const VECTOR & | x, | |||
const VECTOR & | r, | |||
const VECTOR & | d | |||
) | const [protected, virtual] |
Interface for derived class. This function gets the current iteration vector, the residual and the update vector in each step. It can be used for a graphical output of the convergence history.
SolverControl::State SolverBicgstab< VECTOR >::start | ( | const MATRIX & | A | ) | [inline, private] |
Everything before the iteration loop.
bool SolverBicgstab< VECTOR >::iterate | ( | const MATRIX & | A, | |
const PRECONDITIONER & | precondition | |||
) | [inline, private] |
The iteration loop itself.
VECTOR* SolverBicgstab< VECTOR >::Vx [protected] |
Auxiliary vector.
VECTOR* SolverBicgstab< VECTOR >::Vr [protected] |
Auxiliary vector.
VECTOR* SolverBicgstab< VECTOR >::Vrbar [protected] |
Auxiliary vector.
VECTOR* SolverBicgstab< VECTOR >::Vp [protected] |
Auxiliary vector.
VECTOR* SolverBicgstab< VECTOR >::Vy [protected] |
Auxiliary vector.
VECTOR* SolverBicgstab< VECTOR >::Vz [protected] |
Auxiliary vector.
VECTOR* SolverBicgstab< VECTOR >::Vs [protected] |
Auxiliary vector.
VECTOR* SolverBicgstab< VECTOR >::Vt [protected] |
Auxiliary vector.
VECTOR* SolverBicgstab< VECTOR >::Vv [protected] |
Auxiliary vector.
const VECTOR* SolverBicgstab< VECTOR >::Vb [protected] |
Right hand side vector.
double SolverBicgstab< VECTOR >::alpha [protected] |
Auxiliary value.
double SolverBicgstab< VECTOR >::beta [protected] |
Auxiliary value.
double SolverBicgstab< VECTOR >::omega [protected] |
Auxiliary value.
double SolverBicgstab< VECTOR >::rho [protected] |
Auxiliary value.
double SolverBicgstab< VECTOR >::rhobar [protected] |
Auxiliary value.
unsigned int SolverBicgstab< VECTOR >::step [protected] |
Current iteration step.
double SolverBicgstab< VECTOR >::res [protected] |
Residual.
AdditionalData SolverBicgstab< VECTOR >::additional_data [protected] |
Additional parameters.