# hessfact

```
.. hessfact(A)
Compute the Hessenberg decomposition of ``A`` and return a ``Hessenberg`` object. If ``F`` is the factorization object, the unitary matrix can be accessed with ``F[:Q]`` and the Hessenberg matrix with ``F[:H]``. When ``Q`` is extracted, the resulting type is the ``HessenbergQ`` object, and may be converted to a regular matrix with :func:`full`.
```

## Examples

The `hessfact`

function in Julia computes the Hessenberg decomposition of a given matrix `A`

and returns a `Hessenberg`

object. The resulting object can be used to access the unitary matrix and the Hessenberg matrix.

```
julia> A = [2.0 1.0 0.0 0.0; 1.0 2.0 1.0 0.0; 0.0 1.0 2.0 1.0; 0.0 0.0 1.0 2.0];
julia> F = hessfact(A)
Base.LinAlg.Hessenberg{Float64,Array{Float64,2}}
Q factor:
4×4 LinearAlgebra.QRPackedQ{Float64,Array{Float64,2}}:
-0.447214 -0.774597 0.447214 0.0
-0.447214 0.258199 0.774597 0.0
-0.447214 0.516398 -0.258199 -0.707107
-0.447214 0.258199 -0.258199 0.707107
Hessenberg factor:
4×4 Array{Float64,2}:
2.23607 2.23607 0.894427 0.447214
2.23607 1.51657 0.894427 0.447214
0.0 1.51657 0.894427 0.447214
0.0 0.0 1.78885 1.78885
```

In the example above, the Hessenberg decomposition of matrix `A`

is computed using `hessfact`

. The resulting `Hessenberg`

object `F`

allows access to the unitary matrix (`F[:Q]`

) and the Hessenberg matrix (`F[:H]`

).

To convert the `HessenbergQ`

object to a regular matrix, you can use the `full`

function:

```
julia> Q = full(F[:Q])
4×4 Array{Float64,2}:
-0.447214 -0.774597 0.447214 0.0
-0.447214 0.258199 0.774597 0.0
-0.447214 0.516398 -0.258199 -0.707107
-0.447214 0.258199 -0.258199 0.707107
```

The resulting `Q`

matrix is a regular matrix representation of the unitary matrix extracted from the `Hessenberg`

object.

Note: The `hessfact`

function is part of the `LinearAlgebra`

module in Julia.

## See Also

## User Contributed Notes

### Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.