-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
type-instability in LinAlg factorizations getindex declarations #12
Comments
I believe we had discussed this in an earlier issue, and @JeffBezanson had said this should be fine. |
If it is considered a bug every time an inferred type isn't concrete, then
|
JuliaLang/julia#1974 will fix this. |
This hasn't been an issue for a long time. |
I'd actually like fix this issue as it can cause significant slow down as we saw recently for the correlation benchmark. The solution is probably to use typed instead of symbols for the indexing and declaration of special matrix and factorizations. |
Ok, I missed that. Is there a relevant issue we can link here? |
We discussed the |
Thanks! |
@jiahao is giving some more context and examples in #241. A couple of solutions have been mentioned
I think 1. is simply too ugly and I believe/hope that eventually we'll be able to fix this in a better way. 2. reseves too many one letter names. 3. defines way too many functions each with a single simple use case. 4. might be the best bet but depends on JuliaLang/julia#1974. Value specialization might also help us. @carnaval can tell if that is true or if I'm missing the point. |
i think you are underselling the value of having one function to do one thing. |
It would be something like |
JuliaLang/julia#12747 introduced a method of The motivating example in #241 is stripped down from The code basically does this function svdvals_gkl(A, threshold)
T=typeof(real(one(eltype(A)))
otherstate = initialize(A)
converged_values = T[] #<--
while !enough(converged_values)
M, otherstate = make_small_matrix(A, otherstate, converged_values) #<--
S = svdfact(M)
svals = S[:S] #<--
svalerrs = compute_errors(S)
converged_values = svals[svalerrs .< threshold] #<--
end
end In the full code, the fact that |
The long term elegant solution is probably the getfield overloading (which is the same as specializing on symbol values). |
Actually you can probably do it this way : There may even be some symbols that you would want to return different things depending on the type ? |
That could be one solution.
Possibly. You might want Less trivial is |
Given the lack of progress at this point, this is not going to make 0.6. |
Bump? |
We are waiting for a decision on the dot overload issue. Accessing the factors could be made convenient and type stable if we had some kind of dot overloading. E.g. something like |
Close? The original issues I brought up aren't valid. It seems like |
The original issue you brought up still seems valid to me. We need either enough constant propagation to infer the type of |
Yes. Let's keep this open until we can extract factors in a type stable way. |
Constant propagation + getfield overloading seems to close this 🎉. Reopen if not. |
Closes JuliaLang/LinearAlgebra.jl#12. **PR Checklist** - [x] added BLAS.geru! function in stdlib/LinearAlgebra/src/blas.jl - [x] also added test cases for it in stdlib/LinearAlgebra/test/blas.jl --------- Co-authored-by: Daniel Karrasch <[email protected]> Co-authored-by: Viral B. Shah <[email protected]> Co-authored-by: mikmoore <[email protected]> Co-authored-by: Ian Butterworth <[email protected]>
factorizations.jl
has a number ofgetindex(x, ::Symbol)
functions, all of whose return types are dependent upon the value of the symbol. This seems to be a performance trap, no? (for example: julia can't infer the return type of eig)The text was updated successfully, but these errors were encountered: