gsl-ocaml / mlgsl_fun.h

Markus Mottl f721575 


























































/* ocamlgsl - OCaml interface to GSL                        */
/* Copyright (©) 2002-2005 - Olivier Andrieu                */
/* distributed under the terms of the GPL version 2         */

#include <gsl/gsl_math.h>
#include <gsl/gsl_monte.h>
#include <gsl/gsl_multiroots.h>
#include <gsl/gsl_multimin.h>
#include <gsl/gsl_multifit_nlin.h>

#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>

struct callback_params {
  value closure ;  /* the closure(s) for the caml callback */
  value dbl;       /* a preallocated caml float array for monte callbacks */
  union {
    gsl_function gf;
    gsl_function_fdf gfdf;
    gsl_monte_function mf;
    gsl_multiroot_function mrf;
    gsl_multiroot_function_fdf mrfdf;
    gsl_multimin_function mmf;
    gsl_multimin_function_fdf mmfdf;
    gsl_multifit_function_fdf mffdf;
  } gslfun ;
};


extern double gslfun_callback(double, void *);
extern double gslfun_callback_indir(double, void *);

extern double gslfun_callback_f(double, void *);
extern double gslfun_callback_df(double, void *);
extern void   gslfun_callback_fdf(double, void *, double *, double*);

extern double gsl_monte_callback(double *, size_t , void *);
extern double gsl_monte_callback_fast(double *, size_t , void *);

extern int gsl_multiroot_callback(const gsl_vector *, void *, gsl_vector *);
extern int gsl_multiroot_callback_f(const gsl_vector *, void *, gsl_vector *);
extern int gsl_multiroot_callback_df(const gsl_vector *, void *, gsl_matrix *);
extern int gsl_multiroot_callback_fdf(const gsl_vector *, void *, 
				      gsl_vector *, gsl_matrix *);

extern double gsl_multimin_callback(const gsl_vector *, void *);
extern double gsl_multimin_callback_f(const gsl_vector *, void *);
extern void gsl_multimin_callback_df(const gsl_vector *, void *, gsl_vector *);
extern void gsl_multimin_callback_fdf(const gsl_vector *, void *, 
				      double *, gsl_vector *);

extern int gsl_multifit_callback_f(const gsl_vector *, void *, gsl_vector *);
extern int gsl_multifit_callback_df(const gsl_vector *, void *, gsl_matrix *);
extern int gsl_multifit_callback_fdf(const gsl_vector *, void *, 
				     gsl_vector *, gsl_matrix *);

#define GSLFUN_CLOSURE(gf,v) \
  gsl_function gf = { \
  /*.function =*/ &gslfun_callback_indir, \
  /*.params   =*/ &v }
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.