<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&#39;m re-sending it.</div>
<div><br></div><div>I&#39;m in need of fast computations on complex numbers from Cython. I&#39;ve been converting a Python groundwater flow model code to Cython, but I&#39;m reaching the point where I&#39;d really prefer to have native C complex math. Up to now, I&#39;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&#39;m nearly to the point where I&#39;ll need to store series coefficients for performance purposes, and then I&#39;ll either need to hide them in float arrays (and that&#39;s extremely nasty), or something like that.</div>
<div><br></div><div>I&#39;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 &#39;cfloat&#39; maps to the appropriate type in the C compiler, e.g. &quot;double _Complex&quot; in gcc.</div>
</span><div><br></div>I&#39;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>