[Numpy-discussion] Find the N maximum values and corresponding indexes in an array

Neal Becker ndbecker2@gmail....
Wed Dec 2 21:15:18 CST 2009

Neal Becker wrote:

> Keith Goodman wrote:
> ...
>> Oh, I thought he meant there was a numpy function for partial 
> Actually, I do use this myself.  My code is a boost::python wrapper 
> 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",

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.

More information about the NumPy-Discussion mailing list