Skip to content

Commit

Permalink
Fix ldiv! for SVD
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed May 25, 2021
1 parent 9a2dac7 commit d87949b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stdlib/LinearAlgebra/src/svd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,9 @@ svdvals(S::SVD{<:Any,T}) where {T} = (S.S)::Vector{T}

# SVD least squares
function ldiv!(A::SVD{T}, B::StridedVecOrMat) where T
m, n = size(A)
k = searchsortedlast(A.S, eps(real(T))*A.S[1], rev=true)
view(A.Vt,1:k,:)' * (view(A.S,1:k) .\ (view(A.U,:,1:k)' * B))
return mul!(view(B, 1:n, :), view(A.Vt, 1:k, :)', view(A.S, 1:k) .\ (view(A.U, :, 1:k)' * _cut_B(B, 1:m)))
end

function inv(F::SVD{T}) where T
Expand Down

0 comments on commit d87949b

Please sign in to comment.