[petsc-dev] MatMult implementation

Barry Smith bsmith at mcs.anl.gov
Mon Jan 26 07:19:27 CST 2015


> On Jan 26, 2015, at 2:53 AM, Ronal Celaya <ronalcelayavzla at gmail.com> wrote:
> 
> Hello everyone.
> I'm work on CG implementation using PETSc. I know that PETSc has a solver (ksp) but I want to implement it step by step.
> How PETSc implements MatMult multiplication? I mean, where can I find the algorithm used by PETSc to do Matrix-vector multiplication?

   The implementation depends on the data structure used to store the matrix and whether it is parallel or not. There are many of the them:

    The most basic is MatMult_SeqAIJ: located at http://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/aij/seq/aij.c.html#MatMult_SeqAIJ
for parallel http://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/aij/mpi/mpiaij.c.html#MatMult_MPIAIJ  The parallel one just does the needed communication and calls the sequential one twice.  See the manual page for http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateAIJ.html for a detailed discussion of the storage format of the parallel matrices.

  Barry

> 
> Sorry for my English
> 
> Regards,
> 
> -- 
> Ronal Celaya




More information about the petsc-dev mailing list