gsl-ocaml / lib / mlgsl_combi.c

Sergei Lebedev d7e0e53 



















































#include <gsl/gsl_combination.h>

#include <caml/alloc.h>
#include <caml/bigarray.h>
#include <caml/memory.h>

static void combi_of_val(gsl_combination *c, value vc)
{
    c->n = Int_val(Field(vc, 0));
    c->k = Int_val(Field(vc, 1));
    c->data = Data_bigarray_val(Field(vc, 2));
}

CAMLprim value ml_gsl_combination_init_first(value vc)
{
    gsl_combination c;
    combi_of_val(&c, vc);
    gsl_combination_init_first(&c);
    return Val_unit;
}

CAMLprim value ml_gsl_combination_init_last(value vc)
{
    gsl_combination c;
    combi_of_val(&c, vc);
    gsl_combination_init_last(&c);
    return Val_unit;
}

CAMLprim value ml_gsl_combination_valid(value vc)
{
    int r;
    gsl_combination c;
    combi_of_val(&c, vc);
    r = gsl_combination_valid(&c);
    return Val_not(Val_bool(r));
}

CAMLprim value ml_gsl_combination_next(value vc)
{
    gsl_combination c;
    combi_of_val(&c, vc);
    gsl_combination_next(&c);
    return Val_unit;
}

CAMLprim value ml_gsl_combination_prev(value vc)
{
    gsl_combination c;
    combi_of_val(&c, vc);
    gsl_combination_prev(&c);
    return Val_unit;
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.