# svdfact(A)

svdfact(A, [thin=true]) -> SVD

Compute the Singular Value Decomposition (SVD) of `A` and return an `SVD` object. `U`, `S`, `V` and `Vt` can be obtained from the factorization `F` with `F[:U]`, `F[:S]`, `F[:V]` and `F[:Vt]`, such that `A = U*diagm(S)*Vt`. If `thin` is `true`, an economy mode decomposition is returned. The algorithm produces `Vt` and hence `Vt` is more efficient to extract than `V`. The default is to produce a thin decomposition.

## Examples

``````julia> A = [1.0 2.0; 3.0 4.0];
julia> B = [5.0 6.0; 7.0 8.0];
julia> F = svdfact(A, B)
GeneralizedSVD{Float64,Float64,Array{Float64,2}}
U factor:
2×2 Array{Float64,2}:
-0.404553  -0.914514
-0.914514   0.404553
D1 factor:
2-element Array{Float64,1}:
5.46499
0.36597
V factor:
2×2 Array{Float64,2}:
-0.576048  -0.817416
-0.817416   0.576048
D2 factor:
2-element Array{Float64,1}:
14.2697
0.62637
R0 factor:
2×2 Array{Float64,2}:
-0.404553  -0.914514
-0.914514   0.404553
Q factor:
2×2 Array{Float64,2}:
-0.576048  -0.817416
-0.817416   0.576048``````

The `svdfact()` function computes the generalized singular value decomposition (SVD) of matrices `A` and `B`. It returns a `GeneralizedSVD` factorization object `F`, which contains the factors `U`, `D1`, `V`, `D2`, `R0`, and `Q` such that:

``````A = F[:U] * F[:D1] * F[:R0] * F[:Q]'
B = F[:V] * F[:D2] * F[:R0] * F[:Q]'``````

Here are some examples of how to use `svdfact()`:

1. Compute the generalized SVD of two matrices:

``````julia> A = [1.0 2.0; 3.0 4.0];
julia> B = [5.0 6.0; 7.0 8.0];
julia> F = svdfact(A, B);``````
2. Access the factor matrices:
``````julia> U = F[:U];  # U factor matrix
julia> D1 = F[:D1];  # D1 factor vector
julia> V = F[:V];  # V factor matrix
julia> D2 = F[:D2];  # D2 factor vector
julia> R0 = F[:R0];  # R0 factor matrix
julia> Q = F[:Q];  # Q factor matrix``````

Note that the output may vary depending on the values and dimensions of the input matrices `A` and `B`.