3232Compute the singular value decomposition (SVD) of `A` and return an `SVD` object.
3333
3434`U`, `S`, `V` and `Vt` can be obtained from the factorization `F` with `F[:U]`,
35- `F[:S]`, `F[:V]` and `F[:Vt]`, such that `A = U*diagm (S)*Vt`.
35+ `F[:S]`, `F[:V]` and `F[:Vt]`, such that `A = U*Diagonal (S)*Vt`.
3636The algorithm produces `Vt` and hence `Vt` is more efficient to extract than `V`.
3737The singular values in `S` are sorted in descending order.
3838
@@ -52,7 +52,7 @@ julia> A = [1. 0. 0. 0. 2.; 0. 0. 3. 0. 0.; 0. 0. 0. 0. 0.; 0. 2. 0. 0. 0.]
5252julia> F = svdfact(A)
5353Base.LinAlg.SVD{Float64,Float64,Array{Float64,2}}([0.0 1.0 0.0 0.0; 1.0 0.0 0.0 0.0; 0.0 0.0 0.0 -1.0; 0.0 0.0 1.0 0.0], [3.0, 2.23607, 2.0, 0.0], [-0.0 0.0 … -0.0 0.0; 0.447214 0.0 … 0.0 0.894427; -0.0 1.0 … -0.0 0.0; 0.0 0.0 … 1.0 0.0])
5454
55- julia> F[:U] * diagm (F[:S]) * F[:Vt]
55+ julia> F[:U] * Diagonal (F[:S]) * F[:Vt]
56564×5 Array{Float64,2}:
5757 1.0 0.0 0.0 0.0 2.0
5858 0.0 0.0 3.0 0.0 0.0
@@ -71,7 +71,7 @@ svdfact(x::Integer; thin::Bool=true) = svdfact(float(x), thin=thin)
7171 svd(A; thin::Bool=true) -> U, S, V
7272
7373Computes the SVD of `A`, returning `U`, vector `S`, and `V` such that
74- `A == U*diagm (S)*V'`. The singular values in `S` are sorted in descending order.
74+ `A == U*Diagonal (S)*V'`. The singular values in `S` are sorted in descending order.
7575
7676If `thin=true` (default), a thin SVD is returned. For a ``M \\ times N`` matrix
7777`A`, `U` is ``M \\ times M`` for a full SVD (`thin=false`) and
@@ -93,7 +93,7 @@ julia> A = [1. 0. 0. 0. 2.; 0. 0. 3. 0. 0.; 0. 0. 0. 0. 0.; 0. 2. 0. 0. 0.]
9393julia> U, S, V = svd(A)
9494([0.0 1.0 0.0 0.0; 1.0 0.0 0.0 0.0; 0.0 0.0 0.0 -1.0; 0.0 0.0 1.0 0.0], [3.0, 2.23607, 2.0, 0.0], [-0.0 0.447214 -0.0 0.0; 0.0 0.0 1.0 0.0; … ; -0.0 0.0 -0.0 1.0; 0.0 0.894427 0.0 0.0])
9595
96- julia> U*diagm (S)*V'
96+ julia> U*Diagonal (S)*V'
97974×5 Array{Float64,2}:
9898 1.0 0.0 0.0 0.0 2.0
9999 0.0 0.0 3.0 0.0 0.0
@@ -266,17 +266,17 @@ function getindex(obj::GeneralizedSVD{T}, d::Symbol) where T
266266 elseif d == :D1
267267 m = size (obj. U, 1 )
268268 if m - obj. k - obj. l >= 0
269- return [eye (T, obj. k) zeros (T, obj. k, obj. l); zeros (T, obj. l, obj. k) diagm (obj. a[obj. k + 1 : obj. k + obj. l]); zeros (T, m - obj. k - obj. l, obj. k + obj. l)]
269+ return [eye (T, obj. k) zeros (T, obj. k, obj. l); zeros (T, obj. l, obj. k) Diagonal (obj. a[obj. k + 1 : obj. k + obj. l]); zeros (T, m - obj. k - obj. l, obj. k + obj. l)]
270270 else
271- return [eye (T, m, obj. k) [zeros (T, obj. k, m - obj. k); diagm (obj. a[obj. k + 1 : m])] zeros (T, m, obj. k + obj. l - m)]
271+ return [eye (T, m, obj. k) [zeros (T, obj. k, m - obj. k); Diagonal (obj. a[obj. k + 1 : m])] zeros (T, m, obj. k + obj. l - m)]
272272 end
273273 elseif d == :D2
274274 m = size (obj. U, 1 )
275275 p = size (obj. V, 1 )
276276 if m - obj. k - obj. l >= 0
277- return [zeros (T, obj. l, obj. k) diagm (obj. b[obj. k + 1 : obj. k + obj. l]); zeros (T, p - obj. l, obj. k + obj. l)]
277+ return [zeros (T, obj. l, obj. k) Diagonal (obj. b[obj. k + 1 : obj. k + obj. l]); zeros (T, p - obj. l, obj. k + obj. l)]
278278 else
279- return [zeros (T, p, obj. k) [diagm (obj. b[obj. k + 1 : m]); zeros (T, obj. k + p - m, m - obj. k)] [zeros (T, m - obj. k, obj. k + obj. l - m); eye (T, obj. k + p - m, obj. k + obj. l - m)]]
279+ return [zeros (T, p, obj. k) [Diagonal (obj. b[obj. k + 1 : m]); zeros (T, obj. k + p - m, m - obj. k)] [zeros (T, m - obj. k, obj. k + obj. l - m); eye (T, obj. k + p - m, obj. k + obj. l - m)]]
280280 end
281281 elseif d == :R
282282 return obj. R
0 commit comments