<div class="gmail_quote">On Wed, Jul 6, 2011 at 08:20, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> >> Do not call MatZeroEntries on a freshly created matrix (that destroys the preallocation pattern) so skip the MatZeroEntries the first time.<br>
> I found an earlier thread (<a href="http://lists.mcs.anl.gov/pipermail/petsc-users/2011-April/008566.html" target="_blank">http://lists.mcs.anl.gov/pipermail/petsc-users/2011-April/008566.html</a>) where you said that it would not destroy the preallocation too.<br>
><br>
> So is the behavior different in the dev version ?<br>
<br>
</div> Just try it.</blockquote><div><br></div><div>PetscErrorCode MatZeroEntries_SeqAIJ(Mat A)</div><div>{</div><div> Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; </div><div> PetscErrorCode ierr;</div><div><br></div>
<div> PetscFunctionBegin; </div><div> ierr = PetscMemzero(a->a,(a->i[A->rmap->n])*sizeof(PetscScalar));CHKERRQ(ierr);</div><div> PetscFunctionReturn(0);</div><div>}</div><div><br></div><div>This does not touch indices, therefore it does not destroy preallocation information. I can't think of a format where this operation would naturally destroy the information.</div>
</div>