about MatMatMult()

Hong Zhang hzhang at mcs.anl.gov
Thu May 1 11:55:28 CDT 2008


Yujie,

In general, C=A*B is denser thant A and B.
Thus, sparse matrix product should be avoided.

Petsc sparse MatMatMult() is intended for supporting multigrid 
computation MatPtAP() in which, 
P is a projector and C=Pt*A*P maintains similar sparse density.

If your C=A*B is dense, you may set A and B in dense format.
In sequential case, petsc calls LAPACK for MatMatMult()
which would be much efficient than sparse implementation.

Hong

On Thu, 1 May 2008, Yujie wrote:

> I have further checked this function.
> In MatMatMult(Mat A,Mat B,MatReuse scall,PetscReal fill,Mat *C)
> I am wondering
> why the type of C is MATAIJ when the types of A and B are MATAIJ.
> although A and B is MATAIJ, C should be dense. If C uses MATAIJ type,
> it should take more memory, is it right?
>
> thanks a lot.
>
> Regards,
> Yujie
>




More information about the petsc-users mailing list