slicing suggestion

JJ josh8912 at
Fri Oct 20 15:27:14 CDT 2006

I have a suggestion that might make slicing using
matrices more user-friendly.  I often have a matrix of
row or column numbers that I wish to use as a slice. 
If K was a matrix of row numbers (nx1) and M was a nxm
matrix, then I would use ans = M[K.A.ravel(),:] to
obtain the matrix I want.  It turns out that I use
.A.ravel() quite a lot in my code, as I usually work
with matrices rather than arrays.  My suggestion is to
create a new attribute, such as .AR, so that the
following could be used: M[K.AR,:].  I believe this
would be more concise, easier to read, and well used. 
If slices are made in both directions of the matrix,
then the .A.ravel() becomes even more unwieldy.  Does
anyone else like this idea?


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

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

More information about the Numpy-discussion mailing list