<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 11, 2021, at 3:08 PM, Frederico Teixeira <<a href="mailto:teixeira@zmt.swiss" class="">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="">Hi Pierre,<br class=""><br class="">Thanks for your tip. <br class="">I don't have access to MATLAB. Would Octave also work? Or Python?<br class=""></div></div></div></blockquote><div><br class=""></div> Yes, they should both be fine. All you need to is split the matrix into the 2 matrices in Octave or Python and then save both of them with the PETSc real format configure.</div><div><br class=""></div><div> Barry</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;" class=""><br class="">Regards,<br class=""> Frederico.<br class=""><br class=""><div id="e1bde0fd-f1a5-4833-935b-0cc70f26a0a4" data-marker="" class=""><div class=""><style class="">/*<![CDATA[*/p.p1 {
margin: 0.0px 0.0px 12.0px 0.0px;
font: 8.5px Helvetica;
}
span.s1 {
}
/*]]>*/</style></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div class=""></div><div style="text-align:left" class=""><span style="font-size:x-small" class=""></span><span style="font-size:x-small" class=""><span style="font-size:x-small" class=""></span></span><div style="text-align:left" class=""><span style="font-size: 11pt; font-family: arial, helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">Dr. Frederico Teixeira</span></div><div style="text-align:left" class=""><span style="font-size: 11pt; font-family: arial, helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">Computational Modeler and Software Developer, <a href="http://www.itis.swiss/" style="background-color: rgb(255, 255, 255);" rel="nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer nofollow noopener noreferrer nofollow noopener noreferrer" target="_blank" class="">ZMT</a> (member of <a href="https://www.z43.swiss/" style="background-color: rgb(255, 255, 255);" rel="nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer%20nofollow%20noopener%20noreferrer nofollow noopener noreferrer nofollow noopener noreferrer" target="_blank" class="">Zurich43</a>)</span></div><div style="text-align:left" class=""><span style="font-size: 11pt; font-family: arial, helvetica, sans-serif; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div style="text-align:left" class=""><p class="p1"><span class="s1" style="font-size: 11pt; font-family: arial, helvetica, sans-serif; background-color: rgb(255, 255, 255);">P +41 44 245 9698<br class="">
Zeughausstrasse 43, 8004 Zurich, Switzerland</span></p></div></div></div><br class=""><hr id="zwchr" data-marker="" class=""><div data-marker="" class=""><b class="">From: </b>"Pierre Jolivet" <<a href="mailto:pierre@joliv.et" class="">pierre@joliv.et</a>><br class=""><b class="">To: </b>"Frederico Teixeira" <<a href="mailto:teixeira@zmt.swiss" class="">teixeira@zmt.swiss</a>><br class=""><b class="">Cc: </b>"petsc-users" <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>><br class=""><b class="">Sent: </b>Tuesday, May 11, 2021 6:03:20 PM<br class=""><b class="">Subject: </b>Re: [petsc-users] Binary format in real vs. complex scalar type configurations<br class=""></div><br class=""><div data-marker="" class="">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 class=""><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" class="">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 class=""></div></div></div></div></blockquote></div><br class=""></body></html>