svd
svd(A, [thin=true]) -> U, S, V
Wrapper around svdfact extracting all parts the factorization to a tuple. Direct use of svdfact is therefore generally more efficient. Computes the SVD of A, returning U, vector S, and V such that A == U*diagm(S)*V'. If thin is true, an economy mode decomposition is returned. The default is to produce a thin decomposition.
Examples
julia> A = [1 2; 3 4];
julia> B = [5 6; 7 8];
julia> U, V, Q, D1, D2, R0 = svd(A, B);
julia> U
2×2 Array{Float64,2}:
-0.404553 -0.914514
-0.914514 0.404553
julia> V
2×2 Array{Float64,2}:
-0.404553 -0.914514
-0.914514 0.404553
julia> Q
2×2 Array{Float64,2}:
-0.576048 -0.817416
-0.817416 0.576048
julia> D1
2-element Array{Float64,1}:
5.46499
0.365966
julia> D2
2-element Array{Float64,1}:
14.2274
0.332311
julia> R0
2×2 Array{Float64,2}:
-0.576048 -0.817416
-0.817416 0.576048
In this example, the svd function is used to compute the generalized Singular Value Decomposition (SVD) of matrices A and B. The resulting tuple contains U, V, Q, D1, D2, and R0 matrices.
Urepresents the left singular vectors ofAandB.Vrepresents the right singular vectors ofAandB.Qis the orthogonal matrix used to transformAandB.D1andD2are the diagonal matrices containing the singular values ofAandBrespectively.R0is an auxiliary matrix used in the decomposition.
It is important to note that using svdfact directly is generally more efficient than using svd and extracting the individual parts.
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.