<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000">Hi Pierre,<br><br>Thanks for your tip. <br>I don't have access to MATLAB. Would Octave also work? Or Python?<br><br>Regards,<br> Frederico.<br><br><div id="e1bde0fd-f1a5-4833-935b-0cc70f26a0a4" data-marker=""><div><style>/*<![CDATA[*/p.p1 {
        margin: 0.0px 0.0px 12.0px 0.0px;
        font: 8.5px Helvetica;
}
span.s1 {
}
/*]]>*/</style></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div style="text-align:left"><span style="font-size:x-small"></span><span style="font-size:x-small"><span style="font-size:x-small"></span></span><div style="text-align:left"><span style="font-size:11pt;font-family:'arial' , 'helvetica' , sans-serif;color:rgb( 0 , 0 , 0 );background-color:rgb( 255 , 255 , 255 )">Dr. Frederico Teixeira</span></div><div style="text-align:left"><span style="font-size:11pt;font-family:'arial' , 'helvetica' , sans-serif;background-color:rgb( 255 , 255 , 255 );color:rgb( 0 , 0 , 0 )">Computational Modeler and Software Developer, <a href="http://www.itis.swiss" style="background-color:rgb( 255 , 255 , 255 );color:rgb( 0 , 0 , 0 )" rel="nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer nofollow noopener noreferrer nofollow noopener noreferrer" target="_blank">ZMT</a> (member of <a href="https://www.z43.swiss" style="background-color:rgb( 255 , 255 , 255 );color:rgb( 0 , 0 , 0 )" rel="nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer nofollow noopener noreferrer nofollow noopener noreferrer" target="_blank">Zurich43</a>)</span></div><div style="text-align:left"><span style="font-size:11pt;font-family:'arial' , 'helvetica' , sans-serif;background-color:rgb( 255 , 255 , 255 );color:rgb( 0 , 0 , 0 )"><br></span></div><div style="text-align:left">







<p class="p1"><span class="s1" style="font-size:11pt;font-family:'arial' , 'helvetica' , sans-serif;background-color:rgb( 255 , 255 , 255 );color:rgb( 0 , 0 , 0 )">P +41 44 245 9698<br>
Zeughausstrasse 43, 8004 Zurich, Switzerland</span></p></div></div></div><br><hr id="zwchr" data-marker=""><div data-marker=""><b>From: </b>"Pierre Jolivet" <pierre@joliv.et><br><b>To: </b>"Frederico Teixeira" <teixeira@zmt.swiss><br><b>Cc: </b>"petsc-users" <petsc-users@mcs.anl.gov><br><b>Sent: </b>Tuesday, May 11, 2021 6:03:20 PM<br><b>Subject: </b>Re: [petsc-users] Binary format in real vs. complex scalar type configurations<br></div><br><div data-marker="">Hello Frederico,<div class="">I’m not sure that’s possible.</div><div class="">Here is what I do, it makes me sick, but mixing precisions/scalar types with PETSc is difficult (crossing my fingers this will be better with future).</div><div class="">In MATLAB (after putting petsc/share/petsc/matlab in the path):</div><div class="">A = PetscBinaryRead('your_binary_mat_with_re+im.dat','complex',true); % scalar-type=complex</div><div class="">PetscBinaryWrite('re.dat',real(A)); % scalar-type=real</div><div class="">PetscBinaryWrite('im.dat',imag(A)); % scalar-type=real</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Pierre</div><div class=""><br class=""><div><blockquote class=""><div class="">On 11 May 2021, at 3:30 PM, Frederico Teixeira <<a href="mailto:teixeira@zmt.swiss" target="_blank" rel="nofollow noopener noreferrer">teixeira@zmt.swiss</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="font-family:'arial' , 'helvetica' , sans-serif;font-size:12pt" class=""><div class=""><div class=""><div class=""><div class="">Dear fellows,<br class=""></div></div></div></div><div class=""><div style="font-family:'arial' , 'helvetica' , sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb( 255 , 255 , 255 )" class=""><div class=""><br class=""></div><div class="">I hope this message finds you safe and well.</div><div class=""><br class=""></div><div class="">I have<span style="font-family:'arial' , 'helvetica' , sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb( 255 , 255 , 255 );float:none;display:inline !important" class=""> </span><span style="font-size:12pt" class="">a complex-valued matrix and its real/imaginary components<span class=""> </span><span style="font-family:'arial' , 'helvetica' , sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb( 255 , 255 , 255 );float:none;display:inline !important" class="">in </span><span style="font-family:'arial' , 'helvetica' , sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb( 255 , 255 , 255 );float:none;display:inline !important" class="">binary format</span></span><span style="font-size:12pt" class="">. They were extracted from a solver that only works with "scalar-type=complex" configuration.</span></div><div class="">I am getting weird results when I load them into a small test program that's configured with "scalar-type=real", but I believe this is expected.</div><div class="">At the end of the day, I would like to have both real and imaginary components as real-valued matrices.</div><div class="">Is it possible to do it? I want to<span style="font-family:'arial' , 'helvetica' , sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb( 255 , 255 , 255 );float:none;display:inline !important" class=""> test preconditioners that are tailored for this sort of problem.</span></div><div class=""><br class=""></div><div class="">Regards,</div><div class=""> Frederico.</div></div><span class="s1" style="font-family:'arial' , 'helvetica' , sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:11pt;background-color:rgb( 255 , 255 , 255 )"></span><div class=""><br class=""></div></div></div></div></div></blockquote></div><br class=""></div><br></div></div></body></html>