[Numpy-discussion] argmin and unsigned types
Robert Kern
rkern at ucsd.edu
Thu Oct 21 12:22:20 CDT 2004
argmin locates the minimum by finding the maximum of the negative of the
input. Unfortunately, for unsigned arrays, the negative has nothing to
do with the actual numerical negative.
Example:
>>> from numarray import *
>>> a = arange(10).astype(UInt8)
>>> print a
[0 1 2 3 4 5 6 7 8 9]
>>> print -a
[ 0 255 254 253 252 251 250 249 248 247]
>>> argmin(a)
1
We need a separate argmin to handle these arrays properly.
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Numpy-discussion
mailing list