# eigfact!

``````..  eigfact!(A, [B])

Same as :func:`eigfact`, but saves space by overwriting the input ``A`` (and
``B``), instead of creating a copy.``````

## Examples

In the Julia programming language, the function `eigfact!(A, [B])` is used to compute the eigenvalue factorization of a matrix `A`. It is similar to the `eigfact` function, but it saves space by overwriting the input matrix `A` (and optionally `B`), instead of creating a copy.

Here are some examples of how `eigfact!` can be used:

1. Compute eigenvalue factorization of a matrix:

``````julia> A = [1.0 2.0; 3.0 4.0];
julia> eigfact!(A)
Eigen{Float64,Float64,Array{Float64,2},Array{Float64,1}}
evalues:
2-element Array{Float64,1}:
-0.3722813232690143
5.372281323269014
evectors:
2×2 Array{Float64,2}:
-0.824564  -0.415974
0.565767  -0.909377``````

This example computes the eigenvalue factorization of the matrix `A` and overwrites it with the result.

2. Compute eigenvalue factorization with a right-hand side matrix:
``````julia> A = [1.0 2.0; 3.0 4.0];
julia> B = [5.0; 6.0];
julia> eigfact!(A, B)
Eigen{Float64,Float64,Array{Float64,2},Array{Float64,1}}
evalues:
2-element Array{Float64,1}:
-0.3722813232690143
5.372281323269014
evectors:
2×2 Array{Float64,2}:
-0.824564  -0.415974
0.565767  -0.909377``````

This example computes the eigenvalue factorization of the matrix `A` and overwrites both `A` and `B` with the results.

Common mistake example:

``````julia> A = [1.0 2.0; 3.0 4.0];
julia> eigfact!(A, C)
ERROR: UndefVarError: C not defined``````

In this example, the variable `C` is not defined before passing it as the second argument to `eigfact!`. Ensure that all variables used in the function call are properly defined beforehand.