[Numpy-discussion] Status of numeric3 / scipylite / scipy_core

Travis Oliphant oliphant at ee.byu.edu
Thu Mar 17 15:02:24 EST 2005


Perry Greenfield wrote:

>
> On Mar 17, 2005, at 4:59 PM, Travis Oliphant wrote:
>
>> Perry Greenfield wrote:
>>
>>> Before I delve too deeply into what you are suggesting (or asking), 
>>> has the idea to have a slice be equivalent to an index array been 
>>> changed. For example, I recall seeing (I forget where), the 
>>> suggestion that
>>>
>>> X[:,ind] is the same as X[arange(X.shape[0]), ind]
>>>
>> This was in the PEP originally.  But, after talking with you and 
>> better understanding the "broadcasting" issues of the numarray 
>> indexing scheme, it seemed less like a good idea.  Then, during 
>> implementation it was easier to interpret slices differently.  A very 
>> natural usage fell out as I thought more about  partial indexing in 
>> Numeric:  X[ind] where X has more than 1 dimension returns in 
>> numarray something like
>>
>> result[i,j,k,...] = X[ind[i,j,k],...]
>>
>> It seems rather singular to have this Ellipsis-like character only 
>> useful for the ending dimensions of X.  Thus, I decided that 
>> X[...,ind] ought to be valid as well and return something like
>>
>> result[...,i,j,k] = X[...,ind[i,j,k]]
>>
>> So, yes, I've changed my mind (I sent an email about this when I woke 
>> up and realized a better solution).
>>
> Sorry if I missed that.
>
> Now that is cleared up, the use of slices you propose is essentially 
> as a index placeholder for an index not to be indexed by index arrays 
> (akin to what is implied by partial indexing). In that vein it makes 
> sense. Identical functionality could be had by reordering the indices, 
> doing partial indexing and then reordering to the original order. 
> That's clumsy for sure, but it probably isn't going to be done that 
> often. If you've already done it, great. Let me look it over in a bit 
> more detail tonight.

Yes, re-ordering could accomplish the same thing. 

I should warn you.  When I say "done" -- I mean I'm in the bug-fixing 
phase.  So,  expect segfaults..  I'm cleaning up as we speak.  I may not 
finish.  So, don't look at it unless you are interested in the 
implementation... because you may not get it to actually work for a day 
or two.

-Travis





More information about the NumPy-Discussion mailing list