<div dir="ltr"><div dir="ltr">On Mon, Feb 4, 2019 at 11:16 AM Marco Tiberga via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-GB">
<div class="gmail-m_7990541166302827756WordSection1">
<p class="MsoNormal">Dear PETSc developers,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Since I am learning how to use MatCreateNest, I was looking at example
<a href="https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex73f90t.F90.html" target="_blank">
ex73f90t.F90</a> (I am using Fortran).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">At line 297, the array of matrices to be passed to MatCreateNest is initialized with code lines as “matArray(1) = Amat”.</p></div></div></blockquote><div><br></div><div>That is a pointer. It does not create a replica in memory, as the calls below do. Fortran is not explicit about this distinction</div><div>which can lead to confusion.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</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 lang="EN-GB"><div class="gmail-m_7990541166302827756WordSection1"><p class="MsoNormal"> </p><p class="MsoNormal"><u></u></p>
<p class="MsoNormal">I was surprised to find such a simple command, I thought a matrix copy should be done by a sequence like<u></u><u></u></p>
<p class="MsoNormal">“ call MatDuplicate(Amat, MAT_SHARE_NONZERO_PATTERN,matArray(1),ierr); CHKERRA(ierr)<u></u><u></u></p>
<p class="MsoNormal"> call MatCopy(Amat,matArray(1), SAME_NONZERO_PATTERN,ierr); CHKERRA(ierr) “<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">So, I was wondering: are the two ways completely equivalent, and therefore the second unnecessarily more complex? or is the latter more robust and therefore preferable?<u></u><u></u></p>
<p class="MsoNormal">Is there any difference in terms of performance?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks a lot for the clarification.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
<p class="MsoNormal" style="margin-bottom:4pt"><span>Marco Tiberga<u></u><u></u></span></p>
<p class="MsoNormal"><span>PhD candidate<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(0,176,240)">Delft University of Technology<u></u><u></u></span></p>
<p class="MsoNormal"><span>Faculty of Applied Sciences<u></u><u></u></span></p>
<p class="MsoNormal"><span>Radiation Science & Technology Department</span><span><u></u><u></u></span></p>
<p class="MsoNormal"><span>Mekelweg 15, 2629 JB Delft, The Netherlands</span><span><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:2pt"><span>E-Mail:<span style="color:gray"> </span><u><span style="color:blue"><a href="mailto:m.tiberga@tudelft.nl" target="_blank"><span style="color:blue">m.tiberga@tudelft.nl</span></a></span></u></span><span style="font-family:"Segoe UI",sans-serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="NL">Website: </span>
<span><a href="http://www.nera.rst.tudelft.nl/" target="_blank"><span lang="NL" style="color:blue">http://www.nera.rst.tudelft.nl/</span></a></span><span lang="NL"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="NL"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="NL"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="NL"><u></u> <u></u></span></p>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>