[Numpy-discussion] Numpy complex types, packing and C99

Pauli Virtanen pav@iki...
Wed Jul 1 15:34:00 CDT 2009


On 2009-07-01, Charles R Harris <charlesr.harris@gmail.com> wrote:
[clip]
> OK. I don't see a problem then. As David says the ufuncs 
> already work that way. <checks c99> Hmm... do we want to 
> implement creal{l,,f} and cimag{l,,f} also?

They might come useful.

> They are built in functions in gcc, can we detect that?

Don't know, probably we can?

> Anyway, those functions would make rewriting the current 
> complex functions pretty easy. Or do we want to rewrite the 
> current functions to be ABI compatible with c99?

I think that for scipy.special this would be useful. Of course, 
the operator semantics for complex numbers can't be used there, 
but still sticking closer to C99 could be useful.

A separate question is whether we want to implement Numpy's 
complex ufuncs using the C99 ones when they are available. 
I had a branch for this:

    http://github.com/pv/numpy-work/tree/c99-complex-umath

This has some risks: the system-provided complex-valued functions 
may be broken in different ways, or suffer from some subtle 
flaws. This is likely more common than having broken real-valued 
functions that have been around quite a while longer. (To give an 
example: casinh(1e-20) == 0 with GNU Libc 2.9.)

-- 
Pauli Virtanen



More information about the Numpy-discussion mailing list