Skip to main content
`Ctrl`+`K`

# MatMatSolve

Solves \(A X = B\), given a factored matrix.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatMatSolve(Mat A, Mat B, Mat X)

Neighbor-wise Collective

## Input Parameters

- A - the factored matrix

- B - the right-hand-side matrix `MATDENSE` (or sparse `MATAIJ`– when using MUMPS)

## Output Parameter

- X - the result matrix (dense matrix)

## Note

If `B` is a `MATDENSE` matrix then one can call `MatMatSolve`(A,B,B) except with `MATSOLVERMKL_CPARDISO`; otherwise, `B` and `X` cannot be the same.

## See Also

Matrices, `Mat`, Matrix Factorization, `MatGetFactor()`, `MatSolve()`, `MatMatSolveTranspose()`, `MatLUFactor()`, `MatCholeskyFactor()`

## Level

developer

## Location

src/mat/interface/matrix.c

## Examples

src/ksp/ksp/tutorials/ex77.c
src/ksp/ksp/tutorials/ex74.c
src/ksp/ksp/tutorials/ex77f.F90

## Implementations

MatMatSolve_MKL_CPARDISO() in src/mat/impls/aij/mpi/mkl_cpardiso/mkl_cpardiso.c
MatMatSolve_MUMPS() in src/mat/impls/aij/mpi/mumps/mumps.c
MatMatSolve_STRUMPACK() in src/mat/impls/aij/mpi/strumpack/strumpack.c
MatMatSolve_SuperLU_DIST() in src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c
MatMatSolve_SeqAIJ() in src/mat/impls/aij/seq/aijfact.c
MatMatSolve_MKL_PARDISO() in src/mat/impls/aij/seq/mkl_pardiso/mkl_pardiso.c
MatMatSolve_SPQR() in src/mat/impls/aij/seq/spqr/aijspqr.c
MatMatSolve_Elemental() in src/mat/impls/elemental/matelem.cxx
MatMatSolve_CHOLMOD() in src/mat/impls/sbaij/seq/cholmod/sbaijcholmod.c
MatMatSolve_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