Multidimensional fitting class fixing some parameters and varying others.
More...
#include <fit_fix.h>
template<class bool_vec_t, class func_t = gen_fit_funct<>, class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
class o2scl::fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >
The number of trials used in the fit can be specified in the data member of the parent class fit_base::ntrial associated with the fit_fix_pars object. Similarly for the verbosity parameter in fit_base::verbose, the absolute tolerance in fit_base::tol_abs, and the relative tolerance in fit_base::tol_abs. These values are copied to the minimizer used by fit_fix_pars::mmin()
during each call. After the minimizer is called, the value of fit_base::ntrial associated with the fit_fix_pars object is filled with the last number of trials required for the last minimization.
Default template arguments
Definition at line 67 of file fit_fix.h.
|
typedef fit_base< fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >, vec_t, mat_t > | base_fit_t |
| The generic fitter type.
|
|
typedef fit_nonlin< fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >, vec_t, mat_t > | def_fit_t |
| The default fitter type.
|
|
|
| fit_fix_pars () |
| Specify the member function pointer.
|
|
virtual int | fit (size_t np, vec_t &par, mat_t &covar, double &chi2, func_t &fitfun) |
| Fit the data specified in (xdat,ydat) to the function fitfun with the parameters in par . More...
|
|
virtual int | fit_fix (size_t np, vec_t &par, mat_t &covar, double &chi2, func_t &fitfun, bool_vec_t &fix) |
| Fit function func while fixing some parameters as specified in fix . More...
|
|
int | set_fit (base_fit_t &fitter) |
| Change the base fitter.
|
|
virtual int | print_iter (size_t nv, boost::numeric::ublas::vector< double > &x, double y, int iter, double value=0.0, double limit=0.0) |
| Print out iteration information. More...
|
|
virtual int | fit (size_t npar, boost::numeric::ublas::vector< double > &parms, boost::numeric::ublas::matrix< double > &covar, double &chi2, gen_fit_funct<> &fitfun)=0 |
| Fit function fitfun using parameters in parms as initial guesses. More...
|
|
virtual const char * | type () |
| Return string denoting type ("fit_base")
|
|
virtual void | operator() (size_t np, const boost::numeric::ublas::vector< double > &p, size_t nd, boost::numeric::ublas::vector< double > &f)=0 |
| Using parameters in p , compute the relative deviations in f .
|
|
virtual void | jac (size_t np, boost::numeric::ublas::vector< double > &p, size_t nd, boost::numeric::ublas::vector< double > &f, boost::numeric::ublas::matrix< double > &J)=0 |
| Using parameters in p , compute the Jacobian in J .
|
|
|
bool | expand_covar |
| If true, expand the covariance matrix to the larger space by filling with the identity matrix (default false) More...
|
|
def_fit_t | def_fit |
| The default base fitter.
|
|
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.
|
|
|
vec_t | u_par |
| Temporary vector to store full parameter list of size u_np.
|
|
vec_t | u_par_new |
| Vector for smaller parameter list of size u_np_new.
|
|
mat_t | J |
| Jacobian in the user space of size (nd,u_np)
|
|
base_fit_t * | fitp |
| The fitter.
|
|
func_t * | funcp |
| The user-specified function.
|
|
size_t | u_np |
| The user-specified number of variables.
|
|
size_t | u_np_new |
| The new number of variables.
|
|
bool_vec_t * | fix_par |
| Specify which parameters to fix (vector of size u_np)
|
|
vec_t * | x_par |
| The user-specified initial vector of size u_np.
|
|
virtual size_t | get_ndata () |
| The function to return the number of data points.
|
|
virtual void | operator() (size_t np_new, const vec_t &par_new, size_t nd, vec_t &f) |
| The function computing deviations. More...
|
|
virtual void | jac (size_t np_new, vec_t &par_new, size_t nd, vec_t &f, mat_t &J_new) |
| The function computing the Jacobian.
|
|
| fit_fix_pars (const fit_fix_pars &) |
|
fit_fix_pars & | operator= (const fit_fix_pars &) |
|
◆ fit()
template<class bool_vec_t , class func_t = gen_fit_funct<>, class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
virtual int o2scl::fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >::fit |
( |
size_t |
np, |
|
|
vec_t & |
par, |
|
|
mat_t & |
covar, |
|
|
double & |
chi2, |
|
|
func_t & |
fitfun |
|
) |
| |
|
inlinevirtual |
The covariance matrix for the parameters is returned in covar
and the value of
is returned in chi2
.
Definition at line 112 of file fit_fix.h.
◆ fit_fix()
template<class bool_vec_t , class func_t = gen_fit_funct<>, class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
virtual int o2scl::fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >::fit_fix |
( |
size_t |
np, |
|
|
vec_t & |
par, |
|
|
mat_t & |
covar, |
|
|
double & |
chi2, |
|
|
func_t & |
fitfun, |
|
|
bool_vec_t & |
fix |
|
) |
| |
|
inlinevirtual |
- Note
- When some parameters are fixed, each fixed parameter leads to a row and column in the covariance matrix which is unused by this function. If there are
npar2<npar
unfixed parameters, then only the first npar2
rows and columns of covar
are filled.
Definition at line 145 of file fit_fix.h.
◆ operator()()
template<class bool_vec_t , class func_t = gen_fit_funct<>, class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
virtual void o2scl::fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >::operator() |
( |
size_t |
np_new, |
|
|
const vec_t & |
par_new, |
|
|
size_t |
nd, |
|
|
vec_t & |
f |
|
) |
| |
|
inlinevirtual |
This function operates in the smaller space of size np_new.
Definition at line 242 of file fit_fix.h.
◆ expand_covar
template<class bool_vec_t , class func_t = gen_fit_funct<>, class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
If this varable is false (the default), then the covariance matrix is computed in the smaller space which enumerates only the parameters which are not fixed. If this variable is true, then the covariance matrix must be a full np
by np
matrix (where np
is the argument to fit() or fit_fix() ) and rows and columns which correspond with parameters which are fixed are replaced by elements from the identity matrix.
The optimal parameters and
reported by the fit are unchanged.
Definition at line 104 of file fit_fix.h.
The documentation for this class was generated from the following file: