[petsc-users] meaning of KSP_MatMult

Barry Smith bsmith at mcs.anl.gov
Sun Apr 3 19:57:49 CDT 2011


  Usually it is best just to look at the code.

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

  It is only there to allow the same code work to solve with A or the transpose system with A'.  Of course with CG it doesn't even need to be used since the matrix is symmetric.

   Barry

On Apr 3, 2011, at 7:26 PM, Gaurish Telang wrote:

> Hi 
> 
> What is the difference between KSP_MatMult and MatMult? I am trying to implement a new KSP method and see that all Matrix vector multiplies are done with 
> KSP_MatMult in cg.c which implements the conjugate gradient. 
> 
> Regards,
> 
> Gaurish



More information about the petsc-users mailing list