-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Diagonal(1:n) cannot be multiplied by zero #563
Comments
The equivalent expression that mirrors what Julia 0.6 did would be Another workaround that is similarly efficient for dense Diagonals would just be to broadcast the multiplication/addition: This is effectively JuliaLang/julia#10391 |
The thing I find troubling about the current behavior is that it works for some values, but not zero. |
I think this is mainly an issue with ranges. The |
Indeed, this is exactly how integer ranges have behaved since the beginning. We're fairly constrained in their behaviors and structure because they absolutely have to be fast for Another workaround is to use a floating point range. |
Ok, I would be okay with closing this then in favor of JuliaLang/julia#10391. But it really is unfortunate that there is no clear solution. One can write well-tested code which blows up the moment zero is passed as a value. I can think of a variety of industries/use cases where this could be problematic or even catastrophic. |
I agree it's frustrating and problematic. See JuliaLang/julia#28072 (comment) for the possible path forward. |
In that case, is there any good reason for |
Yes, that looks to be fixable with much less effort. |
Fixes `0.0 * (1:4)`, for example. From https://github.com/JuliaLang/julia/issues/29052#issuecomment-418825887
Fixes `0.0 * (1:4)`, for example. From https://github.com/JuliaLang/julia/issues/29052#issuecomment-418825887
* Improve support for constructing zero-step float ranges Fixes `0.0 * (1:4)`, for example. From https://github.com/JuliaLang/julia/issues/29052#issuecomment-418825887 * simplify
* Improve support for constructing zero-step float ranges Fixes `0.0 * (1:4)`, for example. From https://github.com/JuliaLang/julia/issues/29052#issuecomment-418825887 * simplify (cherry picked from commit 26b6a58)
* Improve support for constructing zero-step float ranges Fixes `0.0 * (1:4)`, for example. From https://github.com/JuliaLang/julia/issues/29052#issuecomment-418825887 * simplify (cherry picked from commit 26b6a58)
The following worked on julia 0.6 but fails on 0.7 and 1.0.
The text was updated successfully, but these errors were encountered: