petsc-3.7.1 2016-05-15
Report Typos and Errors

# MatGetSubMatrices

Extracts several submatrices from a matrix. If submat points to an array of valid matrices, they may be reused to store the new submatrices.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode MatGetSubMatrices(Mat mat,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *submat[])

Collective on Mat Many br

### Input Parameters

| mat | - the matrix Many br
| n | - the number of submatrixes to be extracted (on this processor, may be zero) Many br
| irow, icol | - index sets of rows and columns to extract Many br
| scall | - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX Many br

### Output Parameter

submat -the array of submatrices Many br

### Notes

MatGetSubMatrices() can extract ONLY sequential submatrices Many br(from both sequential and parallel matrices). Use MatGetSubMatrix() Many brto extract a parallel submatrix. Many br

Some matrix types place restrictions on the row and column Many brindices, such as that they be sorted or that they be equal to each other. Many br

The index sets may not have duplicate entries. Many br

When extracting submatrices from a parallel matrix, each processor can Many brform a different submatrix by setting the rows and columns of its Many brindividual index sets according to the local submatrix desired. Many br

When finished using the submatrices, the user should destroy Many brthem with MatDestroyMatrices(). Many br

MAT_REUSE_MATRIX can only be used when the nonzero structure of the Many broriginal matrix has not changed from that last call to MatGetSubMatrices(). Many br

This routine creates the matrices in submat; you should NOT create them before Many brcalling it. It also allocates the array of matrix pointers submat. Many br

For BAIJ matrices the index sets must respect the block structure, that is if they Many brrequest one row/column in a block, they must request all rows/columns that are in Many brthat block. For example, if the block size is 2 you cannot request just row 0 and Many brcolumn 0. Many br

### Fortran Note

The Fortran interface is slightly different from that given below; it Many brrequires one to pass in as submat a Mat (integer) array of size at least m. Many br

Many br

### See Also

MatDestroyMatrices(), MatGetSubMatrix(), MatGetRow(), MatGetDiagonal(), MatReuse

Level:advanced
Location:src/mat/interface/matrix.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages