<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 14, 2022 at 11:29 AM feng wang <<a href="mailto:snailsoar@hotmail.com">snailsoar@hotmail.com</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 dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks for the clarification. any recommendations to get around this?</div></div></blockquote><div><br></div><div>I would look at the existing code and see if you can see what is limiting it to real (comments hopefully), if it looks like something you could do, start with a git repo of PETSc, configure with complex scalar values, modify an existing test or make your own to test it, and make it work.</div><div>At that point you can contribute that to PETSc (there is documentation on how to do that including our coding practices that you should be able to infer to a large extent from the code you are modifying).</div><div>At that point PETSc will maintain it.</div><div><br></div><div>Mark</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I am solving a set of linear systems of A_i x_i = B_i with matrix-based GMRES. The entries of A_i and B_i are complex numbers. It is pre-conditioned with ASM and the preconditioning matrix is A_i itself. I would like to show the Ritz value to understand the
 convergence behaviour for each A_i x_i = B_i. <br>
</div>
<div id="gmail-m_-1043195788443702311appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-1043195788443702311divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>><br>
<b>Sent:</b> 14 July 2022 14:16<br>
<b>To:</b> feng wang <<a href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] KSPComputeRitz, GMRES, matrix with complex number</font>
<div> </div>
</div>
<div>
<div dir="ltr">No. I missed that note.
<div>Complex has not been implemented.</div>
<div><br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Thu, Jul 14, 2022 at 9:54 AM feng wang <<a href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Mark,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks for your reply! <br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Maybe I have a misunderstanding of the documentation of KSPComputeRitz (<a href="https://petsc.org/main/docs/manualpages/KSP/KSPComputeRitz/" id="gmail-m_-1043195788443702311x_gmail-m_6877891815980076493LPlnk308872" target="_blank">https://petsc.org/main/docs/manualpages/KSP/KSPComputeRitz/</a>). 
 It says "-this is currently not implemented when PETSc is built with complex numbers".
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
But if it works, I will give it a try.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Feng<br>
<pre><span><br></span></pre>
<pre><span><a href="https://petsc.org/main/docs/manualpages/KSP/KSPComputeRitz/" target="_blank"></a></span></pre>
<br>
</div>
<div id="gmail-m_-1043195788443702311x_gmail-m_6877891815980076493appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-1043195788443702311x_gmail-m_6877891815980076493divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>><br>
<b>Sent:</b> 14 July 2022 12:23<br>
<b>To:</b> feng wang <<a href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] KSPComputeRitz, GMRES, matrix with complex number</font>
<div> </div>
</div>
<div>
<div dir="ltr">Why do you say it only works with Real? You need to configure PETSc to use complex numbers and it should work.
<div>This is an advanced method and it does not have any tests, which basically says it is very experimental.</div>
<div>Don't expect it to be very robust.</div>
<div><br>
<div>Mark</div>
</div>
</div>
<br>
<div>
<div dir="ltr">On Thu, Jul 14, 2022 at 7:19 AM feng wang <<a href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Dear All,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I am using GMRES with complex numbers and would like to compute the Ritz values.<span> I am looking at
<a href="https://petsc.org/main/docs/manualpages/KSP/KSPComputeRitz/" target="_blank">
KSPComputeRitz</a>  and it seems to me that it only works with Petsc compiled with real numbers. Is there an easy alternative way to compute Ritz values for matrices with complex numbers?</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Feng<br>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>

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