Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | List of all members
o2scl::fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t > Class Template Reference

Multidimensional fitting class fixing some parameters and varying others. More...

#include <fit_fix.h>

Inheritance diagram for o2scl::fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >:
o2scl::fit_base< func_t, vec_t, mat_t > o2scl::gen_fit_funct< vec_t, mat_t >

Public Types

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.
 

Public Member Functions

 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.
 
Reimplementation of \ref gen_fit_funct
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.
 
- Public Member Functions inherited from o2scl::fit_base< func_t, vec_t, mat_t >
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. More...
 
virtual const char * type ()
 Return string denoting type ("fit_base")
 

Public Attributes

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.
 
- Public Attributes inherited from o2scl::fit_base< func_t, vec_t, mat_t >
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.
 

Protected Attributes

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_tfitp
 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.
 

Private Member Functions

 fit_fix_pars (const fit_fix_pars &)
 
fit_fix_parsoperator= (const fit_fix_pars &)
 

Detailed Description

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.

Member Function Documentation

◆ 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 $ \chi^2 $ is returned in chi2.

Implements o2scl::fit_base< func_t, vec_t, mat_t >.

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.

Implements o2scl::gen_fit_funct< vec_t, mat_t >.

Definition at line 242 of file fit_fix.h.

Member Data Documentation

◆ 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>>
bool o2scl::fit_fix_pars< bool_vec_t, func_t, vec_t, mat_t >::expand_covar

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 $ \chi^2 $ 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:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).