summing NumPy byte arrays
David R. Smith
drs at alex2.labs.agilent.com
Fri Nov 30 14:12:10 EST 2001
I have a big NumPy byte array, and want to sum it. Unfortunately, the
add.reduce (alias: sum) method does the sum in the same size receptacle,
e.g.,
>>> from Numeric import *
>>> X = arange(255, typecode='b')
>>> sum(X)
129
>>>
How can I get it to sum the array in a full-width accumulator, without
making an up-sized copy of the array?
David Smith
ps. The array I am working with is a 2-d noncontinguous slice.
More information about the Python-list
mailing list