Brendan Simons wrote: >Hi all, > >Just wondering if there was an arbitrary axis iterator in numpy, or >if not, if there's demand for one. What I'm looking for is something >which would allow me to do something like (vectorFunc(column) for >column in array.axisIter(1) ) without a bunch of for loops and slicing. > >
Hmm... I can't think of something directly in Python, but it would be pretty easy to add. You could probably also do something clever by creating your own ufunc with frompyfunc and object arrays. In C, this would be easy. In the C-API there is a function PyArray_IterAllButAxis which provides an iterator that iterates over all axes but one. Then, you would call the vectorFunc for each element in the loop. The ufuncs use this functionality to call the underlying 1-d loops. -Travis ------------------------------------------------------------------------- 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