<div dir="ltr"><div>

<div style="direction:ltr">

<div style="width:7.5in;margin-top:0in;margin-left:0in;direction:ltr">

<div style="width:7.5in;margin-top:0in;margin-left:0in;direction:ltr">

<p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">Hi all,</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">I would like to try to reach a consensus about a long standing inconsistent behavior of reduceat() reported and discussed here</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">  <a href="https://github.com/numpy/numpy/issues/834">https://github.com/numpy/numpy/issues/834</a></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">In summary, it seems an elegant and logical design choice, that all users will expect, for</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">    out = ufunc.reduceat(a, indices)</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">to produce, for all indices j (except for the last one) the following</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">    out[j] = ufunc.reduce(a[indices[j]:indices[j+1]])</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">However the current documented and actual behavior is for the case</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">    indices[i] >= indices[i+1]<br>    <br>to return simply</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">    out[j] = a[indices[i]]    </p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">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.</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">What do people think?</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">PS: A quick fix for the current implementation is</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt">    out = ufunc.reduceat(a, indices)<br>    out *= np.diff(indices) > 0</p><p lang="en-US" style="margin:0in;font-family:calibri;font-size:11pt"><br></p></div></div></div></div></div>