[petsc-users] Compute C*Ct using MatCreateTranspose for Ct

Zhang, Hong hzhang at mcs.anl.gov
Wed Sep 23 13:23:51 CDT 2020


You can use MatMatTransposeMult().
Hong
________________________________
From: petsc-users <petsc-users-bounces at mcs.anl.gov> on behalf of Olivier Jamond <olivier.jamond at cea.fr>
Sent: Wednesday, September 23, 2020 11:56 AM
To: PETSc <petsc-users at mcs.anl.gov>
Subject: [petsc-users] Compute C*Ct using MatCreateTranspose for Ct


Hi all,

I have a rectangle MPIAIJ matrix C. I would like to compute C*Ct explicitly to solve some ksp(C*Ct) problems using direct solvers or with petsc preconditioners.

If I just create a 'shell' Ct:

Mat Ct;
MatCreateTranspose(C, &Ct);
MatMatMult(C, Ct, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &CCt);

Then it does not work. I get:

[0]PETSC ERROR: No support for this operation for this object type

[0]PETSC ERROR: MatMatTransposeMult not supported for A of type mpiaij

But if instead of C it was Ct that I have explicitly, then it would work:

Mat Ct, CC;
MatTranspose(C, MAT_INITIAL_MATRIX, &Ct);
MatCreateTranspose(Ct, &CC); // create a 'shell' C from explicit Ct to test
MatMatMult(CC, Ct, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &CCt); // this is OK

Is there a way to avoid the explicit transposition of the matrix?

Many thanks,
Olivier Jamond

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200923/0d6b9545/attachment.html>


More information about the petsc-users mailing list