MatTranspose#

Computes the transpose of a matrix, either in-place or out-of-place.

Synopsis#

#include "petscmat.h" 
PetscErrorCode MatTranspose(Mat mat, MatReuse reuse, Mat *B)

Collective

Input Parameters#

Output Parameter#

  • B - the transpose of the matrix

Notes#

If you use MAT_INPLACE_MATRIX then you must pass in &mat for B

MAT_REUSE_MATRIX uses the B matrix obtained from a previous call to this function with MAT_INITIAL_MATRIX to store the transpose. If you already have a matrix to contain the transpose, call MatTransposeSetPrecursor(mat, B) before calling this routine.

If the nonzero structure of mat changed from the previous call to this function with the same matrices an error will be generated for some matrix types.

Consider using MatCreateTranspose() instead if you only need a matrix that behaves like the transpose but don’t need the storage to be changed. For example, the result of MatCreateTranspose() will compute the transpose of the given matrix times a vector for matrix-vector products computed with MatMult().

If mat is unchanged from the last call this function returns immediately without recomputing the result

If you only need the symbolic transpose of a matrix, and not the numerical values, use MatTransposeSymbolic()

See Also#

Matrices, Mat, MatTransposeSetPrecursor(), MatMultTranspose(), MatMultTransposeAdd(), MatIsTranspose(), MatReuse, MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX, MAT_INPLACE_MATRIX, MatTransposeSymbolic(), MatCreateTranspose()

Level#

intermediate

Location#

src/mat/interface/matrix.c

Examples#

src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex65.c
src/ksp/ksp/tutorials/ex79.c
src/snes/tutorials/ex70.c
src/tao/pde_constrained/tutorials/parabolic.c
src/ksp/pc/tutorials/ex4.c
src/ksp/ksp/tutorials/ex74.c
src/ksp/ksp/tutorials/ex87.c
src/tao/pde_constrained/tutorials/hyperbolic.c

Implementations#

MatTranspose_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatTranspose_SeqAIJKokkos() in src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx
MatTranspose_SeqAIJ() in src/mat/impls/aij/seq/symtranspose.c
MatTranspose_MPIBAIJ() in src/mat/impls/baij/mpi/mpibaij.c
MatTranspose_SeqBAIJ() in src/mat/impls/baij/seq/baij.c
MatTranspose_MPIDense() in src/mat/impls/dense/mpi/mpidense.c
MatTranspose_SeqDense() in src/mat/impls/dense/seq/dense.c
MatTranspose_Elemental() in src/mat/impls/elemental/matelem.cxx
MatTranspose_Htool() in src/mat/impls/htool/htool.cxx
MatTranspose_IS() in src/mat/impls/is/matis.c
MatTranspose_Nest() in src/mat/impls/nest/matnest.c
MatTranspose_MPISBAIJ() in src/mat/impls/sbaij/mpi/mpisbaij.c
MatTranspose_SeqSBAIJ() in src/mat/impls/sbaij/seq/sbaij.c
MatTranspose_ScaLAPACK() in src/mat/impls/scalapack/matscalapack.c


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