[Numpy-discussion] Trace returns int32 type for int8 array.

Charles R Harris charlesr.harris@gmail....
Wed Aug 29 11:59:22 CDT 2007


Hi all,

The documentation of trace says it returns the same type as the array. Yet:

>>> trace(eye(2, dtype=int8)).dtype
dtype('int32')

For float types this promotion does not occur

>>> trace(eye(2, dtype=float32)).dtype
dtype('float32')


Trace operates the same way as sum. What should be the case here? And if
type promotion is the default, shouldn't float32 be promoted to double?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070829/1126a868/attachment.html 


More information about the Numpy-discussion mailing list