On Wed, Jun 22, 2016 at 9:21 AM, ehsan sadrfaridpour <[email protected]> wrote:
> Hi, > > If I use VecGetSubVector to get a subvector it works fine as far as I > don't destroy the original vector. > 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? > You cannot destroy the original vector since you still need to call http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecRestoreSubVector.html#VecRestoreSubVector > I do the same thing with MatGetSubMatrix > <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetSubMatrix.html#MatGetSubMatrix> > and I haven't had any problem with it. > MatGetSubMatrix() is a hybrid since for INITIAL_MATRIX it creates a new matrix, whereas for REUSE_MATRIX it refills and existing one. However there is not Restore(). http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetSubMatrix.html Matt Best, > Ehsan > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
