[Cython] Complex number (at pure C level)

David Cournapeau cournape at gmail.com
Mon Nov 24 10:17:39 CET 2008


Hi,

Is there a way to generate simple C code from complex numbers with
cython. For example, something like

cdef complex foo(complex a, complex b):
        return a  - b

which would become in C:

complex foo(complex a, complex b)
{
        return a - b;
}

And ideally, an easy way to handle complex/imaginary as members
(a.imag, etc...); assuming the C compiler supports complex.h, of
course.

David


More information about the Cython-dev mailing list