[Numpy-discussion] Where's that function?
Wed Feb 6 13:17:25 CST 2013
On Wed, 2013-02-06 at 13:08 -0500, email@example.com wrote:
> I'm convinced that I saw a while ago a function that uses a list of
> interval boundaries to index into an array, either to iterate or to
> I thought that's very useful, but didn't make a note.
> Now, I have no idea where I saw this (I thought numpy), and I cannot
> find it anywhere.
> any clues?
It does not quite sound like what you are looking for, but the only
thing I can think of in numpy right now that does something in that
direction is the ufunc.reduceat functionality:
In : a = np.arange(10)
In : a[2:5].sum(), a[5:9].sum(), a[9:].sum()
Out: (9, 26, 9)
In : np.add.reduceat(a, [2, 5, 9])
Out: array([ 9, 26, 9])
> NumPy-Discussion mailing list
More information about the NumPy-Discussion