[Numpy-discussion] suggestions for Matrix-related changes

JJ josh8912 at yahoo.com
Tue Jul 11 18:16:45 CDT 2006


Hello.  For what its worth, as a newly ex-matlab user I would like to make a few
suggestions on use of matrices in numpy.  As per earlier discussions, I like the
idea of being able to choose matrices as the default (vs arrays).  But if
possible, it would be nice if all functions etc that took matrices also returned
matrices.  I know effort has been made on this.  Here are my suggestions:

1) is it possible to get the function unique() to work with matrices, perhaps
with a unique_rows() function to work with matrices of more than one column?

2) It would be very convienient to have some simple way to delete selected
columns of a matrix.  For example, in matlab the command is X[:,[3,5,7]]=[] to
delete the three selected columns.  It would be nice if such a command would
also work with selections, as in X[:,A[0,:]<4] = [], where X and A are matrices.
 For me, the single most frustrating and time-consuming aspect of switching to
and using numpy is determing how to select columns/rows of arrays/matrices in
different situations.  In addition to being time consuming to figure out
(relative to Matlab), often the code is quite verbose.  I have made a few
suggestions on this topic in an earlier post (under the title "Whats wrong with
matrices?").

3) It would be nice if matrices could be used for iterations.  For example, if M
was a 1 x n matrix, it would be nice to be able to use:  for i in M:  and
iterate over the individual items in M.  

4) It would be nice if the linear algebra package and other packages returned
matrices if given matrices.  For example, if M is a matrix, svd(M) now returns
arrays.

Just some suggestions.  I wish I knew more so I could help implement them. 
Maybe one day.
JJ







More information about the Numpy-discussion mailing list