[Numpy-discussion] Numeric3 CVS compiles now

Arnd Baecker arnd.baecker at web.de
Sat Mar 26 13:31:14 CST 2005


Hi Travis,

On Fri, 25 Mar 2005, Travis Oliphant wrote:

> To all who were waiting:
>
> I've finished adding the methods to the array object so that Numeric3 in
> CVS now compiles (at least for me on Linux).

Compilation is fine for me as well (linux).
I played around a bit -
Obviously, addition of arrays, multiplication etc. don't work
yet (as expected, if I remember your mails correctly).
One thing which confused me is the following

In [1]:from ndarray import *
In [2]:x=arange(10.0)
In [3]:scalar=x[3]
In [4]:print scalar+1
---------------------------------------------------------------------------
exceptions.TypeError                 Traceback (most recent call last)
TypeError: unsupported operand type(s) for +: 'double_arrtype' and 'int'
In [5]:print type(scalar)
<type 'double_arrtype'>

OK, this has been discussed up-and-down on this mailing
list. At the moment I don't know how this
will affect my Numeric(3) life, so I will wait
until the other operations are implemented
and see if there are any consequences
for my programs at all ... ;-)

A couple of things seem to be a bit unusual, e.g.:

In [9]:x=arange(10.0)
In [10]:x
Out[10]:array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0], 'd')
In [11]:x.argmax()
---------------------------------------------------------------------------
exceptions.TypeError                                 Traceback (most
recent call last)

/home/scratch/abaecker/INSTALL_SOFT/TEST_NUMERIC3/<console>

TypeError: function takes exactly 1 argument (0 given)
In [12]:x.argmax(None)
Out[12]:9
In [13]:t=x.argmax(None)
In [14]:type(t)
Out[14]:<type 'int_arrtype'>

So argmax also returns an array type, but I would
have really thought that this is an integer index?!

Also a couple of attributes (E.g. x.sum() are not yet
implemented) or lack documention (I know this comes last ;-).

Best,

Arnd





More information about the Numpy-discussion mailing list