double
SolverBicgstab<VECTOR>::criterion (const MATRIX& A, const VECTOR& x, const VECTOR& b)
{
- res = A.residual(*Vt, x, b);
+ A.vmult(*Vt, x);
+ Vt->sadd(-1.,1.,b);
+ res = Vt->l2_norm();
+
return res;
}
SolverControl::State
SolverBicgstab<VECTOR>::start(const MATRIX& A)
{
- res = A.residual(*Vr, *Vx, *Vb);
+ A.vmult(*Vr, *Vx);
+ Vr->sadd(-1.,1.,*Vb);
+ res = Vr->l2_norm();
+
Vp->reinit(*Vx);
Vv->reinit(*Vx);
Vrbar->equ(1.,*Vr);
// library
int it=0;
double res,gh,alpha,beta;
-
- res = A.residual(g,x,b);
+
+ A.vmult(g,x);
+ g.sadd(-1.,1.,b);
+ res = g.l2_norm();
+
conv = control().check(0,res);
if (conv)
{
if (left_precondition)
{
- A.residual(p,x,b);
+ A.vmult(p,x);
+ p.sadd(-1.,1.,b);
precondition.vmult(v,p);
} else {
- A.residual(v,x,b);
+ A.vmult(v,x);
+ v.sadd(-1.,1.,b);
};
double rho = v.l2_norm();
// Apply right preconditioning to x
precondition.vmult(q,x);
// Preconditioned residual
- res = A.residual(v, q, b);
+ A.vmult(v,q);
+ v.sadd(-1.,1.,b);
+ res = v.l2_norm();
if (control().check(step, res) == SolverControl::success)
return success;
print_vectors(step,x,v,d);
// Step 5
if (additional_data.exact_residual)
- res = A.residual(q,x,b);
+ {
+ A.vmult(q,x);
+ q.sadd(-1.,1.,b);
+ res = q.l2_norm();
+ }
else
res = sqrt((it+1)*tau);
state = control().check(step,res);
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams