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

Sven Schreiber svetosch at gmx.net
Sun Jul 9 09:55:55 CDT 2006


JJ schrieb:

> -----------------------------------------
> Hello Ed:
> Here are a couple of examples off the top of my head:
> 
> a = mat(arange(10))
> a.shape = (5,2)
> b = a.copy()
> c = hstack((a,b))  # should return a matrix
> type(c)
> <type 'numpy.ndarray'>


This hstack bug has been fixed recently.

> 
> a[where(a[:,0]<6)[0],0]  #should return a column
> matrix([[0, 2, 4]])

Don't know anything about this stuff.

> 
> My version is about a month old, so maybe these are fixed.  Since we are on the
> topic, I dont understand why where() returns a tupple. To me, it just means
> adding an extra '[0]' in many places in my code.  I would vote for where()
> retuning a matrix (if matrix is the default in the session).  My comment on
> transpose of a 1,n matrix producing a n,1 matrix was in response to a vote
> question on the list.  

That discussion was about pure arrays, not the matrix subclass.


> matrix is the default for a session.  Lastly, this might not be the right place
> for this comment, but it would be nice if pylab allowed numpy matrices.  

I agree, that would be nice! Maybe we can team up and invade the
matplotlib mailing list some time ;-)

-sven




More information about the Numpy-discussion mailing list