-
Notifications
You must be signed in to change notification settings - Fork 5
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
Which notation is best? #86
Comments
That's mostly just me trying different things to get building operators to be faster. The big issue with It's likely that the But this would have been a one-off experiment so has not been thoroughly investigated. |
Does type assertion solve issues related to inference? |
No. Here's a rough idea of the problem. Let's say we have a complicated nested v = ((k .+ (c-1)) .* ( k .- n .- 1 ) ./ (2k .+ (b+c-1))) When building operators the code basically lowers to for K in Block.(1:N)
copyto!(view(dest,K), view(v,K))
end It's smart enough to recognise k_K = view(k,K) # returns Base.OneTo(Int(K))
n_K = view(n,K) # returns Fill(Int(K),Int(K))
copyto!(view(dest,K), ((k_K .+ (c-1)) .* ( k_K .- n_K .- 1 ) ./ (2k_K .+ (b+c-1)))) # actually a nested Broadcasted When correctly type-inferred the last step then gets reduced to a tight loop, essentially as fast as if done manually. When type-inferrence fails, it doesn't know how to reduce the nested |
There are multiple notations used to create multivariate operators:
MultivariateOrthogonalPolynomials.jl/src/triangle.jl
Lines 89 to 128 in 04704a8
When to use the dot notation and when to use
BroadcastVector
? Is it better to use @. or is that wasteful because it creates some unnecessary broadcasting?(My impression is that these are due to successive invasions of new notation and not all operators are fully updated, but I could be way off.)
The text was updated successfully, but these errors were encountered: