la, 2010-04-10 kello 12:23 -0500, Travis Oliphant kirjoitti:
[clip]
> Here are my suggested additions to NumPy:
> ufunc methods:
[clip]
>       * reducein (array, indices, axis=0)
>                similar to reduce-at, but the indices provide both the  
> start and end points (rather than being fence-posts like reduceat).

Is the `reducein` important to have, as compared to `reduceat`?

[clip]
> numpy functions (or methods):

I'd prefer functions here. ndarray already has a huge number of methods.

>        * segment(array)
> 
>          (produce an array of integers from an array producing the  
> different "regions" of an array:
> 
>           segment([10,20,10,20,30,30,10])  would produce ([0,1,0,1,2,2,0])

Sounds like `np.digitize(x, bins=np.unique(x))-1`. What would the
behavior be with structured arrays?

>        * edges(array, at=True)
>       
>          produce an index array providing the edges (with either fence-post  
> like syntax for reduce-at or both boundaries like reducein.

This can probably easily be based on segment().

> Thoughts on the general idea?

One question is whether these methods should be stuffed to the main
namespace, or under numpy.rec.


Another addition to ufuncs that should be though about is specifying the
Python-side interface to generalized ufuncs.

-- 
Pauli Virtanen

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to