[Numpy-discussion] ufunc.reduce and conversion

A. M. Archibald peridot.faceted at gmail.com
Tue Sep 19 22:53:26 CDT 2006


Hi,

What are the rules for datatype conversion in ufuncs? Does ufunc(a,b)
always yield the smallest type big enough to represent both a and b?
What is the datatype of ufunc.reduce(a)?

I ask because I was startled by the following behaviour:
>>> a = array([1,1],uint8); print a.dtype; print maximum.reduce(a).dtype;
'|u1'
'<u4'

uint16 behaves similarly, but none of the others seem to involve a
conversion (with the possible exception, in SVN, of int32 -> float,
possibly only for add.reduce).

Thanks,
A. M. Archibald




More information about the Numpy-discussion mailing list