You can use MatMatTransposeMult().
Hong
________________________________
From: petsc-users <petsc-users-boun...@mcs.anl.gov> on behalf of Olivier Jamond 
<olivier.jam...@cea.fr>
Sent: Wednesday, September 23, 2020 11:56 AM
To: PETSc <petsc-users@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

Reply via email to