SentinelArrays.jl icon indicating copy to clipboard operation
SentinelArrays.jl copied to clipboard

`argmax` returns incorrect results

Open yurivish opened this issue 1 year ago • 0 comments

This package incorrectly implements argmax for ChainedVectors. It returns the maximum value, rather than its index.

julia> using SentinelArrays

julia> arrays = [
         [18, 70, 92, 15, 65],
         [25, 14, 95, 54, 57]
       ];

julia> cv = ChainedVector(arrays);

julia> argmax(cv)
95

julia> argmax(collect(cv))
8

The implementation is here and is tested, though the test only tests a simple special case for which the values and indices are exactly equal.

This issue was initially reported upstream.

yurivish avatar Apr 06 '24 20:04 yurivish