<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">All the solvers/matrices/vectors works for PetscScalar types (i.e. in your case complex)<div class="">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 class="">You should not be worried about doubling the memory for a matrix (i.e. real and imaginary part)</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 26, 2020, at 11:28 PM, Sam Guo <<a href="mailto:sam.guo@cd-adapco.com" class="">sam.guo@cd-adapco.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">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 class=""><br class="">On Tuesday, May 26, 2020, Zhang, Hong <<a href="mailto:hzhang@mcs.anl.gov" class="">hzhang@mcs.anl.gov</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr" class="">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
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" class="">
version</span>, and declare some variables as 'PETSC_REAL'.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Hong</div>
<div class=""></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<hr style="display:inline-block;width:98%" class="">
<div dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size:11pt" class=""><b class="">From:</b> petsc-users <<a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank" class="">petsc-users-bounces@mcs.anl.<wbr class="">gov</a>> on behalf of Sam Guo <<a href="mailto:sam.guo@cd-adapco.com" target="_blank" class="">sam.guo@cd-adapco.com</a>><br class="">
<b class="">Sent:</b> Tuesday, May 26, 2020 1:00 PM<br class="">
<b class="">To:</b> PETSc <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" class="">petsc-users@mcs.anl.gov</a>><br class="">
<b class="">Subject:</b> [petsc-users] using real and complex together</font>
<div class=""> </div>
</div>
<div class="">
<div dir="ltr" class="">Dear PETSc dev team,
<div class="">   Can I use both real and complex versions together?</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Sam</div>
</div>
</div>
</div>

</blockquote>
</div></blockquote></div><br class=""></div></body></html>