petsc-master 2019-09-16
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 (dense matrix)

### Output Parameter

X -the result matrix (dense matrix)

### Notes

The matrices b and x cannot be the same. I.e., one cannot call MatMatSolve(A,x,x).

### 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.

When using SuperLU_Dist as a parallel solver PETSc will use the SuperLU_Dist functionality to solve multiple right hand sides simultaneously. For MUMPS it calls a separate solve for each right hand side since MUMPS does not yet support distributed right hand sides.

Since the resulting matrix X must always be dense we do not support sparse representation of the matrix B.

MatMatSolveTranspose(), MatLUFactor(), MatCholeskyFactor()

developer

### Location

src/mat/interface/matrix.c

### Examples

src/ksp/ksp/examples/tutorials/ex74.c.html

### 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_inplace in src/mat/impls/aij/seq/aijfact.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_SuperLU in src/mat/impls/aij/seq/superlu/superlu.c
MatMatSolve_SeqDenseCUDA in src/mat/impls/dense/seq/cuda/densecuda.cu
MatMatSolve_SeqDense in src/mat/impls/dense/seq/dense.c
MatMatSolve_Elemental in src/mat/impls/elemental/matelem.cxx

Index of all Mat routines