[Numpy-discussion] untenable matrix behavior in SVN

Alan G Isaac aisaac@american....
Fri Apr 25 15:57:30 CDT 2008


On Fri, 25 Apr 2008, Christopher Barker apparently wrote:
> I think a Vector object would allow both of:
> M[i,j] == M[i][j] 
> and 
> M[i] == M[i,:] 

The problem is that it would be a crime to give up
the natural production of submatrices.   The NATURAL RULE
is: to get a submatrix, use nonscalar indices.
We should *not* give up that x[0,:] is a sub*matrix*
whose first element is x[0,0] and equivalently x[0][0].
*This* is why we must have x[0]!=x[0,:] if we want,
as we do, that x[0][0]==x[0,0].

Note that the idea for attributes ``rows``
and ``columns`` is contained on the discussion page:
<URL:http://www.scipy.org/MatrixIndexing>
I claim that it is natural for these attributes
to yield properly shaped *matrices*.
Once we have these attributes, it is difficult to
see what we gain by introducing the complication
of a separate vector class.

I still see no real gain from a separate vector class
(or row and column vector classes).
Everything that has been proposed to do with these
is achievable with the corresponding matrices with
one exception: scalar indexing -> element so that
x[0][0]==x[0,0].  But this outcome is achieved
MUCH more simply by letting x[0] be a 1d array.

Anyway, I am glad you agree that letting ``x[0]`` be a 1d 
array is the proper provisional solution.

Cheers,
Alan





More information about the Numpy-discussion mailing list