MatGetSubMatrix question

Jed Brown jed at
Wed May 27 07:58:43 CDT 2009

Barry Smith wrote:
> On May 26, 2009, at 6:30 PM, Lisandro Dalcin wrote:
>> On Tue, May 26, 2009 at 7:03 PM, Barry Smith <bsmith at> wrote:
>>>   I think this change may make sense. The switch would be done by
>>> putting
>>> the ISAllGather() inside each current implementation. (The current
>>> implementations are already not scalable, so this will not change that).
>>>   Anybody want to try this change?
>> But then you are forcibly introducing a non-scalable ISAllGather() on
>> every call to MatGetSubMatrix(). No chance to factor-out this
>> operation if you need to get submatrices many times in the case
>> nonzero-patterns and submat-indices never changing.
>    Hmm, we could stash the isallgathered version inside the submatrix
> and then use a "state" value in the IS passed in to
> determine if the is was changed and if not simply reuse the stashed
> isallgathered version.

It seems to me that with MAT_REUSE_MATRIX, the user is asserting that
they are the same.  In debug mode (at least) we should confirm that this
is indeed so, but that's a local operation.  Checking 'state' would be a
way to skip this check, but I'm not convinced it's a necessary

In the process of making this change, I'm updating a couple of the IS
man pages for their meaning in parallel.  While figuring out that
precise meaning, I noticed that the min and max fields of IS can be
removed, they are only used here:

1112:      if (ix->min >= start && ix->max < end) islocal = PETSC_TRUE; else islocal = PETSC_FALSE;
1329:      if (iy->min >= start && iy->max < end) islocal = PETSC_TRUE; else islocal = PETSC_FALSE;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the petsc-dev mailing list