[SciPy-user] Calling C code (Newbie Question)

Tom Kornack tom at kornack.com
Tue Sep 28 00:27:29 CDT 2004

Hi Robert:

> Your code:
>      sh = sum( cn*sin(outerproduct(om,time) ), 1)
> My code:
>      sh = dot(sin(outerproduct(time, om)), cn)

Thanks for your suggestions. Using dot() is better than sum(), however, 
the outerproduct() alone gives me malloc errors and I have 2 GB memory. 
I mean, it's a huge matrix that gets created when I have a million 
points. That's why I wanted to use C.

The better question for this list would be: how do I Weave this in C?

>  for i in range(numf):
>        s2[i] = sum( sin(2.*om[i]*time) )
>        c2[i] = sum( cos(2.*om[i]*time) )

Sorry for the rather basic question.


More information about the SciPy-user mailing list