slicing suggestion

JJ josh8912 at yahoo.com
Fri Oct 20 16:27:14 EDT 2006


Hello.
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?

John     

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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




More information about the NumPy-Discussion mailing list