[Numpy-discussion] Scalar math module is ready for testing

Arnd Baecker arnd.baecker at web.de
Fri Apr 28 00:48:04 CDT 2006


Hi Travis,

On Fri, 28 Apr 2006, 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.
>
> It needs lots of testing to be sure that it is doing the "right"
> thing.   To enable scalarmath you need to
>
> import numpy.core.scalarmath
>
> You cannot disable it once it's enabled except by restarting Python.  If
> we need that feature we can add it. The array scalars respond to the
> error modes of ufuncs.
>
> There is an experimental function called alter_scalars that replaces the
> Python int, float, and complex number tables with the array scalar
> equivalents.  Thus, to amaze (or seriously annoy) your Python friends

LOL ;-)

> you can do
>
> import numpy.core.scalarmath as ncs
>
> ncs.alter_scalars(int)
>
> 1 / 0
>
> This will return 0 unless you change the error modes...
>
> ncs.retore_scalars(int)
>
> Will put things back the way Guido intended....
>
>
> Please try it out and send us error reports.   Many thanks to Sasha for
> his help in getting all the code so it at least compiles and loads.  All
> bugs should be blamed on me, though...


Well, it does not compile for me (64 Bit opteron, as usual;-):

gcc options: '-pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC'
compile options: '-Inumpy/core/include
-Ibuild/src.linux-x86_64-2.4/numpy/core -Inumpy/core/src
-Inumpy/core/include -I/scr/python/include/python2.4 -c'
gcc: build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.c
build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.c:472: error:
redefinition of 'ulong_ctype_multiply'
build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.c:421: error:
previous definition of 'ulong_ctype_multiply' was here
build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.c:421: warning:
'ulong_ctype_multiply' defined but not used
build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.c:472: error:
redefinition of 'ulong_ctype_multiply'
build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.c:421: error:
previous definition of 'ulong_ctype_multiply' was here
build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.c:421: warning:
'ulong_ctype_multiply' defined but not used
error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC -Inumpy/core/include
-Ibuild/src.linux-x86_64-2.4/numpy/core -Inumpy/core/src
-Inumpy/core/include -I/scr/python/include/python2.4 -c
build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.c -o
build/temp.linux-x86_64-2.4/build/src.linux-x86_64-2.4/numpy/core/src/scalarmathmodule.o"
failed with exit status 1

(I can't look into this now - meeting in -2 minutes ;-)

Best, Arnd




More information about the Numpy-discussion mailing list