# Re: 回复： Re: About unpreconditioned residuals in Left Preconditioned GMRES

Barry Smith bsmith at mcs.anl.gov
Sat Feb 2 16:10:44 CST 2008

```    To calculate the true residual norm at each iteration of left
preconditioned GMRES requires
actually forming b - A*x which means computing A*x which means
computing x (which is not available
without additional calculations at each iteration). This is why we do
not support left preconditioning with
true residual norm convergence test.

You should use the KSP type of FGMRES, it is written using right
preconditioning and for a standard PC
is identical to regular GMRES.

Barry

On Feb 2, 2008, at 10:09 AM, jiaxun hou wrote:

> Thank you, Dave. But there is still a question: how can I get the
> residual vector in each iteration? It seems difficult to get it
> without modifying the GMRES codes.
>
> Best regards,
> Jiaxun
> Dave May <dave.mayhem23 at gmail.com> 写道：
> Hi,
>     You can use the function
> PetscErrorCode PETSCKSP_DLLEXPORT KSPSetConvergenceTest(KSP
> ksp,PetscErrorCode (*converge)
> (KSP,PetscInt,PetscReal,KSPConvergedReason*,void*),void *cctx)
> to define your own convergence test.
>
> Cheers,
>     Dave.
>
>
>
>
>
> 2008/2/2 jiaxun hou <jiaxun_hou at yahoo.com.cn>:
> Hi everyone,
>
> I want to use the Left Preconditioned GMRES to solve a linear
> system, and the stopping criterion  must  be  based on the  actual
> residuals (b-Ax). But the  GMRES codes of PETSc seems to use the
> preconditioned residuals (B^-1(b-Ax)) only. In addition,  when I set
> KSPSetNormType(ksp,KSP_NORM_UNPRECONDITIONED), I receive the error
> message: "Currently can use GMRES with only preconditioned residual
> (right preconditioning not coded)". So, is there any way to set
> stopping criterion based on the actual residuals?
>
> Best regards,
> Jiaxun
> 雅虎邮箱传递新年祝福，个性贺卡送亲朋！
>
>
>
> 雅虎邮箱传递新年祝福，个性贺卡送亲朋！

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20080202/063c9530/attachment.htm>
```