Francesc Alted wrote:
> A Thursday 05 March 2009, Francesc Alted escrigué:
>   
>> Well, I suppose that, provided that Cython could perform the for-loop
>> transformation, giving support for strided arrays would be relatively
>> trivial, and the performance would be similar than numexpr in this
>> case.
>>     
>
> Mmh, perhaps not so trivial, because that implies that the stride of an 
> array should be known in compilation time, and that would require a new 
> qualifier when declaring the array.  Tricky...
>   
No, one could do the same thing that NumPy does (I think, never looked 
into it in detail), i.e:

decide on dimension to do innermost dynamically from strides and sizes
save the stride in that dimension for each array
for loop using n-dimensional iterator with larger per-loop overhead:
   save offsets
   for loop on the innermost dimension with lower per-loop overhead:
       component-wise operation using offsets and innermost strides

Dag Sverre
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to