# qrfact!

..  qrfact!(A [,pivot=Val{false}])

``qrfact!`` is the same as :func:`qrfact` when ``A`` is a subtype of ``StridedMatrix``, but saves space by overwriting the input ``A``, instead of creating a copy.

## Examples

1. QR factorization of a matrix:

julia> A = [1 2 3; 4 5 6; 7 8 9];
julia> qrfact!(A)
LinearAlgebra.QRCompactWY{Float64,Array{Float64,2}}
QR factorization of a 3x3 matrix

Q factor:
3×3 LinearAlgebra.QRCompactWYQ{Float64,Array{Float64,2}}:
-0.123091  -0.492366  -0.861640
-0.492366  -0.771517   0.401620
-0.861640   0.401620   0.309399

R factor:
3×3 Array{Float64,2}:
-8.12404  -9.60114  -11.0782
0.0       0.771517   1.54303
0.0       0.0       -0.123091

This example performs QR factorization of the matrix A in-place using qrfact!.

2. QR factorization with column pivoting:

julia> A = [1 2 3; 4 5 6; 7 8 9];
julia> qrfact!(A, Val{true})
LinearAlgebra.QRPivoted{Float64,Array{Float64,2}}
QR factorization with column pivoting of a 3x3 matrix

Q factor:
3×3 LinearAlgebra.QRPackedQ{Float64,Array{Float64,2}}:
-0.123091  -0.492366  -0.861640
-0.492366  -0.771517   0.401620
-0.861640   0.401620   0.309399

R factor:
3×3 Array{Float64,2}:
-8.12404  -9.60114  -11.0782
0.0       0.771517   1.54303
0.0       0.0       -0.123091

P factor:
3-element Array{Int64,1}:
3
2
1

This example performs QR factorization with column pivoting of the matrix A in-place using qrfact!.

Common mistake example:

julia> A = [1 2 3; 4 5 6; 7 8 9];
julia> qrfact!(A, Val{false}, 5)
ERROR: TypeError: Val{false} has no field ()

In this example, an invalid argument Val{false}, 5 is provided to qrfact!. It's important to provide the pivot argument as Val{false} or Val{true} without any additional parameters.