[Liboil] complex types?
Stephane Fillod
f8cfe at free.fr
Mon Nov 14 00:50:07 PST 2005
On Sun, Nov 13, 2005 at 04:32:51PM -0800, David Schleef wrote:
> 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.
Some applications do complex fixed-point (integer) computations.
This is a lot faster on FPU-less systems.
> 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 mean 'float *' as in 'float *d_2xn' that has n interleaved real and
imag float values. Speed can be one reason, existing data model of
applications and/or hardware devices is another one.
> I'm inclined to avoid the struct idea.
Me too.
> 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).
oil_sincos_f64()-like prototype does not fit my need, because "complex"
args are not interleaved. BTW, I don't understand why offset and interval
are passed by address and not by value in oil_sincos_f64.
So, shall we take the 'float *d_2xn' route?
NB: some args may be complex, some others may be real only.
As an example, what would be the name of a sincos outputing interleaved
complex doubles? oil_sincos_cif64, or better name? sincos is not a good
example, but we need to distinguish between complex or not, interleaved
or not, for functions like liboil_*mult_ because the maths are different.
What the OIL_DEFINE_CLASS should look like?
--
Stephane
More information about the Liboil
mailing list