[petsc-users] Matrix reuse with changing structure

Matthew Knepley knepley at gmail.com
Tue Mar 15 12:28:57 CDT 2016


On Tue, Mar 15, 2016 at 12:24 PM, Smith, Kevin R. <Kevin.R.Smith at jhuapl.edu>
wrote:

> Hello,
>
>
>
> Is it possible to reuse a sparse matrix and not reuse its non-zero
> structure?   I have a matrix whose sparse structure changes each time. I’m
> hoping to avoid destroying and allocating new matrices each time the
> structure changes.
>

Hmm, I can't find a toplevel API that does this (it would be something like
MatReset()). You can get this effect using

  MatSetType(A, MATSHELL)
  MatSetType(A, <type you had before>)

A little messy but it will work.

  Thanks,

     Matt


>
>
> Thanks,
>
>   Kevin
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160315/1eec3045/attachment.html>


More information about the petsc-users mailing list