Hi all,

I would like to try to reach a consensus about a long standing inconsistent
behavior of reduceat() reported and discussed here


  https://github.com/numpy/numpy/issues/834


In summary, it seems an elegant and logical design choice, that all users
will expect, for


    out = ufunc.reduceat(a, indices)


to produce, for all indices j (except for the last one) the following


    out[j] = ufunc.reduce(a[indices[j]:indices[j+1]])


However the current documented and actual behavior is for the case


    indices[i] >= indices[i+1]

to return simply


    out[j] = a[indices[i]]


I cannot see any application where this behavior is useful or where this
choice makes sense. This seems just a bug that should be fixed.


What do people think?


PS: A quick fix for the current implementation is


    out = ufunc.reduceat(a, indices)
    out *= np.diff(indices) > 0
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to