[Pyrex] any ideas to speed this up?
John Machin
sjmachin at lexicon.net
Thu Feb 23 03:39:44 CET 2006
On 23/02/2006 1:20 PM, Brian Blais wrote:
> Hello,
>
> I am a bit new to python and pyrex, and was wondering if anyone can help
> me here. I am trying to translate some Matlab/mex code to Python, for
> doing neural simulations. This application is definitely computing-time
> limited, and I need to optimize at least one inner loop of the code, or
> perhaps even rethink the algorithm. I've coded it into Pyrex, because
> it seems straightforward and efficient. In doing so, I have made sure to
>
> 1) take any python objects, and extract C datatypes from them outside of
> the main loop, like:
>
> cdef double eta
> eta=params['eta']
>
> 2) all of the variables in the loop are C datatypes, either ints or
> pointers.
No you haven't.
Try cdef int it, i
Also try looking at the C code generated with and without the cdef for
"i"; the results should be illuminating.
HTH,
John
More information about the Pyrex
mailing list