> On Aug 31, 2020, at 2:08 PM, Kun Jiao <[email protected]> wrote: > > If I am correct, to do this, it will double the peak memory usage.
Yes > > Is there any way no to double the peak memory usage? The only way would be to destroy the old matrix, allocate a new one and recompute the entries. Barry Depending on the application etc the extra memory for storing two copies of the matrix may not be a fundamental problem. > > > > Schlumberger-Private > From: Barry Smith <[email protected] <mailto:[email protected]>> > Sent: Monday, August 31, 2020 1:56 PM > To: Kun Jiao <[email protected] <mailto:[email protected]>> > Cc: petsc-users <[email protected] <mailto:[email protected]>> > Subject: [Ext] Re: [petsc-users] change matrix > > > Kun, > > This is not possible, PETSc matrices have a static size (resizing in > parallel is tricky so we don't support it). > > If it is more efficient to reuse the matrix entries than recompute them > you can create a larger matrix and then loop over the old matrix calling > MatGetRow() and then call MatSetValues() to copy that row into the new matrix. > > Barry > > > > On Aug 31, 2020, at 1:51 PM, Kun Jiao via petsc-users > <[email protected] <mailto:[email protected]>> wrote: > > Hi Petsc Experts, > > Trying to do something like appending some rows (~100 rows) to an already > created matrix, but could not find any document about it. > > Could anyone provide some information about it? > > Regards, > Kun > > Schlumberger-Private
