Neal Becker wrote:
> Keith Goodman wrote:
> ...
>> Oh, I thought he meant there was a numpy function for partial
sorting.
>>
> Actually, I do use this myself. My code is a boost::python wrapper
or
> the std::partial_sum using pyublas. Here's the main pieces:
>
> template<typename out_t, typename in_t>
> inline out_t partial_sum (in_t const& in) {
> out_t out (boost::size (in));
> std::partial_sum (boost::begin (in), boost::end (in), boost::begin
> (out));
> return out;
> }
> ...
> def ("partial_sum",
>
&partial_sum<pyublas::numpy_vector<T>,pyublas::numpy_strided_vector<T>
>>);
Oops, sorry, that's the wrong one (that was partial_sum, not
partial_sort). I don't have a wrapper for that one, but it would
probably be easy enough to do with the same tools as above.
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion