<div dir="ltr">Since user callbacks, such as the one to compute the Jacobian, are now supposed to modify matrices in place, we need to provide the equivalent of MatReset() so that the user can do things like reset the sparsity pattern, etc. <span style="font-size:13.1999998092651px">What should that call do? </span><div><br></div><div>I assume it would keep the type, sizes and the block size of the matrix and reset everything else.   The impl-specific stuff is handled by MatDestroy(), but what about the generic data members?  I imagine that the structural properties, such as symmetry and others set with MatSetOption() as well as MatFactorType and MatStencilInfo should be preserved, while MatRedundant and the (Near)NullSpace have to go. What about the logging info? num_ass?  Do we increment nonzerostate or reset it?  The PetscObject state? I don't know what to do about the GPU pointers.</div><div><br></div><div>While MatReset() isn't yet available,  <span style="font-size:13.1999998092651px">MatSetType(mat,newtype); MatSetType(mat,oldtype); should have the same effect, </span></div><div><span style="font-size:13.1999998092651px">but it doesn't, which to me is a bug and I'd like to fix it in maint.</span></div><div><span style="font-size:13.1999998092651px">It would be good, however, to do it "right" by answering the questions</span><span style="font-size:13.1999998092651px"> above.  Any opinions?</span></div><div><span style="font-size:13.1999998092651px"><br></span></div><div>Dmitry.</div><div><br></div></div>