:orphan: # 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 ## 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 Parameter - ***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 [](ch_matrices), `Mat`, `MatGetOrdering()`, `ISAllGather()`, `MatCreateSubMatrix()` ## Level advanced ## Location src/mat/interface/matrix.c ## Examples src/ksp/ksp/tutorials/ex10.c
src/ksp/ksp/tutorials/ex18.c
## 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_NormalHermitian in src/mat/impls/normal/normmh.c
MatPermute_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/interface/matrix.c) [Index of all Mat routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)