-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Use 3-arg ldiv!
#81
Use 3-arg ldiv!
#81
Conversation
Unless you need it to operate in-place, it would probably make more sense to use the 3-arg `ldiv!` everywhere
No, we cannot do this because using 3-argument ldiv breaks downstream. This is why DiffEqBase was using it. See JuliaLang/julia#33143 (comment) for details. This was already changed in #76 and I don't think we'd change the default here given how breaking the 3-argument one is due to the GC bugs. |
I seem to recall that for our Schur solve, which we treat as a factorization, couldn't generally be solved in-place. What if you defined your own 3-arg |
Do you ever need to solve non-square matrices? |
Okay, how about this (it's not pretty, I will concede that). |
374: add overload 2-arg ldiv r=simonbyrne a=simonbyrne Hopefully should fix #371. See SciML/LinearSolve.jl#81 for discussion of underlying issue. Co-authored-by: Simon Byrne <[email protected]>
Also, there is an upstream issue: JuliaLang/LinearAlgebra.jl#897 |
src/factorization.jl
Outdated
@@ -1,11 +1,20 @@ | |||
function _ldiv!(x, A, b) | |||
# work around https://github.com/JuliaLang/julia/issues/43507 | |||
if @which(ldiv!(x,A,b)) == which(ldiv!,Tuple{LU{Float64, Matrix{Float64}},Vector{Float64}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this resolve at compile time, or compile away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does look like a runtime thing, so not ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could just make it
function _ldiv!(x, A, b)
copyto!(x, b)
ldiv!(A, x)
end
and then it could be monkey-patched if need be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just
_ldiv!(x, A, b) = ldiv!(x, A, b)
function _ldiv!(x::Vector, A::Matrix, b::Vector)
copyto!(x, b)
ldiv!(A, x)
end
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Factorization
instead of Matrix
, but yeah
Unless you need it to operate in-place, it would probably make more sense to use the 3-arg
ldiv!
everywhere