Soren,

For future reference, you might want to direct weave-related questions
to the [EMAIL PROTECTED] mailing list.

> def cartPolFast(xlen, ylen, x_c, y_c):
>
>     res = zeros((xlen,ylen))
>
>     code = """
>     {
>     int xlen, ylen, x_c, y_c;

This line is unnecessary, because weave exposes those variables inside
the local scope of your code.  This also makes the braces at the top
and bottom of the code block unnecessary.

>     for( x = 0; x == xlen; x++)
>            for( y = 0; y == ylen; y++)
>                 rel_x = x-x_c;
>                 rel_y = y_c-y;
>
>                 res(x,y) = rel_y*rel_y;
>     }

Two things:
1. You need to put curly braces around the three lines of the inner
loop.
2. You need to change "x == xlen" and "y == ylen" to "x < xlen" and "y
< ylen".

I made these modifications to your code and it runs fine on my machine
(macbook pro, OS 10.4, scipy 0.5.2.dev2314).


-peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to