On Mon, Dec 29, 2008 at 5:25 PM, Robert Bradshaw <[email protected]> wrote: > I need this for something I'm working on, so I'll try and pick up > where you left off. >
OK, here you have... Sorry about the mess... * the "CCOMPLEX.diff" patch was generated against cython-devel (updated about 3 hours ago) * The "ccompleximpl.h" header has some macros that should end-up verbatim in the Cython-generated sources, perhaps by using utility code. * The "ccomplex.pyx" is a testcase that should go to "tests/run" (and assumes the "ccompleximpl.h" is also in "tests/run"). -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594
CCOMPLEX.diff
Description: Binary data
#ifndef __cplusplus
/* C99 */
#include <complex.h>
typedef complex __Pyx_complex_t;
#define __Pyx_creal(z) (creal(z))
#define __Pyx_cimag(z) (cimag(z))
#define __Pyx_complex(r,i) ((r)+_Complex_I*(i))
#else
/* C++ */
#include <complex>
typedef std::complex<double> __Pyx_complex_t;
typedef __Pyx_complex_t complex;
#define __Pyx_creal(z) ((z).real())
#define __Pyx_cimag(z) ((z).imag())
#define __Pyx_complex(r,i) (__Pyx_complex_t((r),(i)))
#endif
static inline PyObject *__pyx_PyComplex_FromCComplex(__Pyx_complex_t z)
{
return PyComplex_FromDoubles(__Pyx_creal(z), __Pyx_cimag(z));
}
static inline __Pyx_complex_t __pyx_PyComplex_AsCComplex(PyObject *ob)
{
Py_complex z = ((PyComplexObject *)ob)->cval;
return __Pyx_complex(z.real, z.imag);
}
ccomplex.pyx
Description: Binary data
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
