[petsc-users] Accessing submatrices without additional memory usage

Matthew Knepley knepley at gmail.com
Wed May 24 06:55:29 CDT 2017


On Wed, May 24, 2017 at 1:09 AM, Michal Derezinski <mderezin at ucsc.edu>
wrote:

> Hi,
>
> I want to be able to perform matrix operations on several contiguous
> submatrices of a full matrix, without allocating the memory redundantly for
> the submatrices (in addition to the memory that is already allocated for
> the full matrix).
> I tried using MatGetSubMatrix, but this function appears to allocate the
> additional memory.
>
> The other way I found to do this is to create the smallest submatrices I
> need first, then use MatCreateNest to combine them into bigger ones
> (including the full matrix).
> The documentation of MatCreateNest seems to indicate that it does not
> allocate additional memory for storing the new matrix.
> Is this the right approach, or is there a better one?
>

Yes, that is the right approach.

  Thanks,

    Matt


> Thanks,
> Michal Derezinski.
>



-- 
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

http://www.caam.rice.edu/~mk51/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170524/4f40db1e/attachment.html>


More information about the petsc-users mailing list