title: How to use the Eigen unsupported levenberg marquardt implementation?
body: <p>I'm trying to minimize a following sample function:</p>
  
  <pre><code>F(x) = f[0]^2(x[0],...,x[n-1]) + ... + f[m-1]^2(x[0],...,x[n-1])
  </code></pre>
  
  <p>A normal way to minimize such a funct could be the Levenberg-Marquardt algorithm.
  I would like to perform this minimization in c++ and have done some initial tests
  with Eigen that resulted in the expected solution.</p>
  
  <p>My question is the following:
  I'm used to optimization in python using i.e. <code>scipy.optimize.fmin_powell</code>. Here
  the input function parameters are <code>(func, x0, args=(), xtol=0.0001, ftol=0.0001, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None, direc=None)</code>.
  So I can define a <code>func(x0)</code>, give the <code>x0</code> vector and start optimizing. If needed I can change
  the optimization parameters.</p>
  
  <p>Now the Eigen Lev-Marq algorithm works in a different way. I need to define a function
  vector (why?) Furthermore I can't manage to set the optimization parameters.
  According to:<br>
  <a href="http://eigen.tuxfamily.org/dox/unsupported/classEigen_1_1LevenbergMarquardt.html" rel="noreferrer">http://eigen.tuxfamily.org/dox/unsupported/classEigen_1_1LevenbergMarquardt.html</a><br>
  I should be able to use the <code>setEpsilon()</code> and other set functions.</p>
  
  <p>But when I have the following code:</p>
  
  <pre><code>my_functor functor;
  Eigen::NumericalDiff&lt;my_functor&gt; numDiff(functor);
  Eigen::LevenbergMarquardt&lt;Eigen::NumericalDiff&lt;my_functor&gt;,double&gt; lm(numDiff);
  lm.setEpsilon(); //doesn't exist!
  </code></pre>
  
  <p>So I have 2 questions:  </p>
  
  <ol>
  <li><p>Why is a function vector needed and why wouldn't a function scalar be enough?<br>
  References where I've searched for an answer:<br>
  <a href="http://www.ultimatepp.org/reference%24Eigen_demo%24en-us.html" rel="noreferrer">http://www.ultimatepp.org/reference$Eigen_demo$en-us.html</a><br/>
  <a href="http://www.alglib.net/optimization/levenbergmarquardt.php" rel="noreferrer">http://www.alglib.net/optimization/levenbergmarquardt.php</a></p></li>
  <li><p>How do I set the optimization parameters using the set functions?</p></li>
  </ol>