[Numpy-discussion] Re: Histograms via indirect index arrays

Travis Oliphant oliphant.travis at ieee.org
Sat Mar 18 20:59:03 CST 2006


Piotr Luszczek wrote:
>> <shrug> Show us some code that works. I'm not interested in
>> implementing your feature request. You are. There's plenty of work
>> that you can do that doesn't depend on anyone else agreeing with you,
>> so you can stop arguing and start coding.
>>     
>
> Arguing is good to a point and I think you're right that it's time to
> stop.
>   

All true.  However, I want to thank Piotr for illustrating an important 
but easy to overlook point that in-fact "advanced" indexing produces 
copies while "simple-indexing" produces views.

The reason behind this as Tim and Rick later illustrate is that no one 
quite knows how to produce "view" semantics for an arbitrarily indexed 
array.  I did actually think about this for a while because I don't 
completely like the different behaviors which can produce warts like the 
one that Tim showed us.  

I realized that it would be possible to extend our memory model of an 
array to include an index array in the array structure itself that would 
indicate how to advance through memory (basically a pointer or its 
equivalent for each array element).   Rick showed that because this 
would have to be a "copy" of the indices and so would create too much 
slowness.  My reason for not going there was because it seemed to add 
too much complication for my tastes at the time to all the code.

But, one could still sub-class the ndarray and implement such a thing.  
I think this is the best place to explore such experimental ideas.  

Thanks again for the discussion.  There are issues like this that it is 
good to get out into the open.

-Travis








More information about the Numpy-discussion mailing list