MatDenseGetSubMatrix#

Gives access to a block of rows and columns of a dense matrix, represented as a Mat.

Synopsis#

#include "petscmat.h" 
PetscErrorCode MatDenseGetSubMatrix(Mat A, PetscInt rbegin, PetscInt rend, PetscInt cbegin, PetscInt cend, Mat *v)

Collective

Input Parameters#

  • mat - the Mat object

  • rbegin - the first global row index in the block (if PETSC_DECIDE, is 0)

  • rend - the global row index past the last one in the block (if PETSC_DECIDE, is M)

  • cbegin - the first global column index in the block (if PETSC_DECIDE, is 0)

  • cend - the global column index past the last one in the block (if PETSC_DECIDE, is N)

Output Parameter#

  • v - the matrix

Notes#

The matrix is owned by PETSc. Users need to call MatDenseRestoreSubMatrix() when the matrix is no longer needed.

The output matrix is not redistributed by PETSc, so depending on the values of rbegin and rend, some processes may have no local rows.

See Also#

Matrices, Mat, MATDENSE, MATDENSECUDA, MATDENSEHIP, MatDenseGetColumnVec(), MatDenseRestoreColumnVec(), MatDenseRestoreSubMatrix()

Level#

intermediate

Location#

src/mat/impls/dense/seq/dense.c

Implementations#

MatDenseGetSubMatrix_MPIDense in src/mat/impls/dense/mpi/mpidense.c
MatDenseGetSubMatrix_SeqDense in src/mat/impls/dense/seq/dense.c


Edit on GitLab

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages