<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jun 22, 2016 at 9:21 AM, ehsan sadrfaridpour <span dir="ltr"><<a href="mailto:it.sadr@gmail.com" target="_blank">it.sadr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi,<br></div><br>If I use VecGetSubVector to get a subvector it works fine as far as I don't destroy the original vector.<br></div>But, if I destroy the original vector, I get NaN values. So, it is my misunderstanding of what the function suppose to do, or is it a problem?<br></div></div></div></div></blockquote><div><br></div><div>You cannot destroy the original vector since you still need to call</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecRestoreSubVector.html#VecRestoreSubVector">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecRestoreSubVector.html#VecRestoreSubVector</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div></div>I do the same thing with <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetSubMatrix.html#MatGetSubMatrix" style="font-family:"Times New Roman";font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)" target="_blank">MatGetSubMatrix</a> and I haven't had any problem with it.<br></div></div></div></blockquote><div><br></div><div>MatGetSubMatrix() is a hybrid since for INITIAL_MATRIX it creates a new matrix, whereas for REUSE_MATRIX it refills and existing</div><div>one. However there is not Restore().</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetSubMatrix.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetSubMatrix.html</a><br></div><div><br></div><div>   Matt</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div></div>Best,<br></div>Ehsan<br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">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></div>