On Wednesday 21 January 2009 13:55:49 Neal Becker wrote: > I'm only interested in simple strided 1-d vectors. In that case, I think > your code already works. If you have c++ code using the iterator > interface, the iterators dereference will use (*array )[index]. This will > use operator[], which will call PyArray_GETPTR. So I think this will obey > strides.
You are right. I had forgotten that I had simple strided vectors working. > Unfortunately, it will also be slow. I suggest something like the > enclosed. I have done some simple tests, and it seems to work. I wonder why PyArray_GETPTR1 is slow. Is it because of the implied integer multiplication? Unfortunately, your approach means that iterators can become invalid if the underlying array is resized to a larger size. Hmmh, perhaps we could make this configurable at compile-time ... Thanks for the code. Could you provide some benchmarks on the relative speeds of the two approaches? Regards, Ravi _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion