pnumpy icon indicating copy to clipboard operation
pnumpy copied to clipboard

getitem/setitem putmask hooks

Open tdimitri opened this issue 5 years ago • 2 comments

boolean and fancy index masking related routines can be sped up and are used very often. Be nice if we could hook these routines.

tdimitri avatar Oct 05 '20 14:10 tdimitri

We may have to hack the tp_getitem, tp_setitem to do this.

mattip avatar Oct 06 '20 14:10 mattip

Yes, to replace "mask" and fancy-indexing, generically, we would likely need to replace the Python-level functions. There might be a way to speed things up a bit by replacing functions on the "PyArray_ArrFuncs *f" member of the PyArray_Descr ("dtype") object. There are functions there that also need to be swapped out to speed up sorting, and such. See lines near 443 to 553 of ndarraytypes.h (though I may have an old version of the NumPy code checked-out).

teoliphant avatar Oct 08 '20 05:10 teoliphant