[Top][All Lists]

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

Re: call octave from C for nonlinear optimization

From: pkienzle
Subject: Re: call octave from C for nonlinear optimization
Date: Tue, 11 Nov 2003 01:51:35 -0000

On 10 Nov 2003 at 15:58, Michael Creel wrote:

> Hello,
> I'm interested in using optimizers written in C (or fortran) to optimize 
> objective functions defined using Octave .m files. So far I can call the .m 
> files, so this looks feasible. For example, the attached files (thanks P. 
> Kienzle and other posters for the basis for this) files allow me to use 
> Poisson.m to define the likelihood function value supposing a Poisson 
> density.  So, this looks pretty simple. My plan is to extend this to pass the 
> obj. fun. value to an optimizer in C. 
> Since the loops in the optimization program will be in C, and the objective 
> function defined in Octave will contain no loops, I _suppose_ this will be 
> faster than plain Octave.

I, too, suspect that the overhead of Octave will kill the 
performance of a minimizer written in C.  It would be nice 
to use Octave where it is particularly useful (playing with 
different algorithms) but still get the performance when
you need it by recoding the objective function in C.
You could certainly write your objective function in C
by having it take and return octave values, and your
minimizer would be none the wiser. The question is 
whether marshalling the parameters from the minimizer 
into octave values and out again is terribly expensive,
and if we would need to pass the underlying objective
function handle directly rather than going through the 
octave value interface.

> The motivation is that I believe I can find robust, fast, general purpose 
> optimizers written in C, so I'd like to use them.

Please do report on any such minimizers you find.  
E.g., I notice that MINUIT, the CERNLIB minimizer 
has been released under the GPL.

Paul Kienzle

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]