suggestions for slices of matrices

jj josh8912 at yahoo.com
Tue Oct 10 08:19:30 CDT 2006


> > --  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.
> This works already if p and z are 1-d arrays.   That seems to be the 
> only issue.  you want this to work with p and z being 2-d arrays (i.e. 
> matrices).  The problem is there is already a defined behavior for this 
> case that would have to be ignored (i.e. special-cased to get what you 
> want).  This could be done within the special matrix sub-class of 
> course, but I'm not sure it is wise.  Too many special cases make life 
> difficult down the road.
> 


Thanks for the thoughtful reply Travis.  I see I will just have to get used to
using code such as M[(P==Z).A.ravel(),:], which I can live with.  Your comments
helped put this in perspective for me.  By the way, is there a web site that
lists all the current modules (as does
http://www.scipy.org/doc/api_docs/scipy.html)?
Best,

John





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV




More information about the Numpy-discussion mailing list