[Numpy-discussion] What is Numeric3 anyway?

Travis Oliphant oliphant at ee.byu.edu
Sat Mar 26 22:51:25 EST 2005

>>> 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'>
> All scalar types by default will do math operations as rank-0 arrays 
> (which haven't been brought back in yet).   That is why the error.   I 
> believe that right now I am inheriting first from the Generic Scalar 
> Type instead of the double type (so it will use Scalar Arithmetic 
> first).   Later, 

> special methods for each scalar type could be used (for optimization).

To clarify, it is the umath operations that have not been 'brought back 
in', or activated, yet.  The rank-0 arrays are of course there as they 
have always been.


More information about the NumPy-Discussion mailing list