petsc-3.15.0 2021-04-05
Report Typos and Errors

# MatMatSolve

Solves A X = B, given a factored matrix.

### Synopsis

```#include "petscmat.h"
PetscErrorCode MatMatSolve(Mat A,Mat B,Mat X)
```
Neighbor-wise Collective on Mat

### Input Parameters

 A - the factored matrix B - the right-hand-side matrix MATDENSE (or sparse -- when using MUMPS)

### Output Parameter

 X - the result matrix (dense matrix)

### Notes

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

### Notes

Most users should usually employ the simplified KSP interface for linear solvers instead of working directly with matrix algebra routines such as this. See, e.g., KSPCreate(). However KSP can only solve for one vector (column of X) at a time.

MatMatSolveTranspose(), MatLUFactor(), MatCholeskyFactor()

developer

### Location

src/mat/interface/matrix.c

### Examples

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

### Implementations

MatMatSolve_MUMPS in src/mat/impls/aij/mpi/mumps/mumps.c
MatMatSolve_STRUMPACK in src/mat/impls/aij/mpi/strumpack/strumpack.c
MatMatSolve_SeqAIJ in src/mat/impls/aij/seq/aijfact.c
MatMatSolve_SuperLU in src/mat/impls/aij/seq/superlu/superlu.c
MatMatSolve_SeqDenseCUDA in src/mat/impls/dense/seq/cuda/densecuda.cu
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