On 6/22/06, Alan G Isaac <[EMAIL PROTECTED]> wrote:
> Alan G Isaac wrote:
>> M.transpose()[V>0]
>> If you want the columns as columns,
>> you can transpose again.


On Wed, 21 Jun 2006, Keith Goodman apparently wrote:
> I can't get that to work when M is a n by m matrix:

The problem is not M being a matrix.
You made V a matrix (i.e., 2d).
So you need to ravel() it first.
>> M.transpose()[V.ravel()>0]

No dice, V.ravel() returns a matrix still.  Looks like you'll need
M.T[V.A.ravel()>0].T
 
Just lovely.  Is the new bool conversion thingy going to help make the syntax more reasonable for matrices, too?  Seems like it will still require M[:,V.A.ravel() > 0]  or M[:, V.A.squeeze () > 0] or M[:,V.A[:,0]>0]

Anyway, this seems to me just more evidence that one is better off getting used to the 'array' way of doing things rather than clinging to Matlab ways by using 'matrix'.  Is it worth dealing with the extra A's and asmatrix()'s and squeeze()'s that seem to crop up just to be able to write A*B instead of dot(A,B)  (*)?

--Bill

(*) Ok, there's also the bit about being able to tell column vectors from row vectors and getting useful errors when you try to use a row that should have been a column.  And then there's also the .T, .I, .H convenience factor. 
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to