Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] nonlinear fit function binding
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-06-04 (07:37)
From: Matthieu Dubuget <matthieu.dubuget@g...>
Subject: Re: [Caml-list] nonlinear fit function binding
Thanks for your reply, Rabih.

2007/5/31, <>:
>  I did a wrapping of the levmar library.

Unfortunately, since I am to use this in a commercial product, and I was not
able (yet ?) to convince my boss to release the sources, I can't use with
levmar, wich is GPLed... I may switch to cminpack. But i think this is not
related to my current question.

The approach I chose is to allocate bigarrays from Caml, and pass them to
> the main C function, along with the function f.
Does it mean that each time f function is called by the minimization, the C
wrappers has to copy the params C array into your Bigarray pre-allocated
storage place? That's why I choosed to leave the C array untouched and wrap
a Bigarray around it  (should not be a big amount of memory). Am I wrong in
going this way?

In the main function, I register f and all the bigarrays as global roots,
> and then call as many times the c sub function to compute the minimization.

I do not understand this part. f is passed to the main (C) function from
OCaml: why do you need to register it as a global root? Same question for
the Bigarrays? Does it mean that else, nothing in OCaml world would point to
> Feel free to ask for more precisions if needed
> Hope this helps.
Surely. I really need to acquire a better understanding of GC and C
interface in OCaml.
Really, I do not understand what happens to those C allocated Bigarrays...