Thanks<br><br>On Tuesday, May 26, 2020, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">All the solvers/matrices/vectors works for PetscScalar types (i.e. in your case complex)<div>If you need to solve for the real part only, you can duplicate the matrix and call MatRealPart to zero out the imaginary part. But the solve will always run in the complex space</div><div>You should not be worried about doubling the memory for a matrix (i.e. real and imaginary part)</div><div><br><div><br><blockquote type="cite"><div>On May 26, 2020, at 11:28 PM, Sam Guo <<a href="mailto:sam.guo@cd-adapco.com" target="_blank">sam.guo@cd-adapco.com</a>> wrote:</div><br><div>complex version is needed since matrix sometimes is real and sometimes is complex. I want to solve real matrix without allocating memory for imaginary part((except eigen pairs).<br><br>On Tuesday, May 26, 2020, Zhang, Hong <<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
You can build PETSc with complex <span style="color:rgb(50,49,48);font-family:"Segoe UI","Segoe UI Web (West European)","Segoe UI",-apple-system,system-ui,Roboto,"Helvetica Neue",sans-serif;background-color:rgb(255,255,255);display:inline!important">
version</span>, and declare some variables as 'PETSC_REAL'.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
Hong</div>
<div></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b> petsc-users <<a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank">petsc-users-bounces@mcs.anl.g<wbr>ov</a>> on behalf of Sam Guo <<a href="mailto:sam.guo@cd-adapco.com" target="_blank">sam.guo@cd-adapco.com</a>><br>
<b>Sent:</b> Tuesday, May 26, 2020 1:00 PM<br>
<b>To:</b> PETSc <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> [petsc-users] using real and complex together</font>
<div> </div>
</div>
<div>
<div dir="ltr">Dear PETSc dev team,
<div> Can I use both real and complex versions together?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Sam</div>
</div>
</div>
</div>
</blockquote>
</div></blockquote></div><br></div></div></blockquote>