Here's a stab at a solution but I don't have easy access to 64-bit linux
at the moment so it is untested. If someone is willing to test it
(and/or fix it) I'll add it to the next numarray release. It should be
noted that numarray is not 64-bit enabled (it compiles as a 32-bit
program in terms of arrays) which is another motivation to switch to numpy.
Regards,
Todd
Francesc Altet wrote:
Hi,
I've detected that numarray (1.5.2) seems to be bitten by the change in
Python 2.5 for indexes (http://docs.python.org/whatsnew/pep-353.html).
In a Linux64 machine (using Python 2.5), I get this:
a=numarray.array([1,2,3])
a[1:2]
array([1, 2]) # !
However, both Numeric and numpy seems to work well with the same
scenario.
b=Numeric.array([1,2,3])
b[1:2]
array([2])
c=numpy.array([1,2])
c[1:2]
array([2])
I see this as a major issue in numarray and poses in great danger the
intended support of PyTables for numarray that we planned for some time
(until end of 2007). It would be nice to know if the numarray crew would
be willing to address this, or, now that NumPy 1.0 is out, they have
decided to completely drop the support for it.
We'd really like to continue offering support for numarray (in the end,
it is a very good piece of software) in PyTables, but don't having a
solution for this problem anytime soon, will make this very problematic
to us.
Thanks,
Index: Src/_ndarraymodule.c
===================================================================
RCS file: /cvsroot/numpy/numarray/Src/_ndarraymodule.c,v
retrieving revision 1.96
diff -c -r1.96 _ndarraymodule.c
*** Src/_ndarraymodule.c 24 Jul 2006 20:12:12 -0000 1.96
--- Src/_ndarraymodule.c 2 Nov 2006 20:30:52 -0000
***************
*** 596,607 ****
/* Copied from Python-2.3.3 Objects/sliceobject.c */
int
! _GetIndicesEx(PySliceObject *r, int length,
! int *start, int *stop, int *step, int *slicelength)
{
/* this is harder to get right than you might think */
! int defstart, defstop;
if (r->step == Py_None) {
*step = 1;
--- 596,607 ----
/* Copied from Python-2.3.3 Objects/sliceobject.c */
int
! _GetIndicesEx(PySliceObject *r, Py_ssize_t length,
! Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step,
Py_ssize_t *slicelength)
{
/* this is harder to get right than you might think */
! Py_ssize_t defstart, defstop;
if (r->step == Py_None) {
*step = 1;
***************
*** 706,712 ****
self->nd = _snip( self->nd, self->dimensions,
dim);
self->nstrides = _snip( self->nstrides, self->strides,
dim);
} else if (PySlice_Check(slice)) {
! int start, stop, step, strided;
if (_GetIndicesEx( (PySliceObject *) slice,
self->dimensions[dim],
&start, &stop, &step, &strided) < 0)
--- 706,712 ----
self->nd = _snip( self->nd, self->dimensions,
dim);
self->nstrides = _snip( self->nstrides, self->strides,
dim);
} else if (PySlice_Check(slice)) {
! Py_ssize_t start, stop, step, strided;
if (_GetIndicesEx( (PySliceObject *) slice,
self->dimensions[dim],
&start, &stop, &step, &strided) < 0)
***************
*** 718,726 ****
Py_INCREF(Py_None);
return Py_None;
}
! self->byteoffset += self->strides[dim] * start;
! self->dimensions[dim] = strided;
! self->strides[dim] *= step;
++ dim;
} else {
Py_DECREF(rest);
--- 718,726 ----
Py_INCREF(Py_None);
return Py_None;
}
! self->byteoffset += (maybelong) (self->strides[dim] *
start);
! self->dimensions[dim] = (maybelong) strided;
! self->strides[dim] *= (maybelong) step;
++ dim;
} else {
Py_DECREF(rest);
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion