diff --git a/base/linalg/arnoldi.jl b/base/linalg/arnoldi.jl index 77ab6ae9eeffd..60c345cb9eeea 100644 --- a/base/linalg/arnoldi.jl +++ b/base/linalg/arnoldi.jl @@ -388,9 +388,12 @@ function _svds(X; nsv::Int = 6, ritzvec::Bool = true, tol::Float64 = 0.0, maxite # calculating singular vectors left_sv = sqrt(2) * ex[2][ 1:size(X,1), ind ] .* sign(ex[1][ind]') right_sv = sqrt(2) * ex[2][ size(X,1)+1:end, ind ] - return (SVD(left_sv, sval, right_sv), ex[3], ex[4], ex[5], ex[6]) + return (SVD(left_sv, sval, right_sv'), ex[3], ex[4], ex[5], ex[6]) else #The sort is necessary to work around #10329 - return (SVD(zeros(eltype(sval),n,0),sort!(sval, by=real, rev=true),zeros(eltype(sval),0,m)), ex[2], ex[3], ex[4], ex[5]) + return (SVD(zeros(eltype(sval), n, 0), + sort!(sval, by=real, rev=true), + zeros(eltype(sval), 0, m)), + ex[2], ex[3], ex[4], ex[5]) end end diff --git a/test/linalg/arnoldi.jl b/test/linalg/arnoldi.jl index def962367fb0b..b47c936ea0480 100644 --- a/test/linalg/arnoldi.jl +++ b/test/linalg/arnoldi.jl @@ -167,7 +167,7 @@ end @test s1_left ≈ s2_left ## 1st right singular vector - s1_right = sign(S1[1][:Vt][3,1]) * S1[1][:Vt][:,1] + s1_right = sign(S1[1][:V][3,1]) * S1[1][:V][:,1] s2_right = sign(S2[3][3,1]) * S2[3][:,1] @test s1_right ≈ s2_right end @@ -212,7 +212,7 @@ end @test s1_left ≈ s2_left ## right singular vectors - s1_right = abs.(S1[1][:Vt][:,1:2]) + s1_right = abs.(S1[1][:V][:,1:2]) s2_right = abs.(S2[3][:,1:2]) @test s1_right ≈ s2_right end