Re: [Numpy-discussion] need inverse of PyArray_ITER_GOTO1D

2008-01-02 Thread Neal Becker
Neal Becker wrote: > I need a function that is the inverse of PyArray_ITER_GOTO1D. A bit of > guesswork brought me to this, can anyone please tell me if it looks > correct? > > inline npy_intp as_linear (PyArrayIterObject const* it) { > if (it->nd_m1 == 0) > return (it->dataptr - it->ao->d

[Numpy-discussion] need inverse of PyArray_ITER_GOTO1D

2008-01-01 Thread Neal Becker
I need a function that is the inverse of PyArray_ITER_GOTO1D. A bit of guesswork brought me to this, can anyone please tell me if it looks correct? inline npy_intp as_linear (PyArrayIterObject const* it) { if (it->nd_m1 == 0) return (it->dataptr - it->ao->data)/it->strides[0]; else if (it