-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
problem with cumsum #13244
Comments
Well, I'm no core developer but,
Well, julia is on the case of
For what it looks like, I also got errors when doing this:
Note: I'm on 'v"0.5.0-dev+289"'. |
It's intended behavior that converting a non-integer floating point number to an integer throws an InexactError. I'm pretty sure that the problem is that |
The first element thing isn't right for heterogeneous arrays, we should maybe do some better specialization there to only do that when the element type is concrete? There was an argument a while back in #9665 about whether cumsum should promote to larger types like sum does to make it less likely to overflow, I personally don't think that's right since it returns an array rather than a scalar and the storage could grow pretty substantially. |
Yes, we should do something better with heterogeneous arrays, both here and with |
When it comes to array, I must say that the following line, referenced above, is a mystery to me. Why adding
|
I guess all types don't have to be closed during addition. |
E.g. Bool Den onsdag den 23. september 2015 skrev Kristoffer Carlsson <
|
Maybe cumsum (and friends) could optionally take a first argument of the type you want to reduce on. |
You can do |
Interestingly I think this actually boils down to:
which is due to this definition (since zero just converts 0):
The following definition fixes it but with ambiguity warnings galore:
gives:
|
I think this is a bug in |
Closed by #18364. |
There seems to be a type problem with the
cumsum
function when passed an union type.The error does not appear with the function
f(x) = (x == 0 ? 0 : 1.0)
. AnInt
array is returned.The text was updated successfully, but these errors were encountered: