[Numpy-discussion] fast take patch

Eric Firing efiring@hawaii....
Fri Apr 18 03:17:13 CDT 2008

Stefan, (or anyone else who might be interested)

Since you committed my fast putmask patch many months ago, I thought you 
might like to deal with my fast take patch.  Attached is the diff 
relative to 5043, ignoring whitespace.  (Yes, those pesky whitespace 
anomalies are still cropping up.)

The motivation for the patch is that in matplotlib color mapping, such 
as when displaying an image or pcolor plot, the time-limiting factor can 
be a single numpy operation of indexing into the color map. 
It was being done with fancy indexing.  I changed that to use the take 
method, which sped it up by a factor of two, but I found that take 
itself is slower than it needs to be by a factor of 2-3.  As with 
putmask, the culprit is memmove, so I used the same strategy to 
substitute direct variable assignment when possible.

The patch includes tests for the take method.  I did not find any such 
pre-existing tests.

Thanks for taking a look.  Let me know what needs to be changed.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fasttake.diff_5043uw
Url: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080417/b0b5cafb/attachment.pl 

More information about the Numpy-discussion mailing list