[Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

Travis Oliphant oliphant at ee.byu.edu
Fri Jan 12 18:19:59 CST 2007


Christopher Barker wrote:

>>Now, it is exposed in the concept of an array iterator.  Anybody 
>>can take advantage of it as it there is a C-API call to get an array 
>>iterator from the array
>>    
>>
>
>Is this iterator as efficient as incrementing the index for contiguous 
>arrays? i.e. is there any point of special casing contiguous arrays if 
>you use it?
>  
>
Contiguous arrays are special-cased already (as are 1-d arrays), so not 
really.   There is a little-bit of overhead in testing for the 
special-case that you can overcome by testing for the special-case 
outside the looping structure on your own.

I'm not sure how much speed gain is accomplished doing that.

-Travis



More information about the Numpy-discussion mailing list