[Numpy-discussion] Release of NumPy

Stéfan van der Walt stefan@sun.ac...
Wed Apr 16 04:45:02 CDT 2008


On 16/04/2008, Anne Archibald <peridot.faceted@gmail.com> wrote:
> I don't think of arrays as containers of anything but scalars, so I
>  find this whole argument from intuition extremely strange.

I see now for the first time that Matrices can't have dims > 2.  Grim.
 I do think that ColumnVector and RowVector could be useful in
general; some statements read more clearly, e.g. (for x an (N,)-array)

ColumnVector(x)

instead of

np.c_[x] # turn x into a column vector

And, while

np.dot(x,x)

is valid,

RowVector(x) * ColumnVector(x)

is clearer than

x = np.dot(np.r_[x], np.c_[x])

(which is a pattern I'd expect to find amongst linear algebra users)

The last expression also yields

array([14]) instead of 14!

>  My (draconian) suggestion would be to simply raise an exception when a
>  matrix is indexed with a scalar. They're inherently two-dimensional;
>  if you want a submatrix you should provide both indices (possibly
>  including a ":"). If you actually want a subarray, as with an array,
>  use ".A".

Your idea isn't that far out -- but I think we can provide the
expected (ndarray-like) behaviour in this case.

>  That said, I don't actually use matrices, so I don't get a vote.

Apparently, neither do I :)  But I do get to modify

http://www.scipy.org/MatrixIndexing

I also changed ProposedEnhancements into a Category page, that
automatically accumulates all WikiPages tagged with
ProposedEnhancements.

Regards
Stéfan


More information about the Numpy-discussion mailing list