[Numpy-discussion] Scalar math module is ready for testing
Ted Horst
ted.horst at earthlink.net
Sun Apr 30 16:50:08 EDT 2006
Here is an issue I am having with scalarmath:
>>> import numpy
>>> numpy.__version__
'0.9.7.2462'
>>> import numpy.core.scalarmath
>>> a = numpy.array([1], 'h')
>>> 1*a
array([1], dtype=int16)
>>> 1*a[0]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for *: 'int' and 'int16scalar'
This happens because PyArray_CanCastSafely returns false for casting
from int to short. alter_scalars(int) fixes this, but I have lots of
non-numpy code that I don't want to behave differently.
Ted
On Apr 28, 2006, at 02:12, Travis Oliphant wrote:
> The scalar math module is complete and ready to be tested. It
> should speed up code that relies heavily on scalar arithmetic by by-
> passing the ufunc machinery.
More information about the NumPy-Discussion
mailing list