# MatLUFactor
Performs in-place LU factorization of matrix. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatLUFactor(Mat mat, IS row, IS col, const MatFactorInfo *info)
```
Collective on mat


## Input Parameters

- ***mat -*** the matrix
- ***row -*** row permutation
- ***col -*** column permutation
- ***info -*** options for factorization, includes


```none
fill - expected fill as ratio of original fill.
```
```none
dtcol - pivot tolerance (0 no pivot, 1 full column pivoting)
```
```none
Run with the option -info to determine an optimal value to use
```


## Notes
Most users should employ the `KSP` interface for linear solvers
instead of working directly with matrix algebra routines such as this.
See, e.g., `KSPCreate()`.

This changes the state of the matrix to a factored matrix; it cannot be used
for example with `MatSetValues()` unless one first calls `MatSetUnfactored()`.

This is really in-place only for dense matrices, the prefered approach is to use `MatGetFactor()`, `MatLUFactorSymbolic()`, and `MatLUFactorNumeric()`
when not using `KSP`.




## Developer Note
The Fortran interface is not autogenerated as the f90
interface definition cannot be generated correctly [due to `MatFactorInfo`]


## See Also
 [Matrix Factorization](sec_matfactor), `Mat`, `MatFactorType`, `MatLUFactorSymbolic()`, `MatLUFactorNumeric()`, `MatCholeskyFactor()`,
`MatGetOrdering()`, `MatSetUnfactored()`, `MatFactorInfo`, `MatGetFactor()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/interface/matrix.c.html#MatLUFactor">src/mat/interface/matrix.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex74.c.html">src/ksp/ksp/tutorials/ex74.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/seq/aijfact.c.html#MatLUFactor_SeqAIJ">MatLUFactor_SeqAIJ in src/mat/impls/aij/seq/aijfact.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/baij/seq/baijfact.c.html#MatLUFactor_SeqBAIJ">MatLUFactor_SeqBAIJ in src/mat/impls/baij/seq/baijfact.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/cuda/densecuda.cu.html#MatLUFactor_SeqDenseCUDA">MatLUFactor_SeqDenseCUDA in src/mat/impls/dense/seq/cuda/densecuda.cu</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/dense.c.html#MatLUFactor_SeqDense">MatLUFactor_SeqDense in src/mat/impls/dense/seq/dense.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/hip/densehip.hip.c.html#MatLUFactor_SeqDenseHIP">MatLUFactor_SeqDenseHIP in src/mat/impls/dense/seq/hip/densehip.hip.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/elemental/matelem.cxx.html#MatLUFactor_Elemental">MatLUFactor_Elemental in src/mat/impls/elemental/matelem.cxx</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/scalapack/matscalapack.c.html#MatLUFactor_ScaLAPACK">MatLUFactor_ScaLAPACK in src/mat/impls/scalapack/matscalapack.c</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
