<head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
  #pfptBannerws0ab7o { all: revert !important; display: block !important; 
    visibility: visible !important; opacity: 1 !important; 
    background-color: #D0D8DC !important; 
    max-width: none !important; max-height: none !important }
  .pfptPrimaryButtonws0ab7o:hover, .pfptPrimaryButtonws0ab7o:focus {
    background-color: #b4c1c7 !important; }
  .pfptPrimaryButtonws0ab7o:active {
    background-color: #90a4ae !important; }
</style>

<!-- BaNnErBlUrFlE-HeAdEr-end -->
</head><!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">
 Thanks for the suggestion. I don't have a factored matrix (and can't really use direct linear solvers) so MatSolveTranspose doesn't seem to be an option. I should have mentioned that I've also tried KSPSolveTranspose but that
</div>
<!-- Preheader Text : END -->

<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerStart</div>

<!--[if ((ie)|(mso))]>
  <table border="0" cellspacing="0" cellpadding="0" width="100%" style="padding: 16px 0px 16px 0px; direction: ltr" ><tr><td>
    <table border="0" cellspacing="0" cellpadding="0" style="padding: 0px 10px 5px 6px; width: 100%; border-radius:4px; border-top:4px solid #90a4ae;background-color:#D0D8DC;"><tr><td valign="top">
      <table align="left" border="0" cellspacing="0" cellpadding="0" style="padding: 4px 8px 4px 8px">
        <tr><td style="color:#000000; font-family: 'Arial', sans-serif; font-weight:bold; font-size:14px; direction: ltr">
          This Message Is From an External Sender
        </td></tr>
        <tr><td style="color:#000000; font-weight:normal; font-family: 'Arial', sans-serif; font-size:12px; direction: ltr">
          This message came from outside your organization.
        </td></tr>

      </table>

    </td></tr></table>
  </td></tr></table>
<![endif]-->

<![if !((ie)|(mso))]>
  <div dir="ltr"  id="pfptBannerws0ab7o" style="all: revert !important; display:block !important; text-align: left !important; margin:16px 0px 16px 0px !important; padding:8px 16px 8px 16px !important; border-radius: 4px !important; min-width: 200px !important; background-color: #D0D8DC !important; background-color: #D0D8DC; border-top: 4px solid #90a4ae !important; border-top: 4px solid #90a4ae;">
    <div id="pfptBannerws0ab7o" style="all: unset !important; float:left !important; display:block !important; margin: 0px 0px 1px 0px !important; max-width: 600px !important;">
      <div id="pfptBannerws0ab7o" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-weight:bold !important; font-weight:bold; font-size:14px !important; line-height:18px !important; line-height:18px">
        This Message Is From an External Sender
      </div>
      <div id="pfptBannerws0ab7o" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-weight:normal; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-size:12px !important; line-height:18px !important; line-height:18px; margin-top:2px !important;">
This message came from outside your organization.
      </div>

    </div>

    <div style="clear: both !important; display: block !important; visibility: hidden !important; line-height: 0 !important; font-size: 0.01px !important; height: 0px"> </div>
  </div>
<![endif]>

<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerEnd</div>
<!-- Email Banner : END -->

<!-- BaNnErBlUrFlE-BoDy-end -->
<div dir="ltr"><div>Thanks for the suggestion. I don't have a factored matrix (and can't really use direct linear solvers) so 
<span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">MatSolveTranspose doesn't seem to be an option. </span></div><div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">I should have mentioned that I've also tried KSPSolveTranspose but that doesn't work with pcredistribute<br></span></div><div>/Carl-Johan<br></div>

</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 9, 2024 at 3:59 PM Zhang, Hong <<a href="mailto:hzhang@mcs.anl.gov">hzhang@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-7116380009172819183">




<div dir="ltr">
<div style="font-size:15px;color:rgb(36,36,36)">
<span style="background-color:rgb(255,255,255)">Carl-Johan</span><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">,</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">You can use MatSolveTranspose() to solve
</span><span style="font-size:15px;color:rgb(36,36,36);background-color:rgb(255,255,255)">A'*x = b</span><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">.
 See petsc/src/ksp/ksp/tutorials/ex79.c</span></div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">`MatCreateTranspose()` is used if you only need a matrix that behaves like the transpose,
 but don't need the storage to be changed, i.e., A and A' share same matrix storage, thus
