[petsc-users] Block matrix vector products?

Jed Brown jed at jedbrown.org
Mon Jul 15 23:54:38 CDT 2019


You can use MatCreateMAIJ(A,2,&M) and a single MatMult(A,xy) where xy
contains the vectors x and y interlaced [x_0, y_0, x_1, y_1, ...].

There is also MatMatMult(A,X,...,&Y) where X is a MATDENSE with two
columns, but I would prefer the MAIJ variant above in most cases.

Tyler Chen via petsc-users <petsc-users at mcs.anl.gov> writes:

> Hello,
>
> I am looking for a way to compute two matrix vector products
> simultaneously, where the matrix is the same for both products (i.e. Ax and
> Ay). I know some numerical libraries have the concept of "block vectors" or
> "basis vectors" and was wondering if there is anything similar in PETSc.
> Right now I am just using two MatMults sequentially, but I'm hoping there
> are probably better ways to do this. My matrices are MPIAIJ if that makes
> any difference.
>
> Best,
> Tyler


More information about the petsc-users mailing list