# cholfact!

``````..  cholfact!(A [,LU=:U [,pivot=Val{false}]][;tol=-1.0]) -> Cholesky

``cholfact!`` is the same as :func:`cholfact`, but saves space by overwriting the input ``A``, instead of creating a copy. ``cholfact!`` can also reuse the symbolic factorization from a different matrix ``F`` with the same structure when used as: ``cholfact!(F::CholmodFactor, A)``.``````

## Examples

The `cholfact!` function in Julia performs a Cholesky factorization of a given matrix `A` and overwrites the input matrix `A` with the factorization result. It returns a Cholesky factorization object of size `n x n`.

Here are some examples of how to use the `cholfact!` function:

1. Perform Cholesky factorization and overwrite input matrix:

``````julia> A = [4.0 12.0 -16.0; 12.0 37.0 -43.0; -16.0 -43.0 98.0];
julia> cholfact!(A)
Cholesky{Float64,Array{Float64,2}}
U factor:
3×3 UpperTriangular{Float64,Array{Float64,2}}:
2.0   6.0  -8.0
⋅    1.0  -5.0
⋅     ⋅    3.0 ``````

In this example, the `cholfact!` function performs a Cholesky factorization of the matrix `A` and overwrites `A` with the result. The returned object is a Cholesky factorization of the upper triangular matrix.

2. Reuse symbolic factorization from a different matrix:
``````julia> F = cholfact(A);
julia> B = [1.0 2.0 3.0; 2.0 5.0 6.0; 3.0 6.0 9.0];
julia> cholfact!(F, B)
Cholesky{Float64,Array{Float64,2}}
U factor:
3×3 UpperTriangular{Float64,Array{Float64,2}}:
1.0  2.0  3.0
⋅   1.0  1.0
⋅    ⋅   0.0``````

This example demonstrates how to reuse the symbolic factorization from matrix `A` (stored in `F`) and perform a Cholesky factorization of a different matrix `B`. The input matrix `B` is overwritten with the factorization result.

Note: The `LU` and `pivot` arguments mentioned in the documentation are optional parameters that control the factorization method. The `tol` parameter specifies the tolerance level for rank-deficient factorizations.