From: Ivan V. i B. <iv...@ca...> - 2006-10-04 11:24:45
|
It seemed that discontiguous arrays worked OK in Numexpr since r1977 or so, but I have come across some alignment or striding problems which can be seen with the following code:: import numpy import numexpr array_length =3D 10 array_descr =3D [('c1', numpy.int32), ('c2', numpy.uint16)] array =3D numpy.empty((array_length,), dtype=3Darray_descr) for i in xrange(array_length): array['c1'][i] =3D i array['c2'][i] =3D 0xaaaa print numexpr.evaluate('c1', {'c1': array['c1']}) print numexpr.evaluate('c1', {'c1': array['c1'].copy()}) Im my computer, Pentium IV with NumPy 1.0rc1 and Numexpr r2239 (unmodified) this gives the following result:: [ 0 109226 -1431699456 2 240298 -1431699456 4 371370 8 633514] [0 1 2 3 4 5 6 7 8 9] The test works right when ``evaluate()`` is used with 'c2' instead of 'c1', and also when 'c2' also measures 32 bits and fields are aligned. Maybe the ``memsteps`` value is not getting used somewhere. Any ideas on this? :: Ivan Vilata i Balaguer >qo< http://www.carabos.com/ C=C3=A1rabos Coop. V. V V Enjoy Data "" |