Standard fitting function based on one-dimensional data with a numerical Jacobian. More...
#include <fit_base.h>
This class specifies the deviations (in operator()
) and Jacobian (in jac()) for a fitting class like fit_nonlin. It assumes a one-dimensional data set with no uncertainty in the abcissae and a fitting function specified in a form similar to fit_funct.
The default method for numerically computing the Jacobian is from jacobian_gsl. This default is identical to the GSL approach, except that the default value of jacobian_gsl::epsmin is non-zero. See jacobian_gsl for more details.
Default template arguments
vec_t
- boost::numeric::ublas::vector < double >mat_t
- boost::numeric::ublas::matrix < double >func_t
- fit_funct
Allow a user-specified Jacobian or make that into a separate class?
Default constructor?
Definition at line 201 of file fit_base.h.
Public Member Functions | |
chi_fit_funct (size_t ndat, const vec_t &xdat, const vec_t &ydat, const vec_t &yerr, fit_func_t &fun) | |
Create an object with specified data and specified fitting function. | |
void | set_data (size_t ndat, const vec_t &xdat, const vec_t &ydat, const vec_t &yerr) |
Set the data to be fit. | |
void | set_func (fit_func_t &fun) |
Set the fitting function. | |
virtual double | chi2 (size_t np, const vec_t &p) |
Return ![]() | |
virtual void | operator() (size_t np, const vec_t &p, size_t nd, vec_t &f) |
Using parameters in p , compute the relative deviations in f . | |
virtual void | jac (size_t np, vec_t &p, size_t nd, vec_t &f, mat_t &J) |
Using parameters in p , compute the Jacobian in J . | |
virtual size_t | get_ndata () |
Return the number of data points. | |
![]() | |
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 . | |
Public Attributes | |
jacobian_gsl< std::function< int(size_t, const vec_t &, vec_t &)>, vec_t, mat_t > | auto_jac |
Automatic Jacobian object. | |
Protected Member Functions | |
int | jac_mm_funct (size_t np, const vec_t &p, vec_t &f) |
Reformulate operator() into a mm_funct object. | |
Protected Attributes | |
std::function< int(size_t, const vec_t &, vec_t &)> | mfm |
Function object for Jacobian object. | |
Data and uncertainties | |
size_t | ndat_ |
const vec_t * | xdat_ |
const vec_t * | ydat_ |
const vec_t * | yerr_ |
fit_func_t * | fun_ |
Fitting function. | |
chi_fit_funct (const chi_fit_funct &) | |
chi_fit_funct & | operator= (const chi_fit_funct &) |
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).