[Numpy-discussion] Re: Numpy-discussion digest, Vol 1 #693 - 3 msgs

Peter Verveer verveer at embl-heidelberg.de
Thu Sep 4 01:55:03 EDT 2003

> 1. Add a type parameter to sum which defaults to widest type.
> 2. Add a type parameter to reductions (and fix output type handling).
> Default is same-type as it is now.  No major changes to C-code.
> 3. Add a WidestType(array) function:
>         Bool                        --> Bool
>         Int8,Int16,Int32,Int64      --> Int64
>         UInt8, UInt16,UInt32,UInt64 --> UInt64 (Int64 on win32)
>         Float32, Float64            --> Float64
>         Complex32, Complex64        --> Complex64

This sounds like a good solution.

> The only thing this really leaves out, is a higher performance
> implementation of sum/mean which Peter referred to a few times. 

Is this really the case? It depends on how you plan to implement the output 
conversion. If you will do this by allocating a temporary converted copy of 
the complete input before the calculations then this potentially requires a 
lot of temporary storage. But it is certainly possible to come up with an 
implementation that avoids this. Have you given this some thought?

> Peter,
> if you want to write a specialized module, we'd be happy to put it in
> the add-ons package.

I hope that the reduce methods can be made sufficiently efficient so that this 
will not be necessary. 

Cheers, Peter

More information about the NumPy-Discussion mailing list