get several submatrices from several matrices and combine submatrices into another matrix

Matthew Knepley knepley at
Wed Dec 31 10:56:01 CST 2008

Yes, you can have 0 length IS arguments.


On Wed, Dec 31, 2008 at 10:21 AM, Yujie <recrusader at> wrote:

> Hi, PETSc Developers
> In parallel mode, I have 3 MPIDense matrices, A1, A2, A3. Now, I need to
> exact submatrices B1, B2, B3 in parallel mode from A1, A2, A3 respectively.
> I know I should use MatGetSubMatrix(). My problem is in
> MatGetSubMatrix(Mat mat,IS isrow,IS iscol,PetscInt csize,MatReuse cll,Mat *newmat)
> , the parameter "isrow" means "rows this processor should obtain". if Bi in
> some nodes (cpus) of the cluster (Ai have rows in them) don't have rows, is
> it work?
> After getting Bi, I will create MPIDense-based C and combine them into C
> like
>      B1
> C= B2
>      B3
> MatGetRow();
> MatSetValues() should work, right?
> Could you give me some comments about these operations? thanks a lot. Happy
> new year!
> Regards,
> Yujie

What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-users mailing list