[Numpy-discussion] What's wrong with matrices?

JJ josh8912 at yahoo.com
Sun Jul 9 04:23:54 EDT 2006


Ed Schofield <schofield <at> ftw.at> writes:

> 
> 
> On 08/07/2006, at 10:22 PM, JJ wrote:
> 
> > 3)  In some operations, especially range selection operations, a N, 
> > 1 matrix is
> > turned into a 1,N matrix.  This is confusing relative to matlab and  
> > problematic,
> > in my view.
> 
> This sounds like a bug.  Can you give any examples of this happening  
> with the latest release or SVN version?
> 
> > <snip>
> >
> > 5)  If X is a 1,n matrix, then X.T should return a n,1 matrix, I  
> > think.
> 
> This should be the case.  Could you post a code snippet that violates  
> it?
> 
> Thanks for your feedback, JJ!
>--------------------------------------------------
Hi Ed:
Here are a couple more items:
c = cov(a)  # a is a matrix
type(c)  # should be a matrix
<type 'numpy.ndarray'>

Also, if a is 5x2, then cov(a) is 5,5.  Is that just a convention?  I would
expect the cov to be 2,2, as in matlab.  It means I have to use more transpose
methods.

D is a 1,n matrix
(D<2).nonzero()[0] 
As per my earlier comment on which(), I wish that .nonzero() did not return a
tupple.








More information about the NumPy-Discussion mailing list