block matrices

Jed Brown jed at
Mon Sep 22 03:43:57 CDT 2008

On Sun 2008-09-21 12:11, Manav Bhatia wrote:
> B = 3 x 3 blocks
> row 1 of B = 0, S1, 0
> row 2 of B = S2, 0 , S3
> row 3 of B = S4, S5, 0

What sort of preconditioner do you intend to use?  If you are using a
direct solver, then you will need to explicitly assemble B.  This can be
done in a black-box manner from the sub-matrices, but it might be better
to assemble B and extract the submatrices using MatGetSubMatrix()
(assuming you need them elsewhere).  If you will be using an iterative
solver, normal preconditioners will fail because the matrix is
indefinite.  In this case, you can create a MATSHELL (which implements
MatMult, the action of B on a vector) and a PCSHELL which approximately
inverts B using a block factorization.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the petsc-users mailing list