On Jul 20, 2009, at 7:32 AM, Ethan Van Andel wrote:

> when I compile some code containing this snippet: (np = numpy)
>
> COMPLEX = np.complex128
> ctypedef np.complex128_t COMPLEX_T
>
> class Riemann_Map():
>     def __init__(self,fs,fprimes,a1,N,int ncorners = 4,opp = False):
>         cdef COMPLEX_T a = np.complex128(a1)
>
> I get these errors (among others):
> c:1316: error: incompatible types in assignment
> and
> c:1316: error: previous implicit declaration of
> ‘__pyx_PyObject_As___pyx_t_double_complex’ was here
>
> where c:1316 is the line corresponding to, cdef COMPLEX_T a ...
>
> I am compiling this using Cython 0.11.2.beta in the sage -b  
> environment.
>
> What am I doing wrong?

I said this elsewhere, but should clarify it here too, you have to  
declare the type as "complex double" which goes fine into a complex  
ndarray. I'm not sure when or how arithmetic of np.complex128_t will  
be supported, but unlike ints, on all platforms I know of, sizeof 
(float) = 32 and sizeof(double) = 64 (leading to the 64 and 128 bit  
complex types respectively).

- Robert


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to