9 #undef VNL_USE_OLD_BRENT_MINIMIZER // #define VNL_USE_OLD_BRENT_MINIMIZER 11 #ifdef VNL_USE_OLD_BRENT_MINIMIZER 20 # include <vcl_msvc_warnings.h> 54 for (
unsigned int i = 0; i <
n_; ++i)
55 out[i] =
x0_[i] + lambda *
dx_[i];
81 for (
int j = 0; j < n; ++j)
87 #ifdef VNL_USE_OLD_BRENT_MINIMIZER 111 if (std::fabs(fptt-fret) > del) {
112 del = std::fabs(fptt-fret);
117 if (2.0*std::fabs(fp-fret) <=
ftol*(std::fabs(fp)+std::fabs(fret)))
128 for (
int j=0;j<n;++j)
130 ptt[j]=2.0*p[j]-pt[j];
143 #ifdef VNL_USE_OLD_BRENT_MINIMIZER 165 for (
int j=0;j<n;j++) {
166 xi[j][ibig]=xi[j][n-1];
double f(const vnl_vector< double > &x) override
Apply the function.
An object that represents a function from R^n -> R.
Print matrices and vectors in nice MATLAB format.
double minimize_given_bounds(double ax, double bx, double cx, double tol, double *xmin)
Find the minimum value of f(x) within a<= x <= c.
Brent 1D minimizer (deprecated).
ReturnCodes minimize(vnl_vector< double > &x)
Run minimization, place result in x.
size_t size() const
Return the length, number of elements, dimension of this vector.
double minimize_given_bounds(double ax, double bx, double cx)
Find the minimum value of f(x) within a<= x <= c.
Namespace with standard math functions.
double f(vnl_vector< double > const &x) override
The main function. Given the parameter vector x, compute the value of f(x).
vnl_cost_function * functor_
void vnl_bracket_minimum(vnl_cost_function &fn, double &a, double &b, double &c, double &fa, double &fb, double &fc)
Given initial values a and b, find bracket a<b<c s.t. f(a)>f(b)<f(c).
double ftol
Termination tolerance on F (sum of squared residuals)
vnl_powell_1dfun(int n, vnl_cost_function *func, vnl_powell *p)
void uninit(double lambda, vnl_vector< double > &out)
The ever-popular Powell minimizer.
void init(vnl_vector< double > const &x0, vnl_vector< double > const &dx)
void report_eval(double f)
Called by derived classes after each function evaluation.
double linmin_xtol_
Tolerance on line search parameter step.
virtual bool report_iter()
Called by derived classes after each iteration.
VNL_EXPORT std::ostream & vnl_matlab_print(std::ostream &, T const *array, unsigned length, vnl_matlab_print_format=vnl_matlab_print_format_default)
print a 1D array.
double initial_step_
Initial step when bracketing minima along a line.
void pub_report_eval(double e)
Function to bracket a minimum.
void bracket_minimum(double *ax, double *bx, double *cx, double *fa, double *fb, double *fc)
Given distinct points ax, and bx, find a bracket for the minimum.
ReturnCodes
Some generic return codes that apply to all minimizers.
long maxfev
Termination maximum number of iterations.
vnl_vector< double > tmpx_
double f_at_last_minimum() const
Function evaluation at value returned by minimize(x).
vnl_bignum sqr(vnl_bignum const &x)
void set_x_tolerance(double v)
Set the convergence tolerance on X.