-
-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
JuliaLang/julia
#32126Description
I realized that inv for a SVD currently uses the generic inv(F::Factorization): https://github.com/JuliaLang/julia/blob/25c33e40c5abf5a43d8e45832a889755d6423f38/stdlib/LinearAlgebra/src/factorization.jl#L50
With a simple specialized implementation like
myinv(F::SVD) = (Diagonal(1 ./ F.S) * F.Vt)' * F.U'I get the following speed up
julia> x = rand(100,100);
julia> F = svd(x);
julia> @btime inv($F);
187.700 μs (13 allocations: 313.02 KiB)
julia> @btime myinv($F);
98.100 μs (6 allocations: 157.30 KiB)
julia> isapprox(inv(F), myinv(F))
trueAm I missing something or should this be added to svd.jl?
Metadata
Metadata
Assignees
Labels
No labels