Class fit_base (o2scl)

O2scl : Class List

template<class func_t = fit_funct, class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
class fit_base

Non-linear least-squares fitting [abstract base].

Subclassed by o2scl::fit_fix_pars< bool_vec_t, gen_fit_funct<>, boost::numeric::ublas::vector< double >, boost::numeric::ublas::matrix< double > >, o2scl::fit_nonlin< fit_fix_pars< bool_vec_t, gen_fit_funct<>, boost::numeric::ublas::vector< double >, boost::numeric::ublas::matrix< double > >, boost::numeric::ublas::vector< double >, boost::numeric::ublas::matrix< double > >, o2scl::fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >, o2scl::fit_min< func_t, vec_t, mat_t >, o2scl::fit_nonlin< func_t, vec_t, mat_t >

Public Functions

inline fit_base()
inline virtual ~fit_base()
inline virtual int print_iter(size_t nv, vec_t &x, double y, int iter, double value = 0.0, double limit = 0.0)

Print out iteration information.

Depending on the value of the variable verbose, this prints out the iteration information. If verbose=0, then no information is printed, while if verbose>1, then after each iteration, the present values of x and y are output to std::cout along with the iteration number. If verbose>=2 then each iteration waits for a character.

virtual int fit(size_t npar, vec_t &parms, mat_t &covar, double &chi2, func_t &fitfun) = 0

Fit function fitfun using parameters in parms as initial guesses.

The covariance matrix for the parameters is returned in covar and the value of \( \chi^2 \) is returned in chi2.

inline virtual const char *type()

Return string denoting type (“fit_base”)

Public Members

size_t ntrial

Maximum number of iterations (default 500)

double tol_abs

Absolute tolerance (default 1.0e-4)

double tol_rel

(default 1.0e-4)

int verbose

An integer describing the verbosity of the output.

size_t n_dat

The number of data points.

size_t n_par

The number of parameters.