<span class="Apple-style-span" style="border-collapse: collapse; ">Greetings all,</span><div><span class="Apple-style-span" style="border-collapse: collapse; "><div><br></div><div>Sorry for the incomplete message, I'm re-sending it.</div>
<div><br></div><div>I'm in need of fast computations on complex numbers from Cython. I've been converting a Python groundwater flow model code to Cython, but I'm reaching the point where I'd really prefer to have native C complex math. Up to now, I've used some little C routines that I can call with multiple floats (the C code converts to/from complex for my purposes). However, I'm nearly to the point where I'll need to store series coefficients for performance purposes, and then I'll either need to hide them in float arrays (and that's extremely nasty), or something like that.</div>
<div><br></div><div>I'd like to say something like</div><div><br></div><div>cdef class Foo:</div><div> cdef cfloat z</div><div><br></div><div> def __cinit__(self, float x, float y): </div><div> self.z = cfloat(x, y)</div>
<div><br></div><div> cdef cfloat func(Foo self, float x, float y):</div><div> return-some-gnarly-function of x, y, and self.z</div><div><br></div><div><br></div><div>Or something like that, where 'cfloat' maps to the appropriate type in the C compiler, e.g. "double _Complex" in gcc.</div>
</span><div><br></div>I've seen this discussed in the archives. Has it been implemented? Is there some pre-release code that essentially works? I only need the four math functions, conjugate, abs, and log.</div><div><br>
</div><div>THANKS! I think Cython will revolutionize my research work!</div><div><br></div><div>--vic<br>
</div><div><br></div>