</span><span style="font-size:15px;color:rgb(36,36,36);background-color:rgb(255,255,255)">MatGetRow()
</span><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">needs to get columns of A, which is not supported.</span></div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hong</div>
<div id="m_-7116380009172819183appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-7116380009172819183divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> petsc-users <<a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank">petsc-users-bounces@mcs.anl.gov</a>> on behalf of Carl-Johan Thore <<a href="mailto:carljohanthore@gmail.com" target="_blank">carljohanthore@gmail.com</a>><br>
<b>Sent:</b> Tuesday, April 9, 2024 6:38 AM<br>
<b>To:</b> petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> [petsc-users] MatCreateTranspose</font>
<div> </div>
</div>

<div>
<div style="display:none;font-size:1px;color:rgb(255,255,255);line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden">
Hi, I have a matrix A with transpose A' and would like to solve the linear system A'*x = b using the pcredistribute preconditioner. It seemed like a good idea to use MatCreateTranspose, but this leads to [0]PETSC ERROR: ---------------------
</div>
<div style="display:none;font-size:1px;color:rgb(255,255,255);line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden">
ZjQcmQRYFpfptBannerStart</div>
<div dir="ltr" id="m_-7116380009172819183x_pfptBannerwyat4vs" style="display:block;text-align:left;margin:16px 0px;padding:8px 16px;border-radius:4px;min-width:200px;background-color:rgb(208,216,220);border-top:4px solid rgb(144,164,174)">
<div id="m_-7116380009172819183x_pfptBannerwyat4vs" style="float:left;display:block;margin:0px 0px 1px;max-width:600px">
<div id="m_-7116380009172819183x_pfptBannerwyat4vs" style="display:block;background-color:rgb(208,216,220);color:rgb(0,0,0);font-family:"Arial",sans-serif;font-weight:bold;font-size:14px;line-height:18px">
This Message Is From an External Sender </div>
<div id="m_-7116380009172819183x_pfptBannerwyat4vs" style="display:block;background-color:rgb(208,216,220);color:rgb(0,0,0);font-weight:normal;font-family:"Arial",sans-serif;font-size:12px;line-height:18px;margin-top:2px">
This message came from outside your organization. </div>
</div>
<div style="clear:both;display:block;line-height:0;font-size:0.01px;height:0px">
 </div>
</div>
<div style="display:none;font-size:1px;color:rgb(255,255,255);line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden">
ZjQcmQRYFpfptBannerEnd</div>
<div dir="ltr">Hi,<br>
<br>
I have a matrix A with transpose A' and would like to solve the linear system A'*x = b using the pcredistribute preconditioner. It seemed like a good idea to use MatCreateTranspose, but this leads to<br>
<br>
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>
[0]PETSC ERROR: No support for this operation for this object type<br>
[0]PETSC ERROR: No method getrow for Mat of type transpose<br>
[0]PETSC ERROR: See <a href="https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!bVYrcPfbXSXCcthSH37OClTgnf7RxkizULEW1ZZJ5yYG3-50366x_OFSPmOgGWEcOeFyOmAMSFewAyCnxIUg7K8W_neRPw$" target="_blank">
https://petsc.org/release/faq/</a> for trouble shooting.<br>
[0]PETSC ERROR: Petsc Release Version 3.21.0, unknown<br>
[0]PETSC ERROR: Configure options COPTFLAGS="-O3 -march=native" CXXOPTFLAGS="-O3 -march=native" --with-fortran-bindings=0 FOPTFLAGS="-O3 -march=native" CUDAOPTFLAGS=-O3 --with-cuda --with-cusp --with-debugging=0 --download-scalapack --download-hdf5 --download-zlib
 --download-mumps --download-parmetis --download-metis --download-ptscotch --download-hypre --download-spai<br>
[0]PETSC ERROR: #1 MatGetRow() at /mnt/c/mathware/petsc/petsc-v3-21-0/src/mat/interface/matrix.c:573<br>
[0]PETSC ERROR: #2 PCSetUp_Redistribute() at /mnt/c/mathware/petsc/petsc-v3-21-0/src/ksp/pc/impls/redistribute/redistribute.c:111<br>
[0]PETSC ERROR: #3 PCSetUp() at /mnt/c/mathware/petsc/petsc-v3-21-0/src/ksp/pc/interface/precon.c:1079<br>
[0]PETSC ERROR: #4 KSPSetUp() at /mnt/c/mathware/petsc/petsc-v3-21-0/src/ksp/ksp/interface/itfunc.c:415<br>
<br>
MatTranspose is a working alternative, but MatCreateTranspose would be preferable. In principle the solution seems straightforward -- just add a getrow method -- but is it, and is it a good idea (performancewise etc)?<br>
<br>
Kind regards,<br>
Carl-Johan </div>
</div>
</div>

</div></blockquote></div>