PETSc version 3.17.5
Fix/Edit manual page

MatPermute

Creates a new matrix with rows and columns permuted from the original.

Synopsis

#include "petscmat.h" 
PetscErrorCode MatPermute(Mat mat,IS row,IS col,Mat *B)
Collective on Mat

Input Parameters

mat - the matrix to permute
row - row permutation, each processor supplies only the permutation for its rows
col - column permutation, each processor supplies only the permutation for its columns

Output Parameters

B - the permuted matrix

Note

The index sets map from row/col of permuted matrix to row/col of original matrix. The index sets should be on the same communicator as Mat and have the same local sizes.

Developer Note

If you want to implement MatPermute for a matrix type, and your approach doesn't exploit the fact that row and col are permutations, consider implementing the more general MatCreateSubMatrix() instead.

See Also

MatGetOrdering(), ISAllGather()

Level

advanced

Location

src/mat/interface/matrix.c

Examples

src/ksp/ksp/tutorials/ex10.c.html
src/ksp/ksp/tutorials/ex18.c.html

Implementations

MatPermute_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatPermute_SeqAIJ in src/mat/impls/aij/seq/aij.c
MatPermute_MPIBAIJ in src/mat/impls/baij/mpi/mpibaij.c
MatPermute_Normal in src/mat/impls/normal/normm.c
MatPermute_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.c

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