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

Karl Lin karl.linkui at gmail.com
Tue Sep 1 11:18:32 CDT 2020


Thanks Jed.

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

> Karl Lin <karl.linkui at gmail.com> writes:
>
> > Thanks for the feedback. What about if I build A to have as many rows as
> A
> > and B and then later on use MatGetRow and MatSetValues to add B matrix
> > entries to A? Can MatGetRow and MatSetValues be used after MatAssembly is
> > called? B is much much smaller than A so the number of rows can be added
> to
> > just the portion of A on one process. Will this work? Thanks. Regards.
>
> That would work fine, you'll just need to MatAssembly after your new
> MatSetValues.
>
> Note that you'll likely want to think about the distribution of B relative
> to A; you may not want B to come "at the end" because it'll all be on the
> last rank, versus dispersed over the ranks.  This is especially true if
> those rows are heavier.
>
> > On Mon, Aug 31, 2020 at 11:00 PM Jed Brown <jed at jedbrown.org> wrote:
> >
> >> Karl Lin <karl.linkui at gmail.com> writes:
> >>
> >> > 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.
> >>
> >> No.
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200901/4df7a20f/attachment.html>


More information about the petsc-users mailing list