[SciPy-user] Re: vectorize(function)/arraymap did not return arrays?

Yichun Wei yichunwe at usc.edu
Mon Jan 31 14:00:11 EST 2005


I have a python function to compute 1d convolution. I need to evaluate 
this convolution on a 2d grid. So I have to loop through all the rows 
and columns on this grid, at this point I found the nested looping is 
kind of slow to my expectation, and the inner function call to the 
convolution function, since it's using scipy's fftpack or Numeric, I do 
not think the inner function call could be speeded a lot more by written 
C code in weave. Thus, to implement the inner function call in C, I have 
to reimplement all the stuff from array reshaping, multiplying to 
convolving. I was just curious about whether it would be a big win if I 
write the for loops in C, while keeping the inner-loop function the way 
it was (for I think it is fast enough).


Prabhu Ramachandran wrote:
> Well, why do you need weave if you need to call Python from it?  Why
> not write it in pure Python?  If you are looking for speed, your weave
> code should be C.  Weave lets you call C from within Python, doing the
> reverse is usually of no use.
> 
> cheers,
> prabhu

Thank you,
yichun




More information about the SciPy-User mailing list