[Liboil] complex types?

David Schleef ds at schleef.org
Sun Nov 13 16:32:51 PST 2005

On Mon, Nov 14, 2005 at 01:07:52AM +0100, Stephane Fillod wrote:
> Some new liboil functions I'd like to introduce need (math) complex types.
> Those complex types may be based on 32 bit floats, double, 16 bit signed
> short ints, 8 bit unsigned ints, etc. So we need to introduce new
> type names in function names. Should it be _cf32, _cs16, _cu8, etc. ?
> Dave, what do you advise, how the new types should be added to and handled
> by the automatical function testing (ie. wrt OIL_DEFINE_CLASS) ?
> What should be the function argument type? In the case of _cf32, should
> it be "float *", or "struct { float data[2]; } *" ?
> Rem: I prefer the first one.

Eu, gross.

Is there any reason to have complex integer types?  I can understand
the need for complex float/double.

Do you mean 'float *' as in having two pointers, one for real and
one for imaginary parts?  Or 'float *' as in 'float *d_2xn' that
has n interleaved real and imag float values?  It's not clear which
would be better from a speed standpoint.

I'm inclined to avoid the struct idea.

Also, would it be possible to define functions without inventing
new types?  I.e., oil_sincos_f64() could be thought of as a complex
function.  I think I would prefer to explore that route, since
types are exceedingly difficult to remove from the rolling ABI concept
(if even possible).


David Schleef
Big Kitten LLC (http://www.bigkitten.com/) -- data acquisition on Linux

More information about the Liboil mailing list