Iteration over axis 0 is built-in, so you can already do
    (vectorFunc(row) for row in array)
And you can use transpose() to make it so the axis you want to iterate
over is axis 0.
    (vectorFunc(col) for col in array.transpose(1,0))
Or just use the .T attribute
    (vectorFunc(col) for col in array.T)

So it seems kind of a toss-up whether it's worth adding a specific API
to do that.  The implementation would probably just return the
transpose with the given axis in the zero slot.   Something like:

def axisiter(arr, i):
    ax = [i] + range(arr.ndim)
    del ax[i+1]
    return arr.transpose(ax)

--bb

On 9/15/06, Brendan Simons <[EMAIL PROTECTED]> 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.
>
> Thoughts?
>     Brendan

-------------------------------------------------------------------------
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

Reply via email to