[Numpy-discussion] Release of NumPy

Stéfan van der Walt stefan@sun.ac...
Tue Apr 15 11:12:14 CDT 2008


On 15/04/2008, Alan G Isaac <aisaac@american.edu> wrote:
> I thought the context of the discussion had become something
>  like this: there is no reason for the matrix interface to
>  deviate from the array interface except as needed to provide
>  specific desired functionality.  Essentially,
>
>         - matrix multiplication
>         - powers of square matrices
>         - submatrix creation
>
>  The proposal on the table is to remove an unneeded (and
>  unwanted) deviation of the matrix API from the ndarray API.
>  That is all.

Unless my memory fails me (again), this would result in another
deviation from numpy: that x[0] no longer returns the first row of any
2D array (matrix), especially when dealing with matrices of shape of
(1,N).

The whole issue occurs because a Matrix is not a proper container.  An
N-d array is a container of N-1-d arrays.  This does not currently
hold for matrices, but it *could* hold for matrices if we introduced
RowVector and ColumnVector.  Then we'd have, for arrays

x is a (3,3) array -> x[0] is a (3,) array -> x[0][0] is a scalar

and for matrices

x is a (3,3) matrix -> x[0] is a (3,) ColumnVector or RowVector ->
x[0][0] is a scalar

>  Adding row and column vectors is really orthogonal to the
>  change under discussion.  (And let me add, as a user of
>  matrices, I am never feeling the need for these. Are you?)

Orthogonal? -- so far, this is the only suggested solution that
behaves in an entirely consistent way.  That said, any solution is
better than nothing; the current behaviour is confusing.

My favorite quote in these threads so far has to be by Charles Harris:

"All this for want of an operator ;)"

Regards
Stéfan


More information about the Numpy-discussion mailing list