-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rdiv! on LU object is much slower than ldiv! #1085
Comments
I benchmarked |
All time seem to be spent in Since it is an adjoint it is iterating there in a cache unfriendly way (row by row). Not sure if that is the full answer. |
Why would it be calling |
The problem is that LAPACK's With the following new functions julia> LinearAlgebra.ldiv!(A::LinearAlgebra.AdjointFactorization{T,<:LU{T,<:StridedMatrix}}, B::Adjoint{T,<:StridedVecOrMat{T}}) where {T<:LinearAlgebra.BlasComplex} = LAPACK.getrs!('C', A.parent.factors, A.parent.ipiv, copy(B))
julia> LinearAlgebra.ldiv!(A::LinearAlgebra.TransposeFactorization{T,<:LU{T,<:StridedMatrix}}, B::Transpose{T,<:StridedVecOrMat{T}}) where {T<:LinearAlgebra.BlasFloat} = LAPACK.getrs!('T', A.parent.factors, A.parent.ipiv, copy(B)) which are in line with the implementations of julia> A = rand(1000,1000); @btime inv($A); @btime inv2($A); @btime inv3($A);
20.489 ms (5 allocations: 8.13 MiB)
30.846 ms (5 allocations: 15.27 MiB)
32.751 ms (7 allocations: 22.90 MiB) However, this requires a copy (mainly memory impact): julia> @btime copy(A);
242.988 μs (2 allocations: 7.63 MiB) |
Update: As indicated by @dkarrasch in the comments of the now-closed PR JuliaLang/julia#55760, this is not a missing functionality issue, but a dispatch issue. See JuliaLang/julia#55764 for a possible solution. |
Indeed. Unfortunately, I have very little time at the moment, so if somebody could debug the "lu of tridiagonal" case in that PR (everything else is working just fine), that would be awesome! |
From this post, I'm finding that
rdiv!
on LU objects (added in JuliaLang/julia#31285) is much slower thanldiv!
.For example:
gives
The text was updated successfully, but these errors were encountered: