On 3/27/07, Zachary Pincus <[EMAIL PROTECTED]> wrote:


So we are left with the current behavior:
(a) M[i,:] is a matrix.
(b) M[i] is a matrix.
(c) Iteration over M yields matrices.


I find it useful if M[i] indexes the matrix interpreted as a column-vector
(vec(M), or M(:) in
Matlab notation),  e.g.,  you could pick out the diagonal as M[::n+1],  or
if N is an index-set
of certain elements in M,  then you could access those elements as M[N].
Then I would also say that iterating over a matrix should just return the
elements of vec(M) one by
one.

In general, I think the Matlab notation works well:
* M[I,J]  where I and J and index-sets returns a len(I) x len(J) matrix
* M[I] returns a len(I) vector (a column or row vector depending on
orientation of I)
The index-sets could be a single integer, a list, or a slice.

But I can see there are good arguments for using the NumPy conventions as
well...
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to