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" 
int MatGetSubMatrices(Mat mat,int n,IS *irow,IS *icol,MatReuse scall,Mat **submat)
Collective on Mat

Input Parameters

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

Output Parameter

submat -the array of submatrices

Notes

MatGetSubMatrices() can extract only sequential submatrices (from both sequential and parallel matrices). Use MatGetSubMatrix() to extract a parallel submatrix.

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

When finished using the submatrices, the user should destroy them with MatDestroyMatrices().

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

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

Fortran Note

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

See Also

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

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