Ask Your Question

Is nonlinear minimization (like Levenberg–Marquardt) directly available?

asked 2013-07-20 07:08:04 -0500

uvts_cvs gravatar image

I need to minimize a function f of 3 variables (or more). f has a particular form because it is a sum of squares of nonlinear function of the 3 variables, for example:

double f(double x1, double x2, double x3)
 double acc = 0;
 for ( size_t i = 0; i < N; i++ ) {
   acc += pow(g(x1,x2,x3,i),2);
 return acc;

std::vector< double > data;
double g(double x1, double x2, double x3, size_t i)
 return some nonlinear function of x1, x2, x3, data[i]

Is there any direct available algorithm for this kind of minimization?

For example I read here that the C++ class detail::BundleAdjusterBase uses Levenberg–Marquardt algorithm but it doesn't seem to me that this algorithm is directly available.

edit retag flag offensive close merge delete



there is a LevMarqSparse class in modules/contrib/compat.hpp, but you'll have a hard time, finding docs for it

berak gravatar imageberak ( 2013-07-20 15:51:48 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2013-07-20 09:51:24 -0500

Nghia gravatar image

I've used lmfit with good success

edit flag offensive delete link more

answered 2013-07-22 07:05:32 -0500

jensenb gravatar image

You may also want to try out the ceres-solver optimization library from google. It has some pretty nice features including automatic differentiation.

edit flag offensive delete link more

Question Tools



Asked: 2013-07-20 07:08:04 -0500

Seen: 4,396 times

Last updated: Jul 22 '13