-
-
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
maximum gives surprising / wrong results #6724
Comments
Those three calls aren't the same operation. Remember that So your first call In the second call, you ask for the maximum of In the third call, you concatenate the arrays and the ask for the maximum, which is again what you get back. |
@mkriele I think you are looking for |
@mkriele if you want to get the maximum of several arrays without allocating new memory to concatenate them, you can use using Iterators
maximum(chain(c,d)) # 4 |
@porterjamesj many hanks, this clears things up for me and was very instructive. I will use Iterator.chain as suggested by you. I do not think any more that this is a bug. Since my array does not have dimensions 3, 4, we are operating over the empty set, so not doing anything would be okay in my book. I am closing the issue. |
@mkriele glad to help :) |
This misunderstanding of the |
Yes, that would be helpful. But |
I should have typed |
See also #4235 for a lengthy discussion that lead to the separation of This is a noteworthy difference from R, so this should probably be mentioned there. If you have a good suggestion for the wording, you can actually just edit the file on github and submit a pull request to improve the document. |
The following uses the current binary: Commit 7bb10f8 on Mac OSX.
I have three different results for the same operation.
maximum(c,d)
seems to just returnc
. I must have chosen unlucky numbers, because other choices of vectors give the correct result. In particular,maximum(d,c)
is correct. Though I think it would be better if it returned anInt64
rather than an1-element Array{Int64,1}
. Onlymaximum([c,d])
returns what I expected. I experienced the same behavior on older versions including0.2.0
Regards, Marcus
The text was updated successfully, but these errors were encountered: