extracting work vectors

Jarunan Panyasantisuk jarunan at ascomp.ch
Fri Dec 4 09:47:27 CST 2009

I am using GMRES and BICGSTAB, not Richardson. Actually, I have never
tried it.

About PCSHELL, I am sorry if this will annoy you but please let me
explain what I understand.
When define a linear system Ax = b
GMRES does                           Ax' = r
where r is residual, acts as a new RHS and supposed to be minimized
x' is a new solution vector, used in the iterations

MyProcond(r, x', rtol, niter)

which will solve the system Ax' = r for niter iterations
Then, return new x' which will be the preconditioned vector or y in


It is clear about the vector which preconditioner will be applied, x' here.
In my case, I am looking for my right hand side, r, which I do not know
how can I get this.

If there is no way to access it, I apologize for asking several times.


Jed Brown wrote:
> On Fri, 04 Dec 2009 12:51:27 +0100, jarunan at ascomp.ch wrote:
>> Hi Jed,
>> Thanks for the advice. I took a look in PCShellSetApplyRicharson() and  
>> its apply function.
>> PetscErrorCode apply (PC pc,Vec b,Vec x,Vec r,PetscReal rtol,PetscReal  
>> abstol,PetscReal dtol,PetscInt maxits)
>> b - right-hand-side
>> x - current iterate
>> r - work space
>> 1. Can I use PCShellSetApplyRicharson() with KSPGMRES? or it is  
>> restrict only for Richardson solver.
> Richardson only.
>> 2. Is x equivalent to xin in PCShellSetApply(pc,apply(PC pc,Vec  
>> xin,Vec xout))?
> No, preconditioning Richardson is a different beast entirely.
>> 3. Are b vector is the right hand side specified by user and r the  
>> work vector in the iterations?
> Yes, r is just work space, you are not required to use it.
> It's unlikely that you actually want to use Richardson, you should write
> apply(PC,Vec,Vec).
> Jed

Jarunan Panyasantisuk
Development Engineer
ASCOMP GmbH, Technoparkstr. 1
CH-8005 Zurich, Switzerland
Phone : +41 44 445 4072
Fax   : +41 44 445 4075
E-mail: jarunan at ascomp.ch

More information about the petsc-users mailing list