From: JJ <jos...@ya...> - 2006-10-20 20:27:23
|
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 |