On Mon, Jun 21, 2010 at 10:40 AM, Neil Crighton <neilcrigh...@gmail.com> wrote:
> Warren Weckesser <warren.weckesser <at> enthought.com> writes:
>
>>
>> Benjamin Root wrote:
>> > Brad, I think you are doing it the right way, but I think what is
>> > happening is that the reshape() call on the sliced array is forcing a
>> > copy to be made first.  The fact that the copy has to be made twice
>> > just worsens the issue.  I would save a copy of the reshape result (it
>> > is usually a view of the original data, unless a copy is forced), and
>> > then perform a min/max call on that with the appropriate axis.
>> >
>> > On that note, would it be a bad idea to have a function that returns a
>> > min/max tuple?
>>
>> +1.  More than once I've wanted exactly such a function.
>>
>
> I also think this would be useful. For what it's worth, IDL also has a 
> function
> called minmax() that does this (e.g.
> http://astro.uni-tuebingen.de/software/idl/astrolib/misc/minmax.html)
>

My most favorite function I wrote many years ago using SWIG, I call
mmms(arr)
which returns a min,max,mean,std.dev  tuple.

(Of course it only works for contiguous C arrays, but it does support
most scalar dtypes via SWIG-templating)


Just my 2 cents.
- Sebastian Haase
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to