suggestions for slices of matrices

JJ josh8912 at
Tue Oct 10 01:17:28 CDT 2006

I haven't been following development too closely
lately, but I did just download and reinstall the
current svn version.  For what its worth, I would like
to again suggest two changes:

--  If M is a nxm matrix and P and Z are nx1 (or 1xn)
matrices, then it would be nice if we could write
M[P==Z,:] to obtain all columns and only those rows
where P==Z.  Likewise, for 1xm (or mx1) matrices U and
V, it would be nice to be able to use M[P==Z,U==V]. 
Also, it would be nice to use M[P==Z,U==2], for
example, to obtain selected rows where matrix U is
equal to a constant.

--  It would be nice to slice a matrix by using
M[[1,2,3],[3,5,7]], for example.

I believe this would help make indexing more user
friendly.  In my humble opinion, I think indexing is a
weak spot in numpy.  I find that most of my debugging
involves finding the right code to make a matrix slice
the way I want it.


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

Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash

More information about the Numpy-discussion mailing list