[Numpy-discussion] Re: Histograms via indirect index arrays
mahs at telcopartners.com
Mon Mar 20 12:21:07 CST 2006
Travis Oliphant wrote:
> Piotr Luszczek wrote:
> 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.
FWIW, I implemented a pure-python ndarray, independent of numpy but with a
similar interface. pyarray preserves views for arbitrary indexings, by carrying
around an index array as you suggest. The reason for mentioning this here, is
that looking at it might help someone think about desired semantics of views.
More information about the Numpy-discussion