28     out_f[0] = 1 - cos(x[0] + 1) * cos(x[0] * x[1] + 1);
    45     increments_x.
fill(0.0001);
    51     for (
size_t k = 0; k < N; k++)
    56 #ifdef LEVMARQ_EXAMPLE_VERBOSE    57     const auto T = tictac.
Tac() / N;
    61     cout << endl << 
"Final optimized position: " << optimal_x << endl;
    63     cout << 
"Time: " << T * 1e6 << 
" us" << endl;
    66     cout << 
"Path saved to 'lm-path.txt'" << endl;
 An implementation of the Levenberg-Marquardt algorithm for least-square minimization. 
 
double Tac() noexcept
Stops the stopwatch. 
 
void execute(VECTORTYPE &out_optimal_x, const VECTORTYPE &x0, TFunctorEval functor, const VECTORTYPE &increments, const USERPARAM &userParam, TResultInfo &out_info, mrpt::system::VerbosityLevel verbosity=mrpt::system::LVL_INFO, const size_t maxIter=200, const NUMTYPE tau=1e-3, const NUMTYPE e1=1e-8, const NUMTYPE e2=1e-8, bool returnPath=true, TFunctorIncrement x_increment_adder=nullptr)
Executes the LM-method, with derivatives estimated from functor is a user-provided function which tak...
 
void fill(const Scalar &val)
 
A high-performance stopwatch, with typical resolution of nanoseconds. 
 
void saveToTextFile(const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat=mrpt::math::MATRIX_FORMAT_ENG, bool appendMRPTHeader=false, const std::string &userHeader=std::string()) const
Saves the vector/matrix to a file compatible with MATLAB/Octave text format. 
 
This base provides a set of functions for maths stuff. 
 
matrix_t path
Each row is the optimized value at each iteration. 
 
size_t iterations_executed
 
void myFunction(const CVectorDouble &x, const CVectorDouble &y, CVectorDouble &out_f)
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
double levmarq_final_error
 
void resize(std::size_t N, bool zeroNewElements=false)
 
void Tic() noexcept
Starts the stopwatch.