[Numpy-discussion] untenable matrix behavior in SVN

Alan G Isaac aisaac at american.edu
Fri Apr 25 19:17:17 EDT 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,:] 


> On Fri, Apr 25, 2008 at 2:57 PM, Alan G Isaac 
> <aisaac at american.edu> wrote:
>> 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]. 


On Fri, 25 Apr 2008, Charles R Harris apparently wrote:
> I would give it up and let x(0) be a submatrix, the normal 
> indexing is then exactly like an array. True, the result 
> of x(0) can't be used as an lvalue (only getitem 
> equivalence), but otherwise it should work fine. 

The "it" here is ambiguous.
Which do you want to give up?

        - x[0][0]==x[0,0] ?
          the argument has been that this is a fundamental
          expectations for 2d array-like objects, and 
          I think that argument is right

        - x[0]==x[0,:] ?
          I believe you mean we should give this up,
          and if so, I strongly agree.  As you know.
          Enforcing this is proving untenable and costly.

Cheers,
Alan Isaac






More information about the NumPy-Discussion mailing list