[petsc-users] What is the difference between MatMult and KSP_MatMult

Jed Brown jed at 59A2.org
Tue Oct 19 04:24:13 CDT 2010


On Tue, Oct 19, 2010 at 07:45, vedaprakash subramanian <
vedaprakashsubramanian at gmail.com> wrote:

> Can anyone tell the difference between MatMult() and KSP_MatMult().
>

If you're implementing a new KSP, it's worth reading the source:

#define KSP_MatMult(ksp,A,x,y)          (!ksp->transpose_solve) ?
MatMult(A,x,y)                                                            :
MatMultTranspose(A,x,y)


> Can I use MatMult() inside the function KSPCreate_CGSTAB(KSP ksp)
>

You should not be using MatMult in KSPCreate_XXX because the matrix may not
exist yet.  Whether to use KSP_MatMult depends on how you want to handle
transpose solves.  Note that many KSPs get away withh KSP_PCApplyBAorAB.

Jed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101019/fa345bd3/attachment.htm>


More information about the petsc-users mailing list