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

JJ josh8912 at yahoo.com
Sat Jul 8 15:22:03 CDT 2006


Hello.  My 2 cents may be late on this, but I do have some thoughts as a matlab
user switching over to numpy/scipy.  I will just list my points, and I have a
general question at the end.

1)  I vote for a simple way to allow matrices to be the default (vs arrays),
with all matrix operations/functions/range selections returning matrices.
2)  Allowing more than 2D matrices would be nice, but I dont need them often.
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.
3)  From my experience so far, range selection is by far the most problematic
part of using numpy.  In matlab, range selection is very easy and intuitive. 
For example, if X is a 10 x 5 matrix, a = X[X[:,1]<3,1:3] works just fine.  In
numpy it is much more confusing and the code to do this is relatively lengthy. 
It would be nice if range selection for a matrix could be done using any
combination of boolean and/or integer matrices (not lists or arrays,
necessarily).  For example, boolean selection for rows and integer selection for
columns.
4)  It would be very nice if range selection could be done with real numbers,
such as 1.0, 2.0, etc.  Matlab can do this and it makes the code much simpler.   
5)  If X is a 1,n matrix, then X.T should return a n,1 matrix, I think.

I guess thats my main points.  And now I have a question.  What do people think
about the role of numpy/scipy vs. R (other than one is python and one is not)? 
What are the benefits of numpy/scipy over R?  In the future, do numpy users want
stat libraries like R has?  Or put another way, when numpy/scipy is mature, when
would you use numpy and when would you use R?

Thanks.  JJ (John)












More information about the Numpy-discussion mailing list