[petsc-users] is there a function to append matrix

Karl Lin karl.linkui at gmail.com
Mon Aug 31 22:58:13 CDT 2020


I guess another way to look at this is if I already build matrix A and
MatAssembly has been called. Can I populate more rows to matrix A later on?
With the number of columns and column ownership pattern not changed of
course. Thank you.

On Mon, Aug 31, 2020 at 10:29 PM Jed Brown <jed at jedbrown.org> wrote:

> Karl Lin <karl.linkui at gmail.com> writes:
>
> > If I have two matrix A and B with the same number of columns, same
> > distribution pattern (column ownership pattern) among processes but
> > different number of rows, is there a function to append B to A to make a
> > new matrix C = [A; B]? Thanks.
>
> Sort of; you can create a MatNest with the two matrices and (optionally)
> convert to AIJ format.
>
> Better, you can take the code that builds A and B, but call it on "local"
> submatrices; see MatGetLocalSubMatrix() or an example like
> src/snes/tutorials/ex28.c.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200831/c69d9e90/attachment.html>


More information about the petsc-users mailing list