<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
You can use MatMatTransposeMult().</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hong</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> petsc-users <petsc-users-bounces@mcs.anl.gov> on behalf of Olivier Jamond <olivier.jamond@cea.fr><br>
<b>Sent:</b> Wednesday, September 23, 2020 11:56 AM<br>
<b>To:</b> PETSc <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> [petsc-users] Compute C*Ct using MatCreateTranspose for Ct</font>
<div> </div>
</div>
<div>
<p><tt>Hi all,</tt><tt><br>
</tt></p>
<p><tt>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.</tt></p>
<p><tt>If I just create a 'shell' Ct:</tt><tt><br>
</tt></p>
<p><tt>Mat Ct;</tt><tt><br>
</tt><tt>MatCreateTranspose(C, &Ct);</tt><tt><br>
</tt><tt>MatMatMult(C, Ct, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &CCt);</tt><tt><br>
</tt></p>
<p><tt>Then it does not work. I get: </tt><tt><br>
</tt></p>
<p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; text-indent:0px">
<tt><span style="color:#000000">[0]PETSC ERROR: No support for this operation for this object type</span></tt></p>
<tt></tt>
<p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; text-indent:0px">
<tt><span style="color:#000000">[0]PETSC ERROR: MatMatTransposeMult not supported for A of type mpiaij</span></tt></p>
<p><style type="text/css">
<!--
-->
</style><tt>But if instead of C it was Ct that I have explicitly, then it would work:</tt></p>
<p><tt>Mat Ct, CC;</tt><tt><br>
</tt><tt>MatTranspose(C, MAT_INITIAL_MATRIX, &Ct);</tt><tt><br>
</tt><tt>MatCreateTranspose(Ct, &CC); // create a 'shell' C from explicit Ct to test</tt><tt><br>
</tt><tt>MatMatMult(CC, Ct, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &CCt);</tt><tt> // this is OK</tt></p>
<p><tt>Is there a way to avoid the explicit transposition of the matrix?</tt></p>
<p><tt>Many thanks,</tt><tt><br>
</tt><tt>Olivier Jamond</tt><br>
</p>
<p><br>
</p>
</div>
</body>
</html>