[Vala] Partial GSL Binding (Complex and statistics)



hello to everyone, here is a partial binding of GSL. I will add the rest as soon as I write it.

attachments should be copied to the vala/vapi folder

Here's an example:

// test.vala
// compile with: valac test.vala --pkg gsl
using GLib;
using Gsl;

public class Test : GLib.Object
{
    public static void main (string[] args)
    {
        double mean, max, min;

        double[] data = "" double[] { 17.2, 18.1, 16.5, 18.3, 12.6 };

        mean = Stats.mean (data, 1, data.length);
       
        Stats.minmax (out min, out max, data, 1, data.length);
       
        stdout.printf("mean %g\n", mean);
        stdout.printf("min %g\n", min);
        stdout.printf("max %g\n", max);
    }
}

Here's an other:
// test2.vala
// compile with: valac test2.vala --pkg gsl
using GLib;
using Gsl;

public class Test : GLib.Object
{
    public static void main (string[] args)
    {
        GslComplex a = Complex.rect(3, 4);
        GslComplex b = Complex.rect(1, 2);
        GslComplex z = Complex.add(a, b);
        stdout.printf("result = %g+%gi\n", z.real, z.imag);
    }
}

Matias

Attachment: gsl.deps
Description: Binary data

Attachment: gsl.vapi
Description: Binary data

Attachment: gsl-complex.vapi
Description: Binary data

Attachment: gsl-stats.vapi
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]