[Numpy-discussion] A couple more Numeric incompatibilitiesand a possible bug

Todd Miller jmiller at stsci.edu
Sun Mar 28 03:41:04 CST 2004

On Sat, 2004-03-27 at 01:48, Gary Ruben wrote:
> Actually, this reproduces the problem:
> >>> from numarray import *
> >>> from numarray.objects import *
> >>> abs(-1.)
> ObjectArray(1.0)
> >>> abs(-1)
> ObjectArray(1)

I'm guessing,  but I think you would like to see:

>>> abs(-1.)
>>> abs(1)

If so,  this is a bug.  Two things are going on:

1)  numarray.objects redefines abs()

2) Internally, numarray has a concept of "rank-0" arrays which it uses
to represent scalars.  Apparently,  numarray.objects lacks the extra
code to filter rank-0 arrays out (convert back to scalars) as is done
with numerical arrays.

I logged this as a bug on Source Forge and it will be fixed for 1.0.


Todd Miller <jmiller at stsci.edu>

More information about the Numpy-discussion mailing list