[petsc-users] Global matrix from global sub-matrices

Jed Brown jed at jedbrown.org
Tue May 5 15:38:58 CDT 2015


Bikash Kanungo <bikash at umich.edu> writes:

> Hi,
>
> I have four global matrices: A (mxm), B (mxn), C (nxm) and D (nxn). All of
> these are of type MATMPIAIJ (sparse parallel matrix) created using number
> of global rows and columns. I want to construct an (m+n)x(m+n) global
> matrix called M which would have A, B, C and D as its sub-matrices in
> clockwise fashion starting from A at the upper-left. What can be the best
> way to construct M from A, B, C and D sub-matrices?

You can build it with MatNest, but that format is constraining so unless
you understand the tradeoffs for different preconditioning techniques
applied to your specific problem, you should instead allocate the big
matrix, use MatGetLocalSubMatrix() to get references to the logical
blocks, and call your functions that assemble each of A,B,C,D.  See
src/snes/examples/tutorials/ex28.c for an example of this organization.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150505/aed00bf5/attachment.pgp>


More information about the petsc-users mailing list