[Liboil] complex types?
Stephane Fillod
f8cfe at free.fr
Tue Nov 15 15:56:08 PST 2005
On Mon, Nov 14, 2005 at 06:54:51PM -0800, David Schleef wrote:
[..]
> > 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.
>
> Ok, good.
>
> > oil_sincos_f64()-like prototype does not fit my need, because "complex"
> > args are not interleaved.
>
> How about:
>
> oil_sincos_interleaved_f64(double *d_2xn, double *s1_1, double *s2_1,
> int n)
> {
> int i;
> for(i=0;i<n;i++){
> d_2xn[i*2 + 0] = cos(*s1_1 + *s2_1 * i);
> d_2xn[i*2 + 1] = sin(*s1_1 + *s2_1 * i);
> }
> }
With stride or without ? Should stride be present everywhere?
Personaly, I don't need stride in forseeable future.
> Also,
>
> oil_complexmult_f64 (double *d_2xn, double *s1_2xn, double *s2_2xn, int
> n)
> {
> int i;
> double a, b, c, d;
> for(i=0;i<n;i++){
> a = s1_2xn[2*i + 0];
> b = s1_2xn[2*i + 1];
> c = s2_2xn[2*i + 0];
> d = s2_2xn[2*i + 1];
> d_2xn[2*i + 0] = a * c - b * d;
> d_2xn[2*i + 1] = a * d + b * c;
> }
> }
>
> So in other words, complex would be a convention, not a new type,
> somewhat like ARGB. BTW, I'm trying to avoid the issue in order to
> take a wait-and-see approach.
Good, I like it.
Can you please take care of adding the 2xn support and OIL_DEFINE_CLASS
handling ? I'm not confortable enough yet with the test harness.
> > BTW, I don't understand why offset and interval
> > are passed by address and not by value in oil_sincos_f64.
>
> Everything is pass-by-address because it's about a million times
> easier on the automatic testing and marshalling code. And that's
> one of the reasons why liboil exists instead of being prototype
> code in my random hacking directory.
Too bad for the pass-by-address on simple args :-(
On a different topic, can you please explain what is the convention
about implementation modifiers like "_i10", "_l10" ? I will need
them for sincos.
--
Stephane
More information about the Liboil
mailing list