Object-oriented Scientific Computing Library: Version 0.910
Data Structures | Public Member Functions | Data Fields | Protected Member Functions | Static Protected Member Functions | Protected Attributes
min_fit< func_t, vec_t, mat_t > Class Template Reference

Non-linear least-squares fitting class with generic minimizer. More...

#include <min_fit.h>

Inheritance diagram for min_fit< func_t, vec_t, mat_t >:
fit_base< func_t, vec_t, mat_t >

Detailed Description

template<class func_t = fit_funct<>, class vec_t = ovector_base, class mat_t = omatrix_base>
class min_fit< func_t, vec_t, mat_t >

This minimizes a generic fitting function using any multi_min object, and then uses the GSL routines to calculate the uncertainties in the parameters and the covariance matrix.

This can be useful for fitting problems which might be better handled by more complex minimizers than those that are used in gsl_fit. For problems with many local minima near the global minimum, using a sim_anneal object with this class can sometimes produce better results than gsl_fit.

Default template arguments

Definition at line 57 of file min_fit.h.

Data Structures

struct  func_par
 A structure for passing information to the GSL functions for the min_fit class. More...

Public Member Functions

virtual int fit (size_t ndat, vec_t &xdat, vec_t &ydat, vec_t &yerr, size_t npar, 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.
int set_multi_min (multi_min< multi_funct< vec_t > > &mm)
 Set the multi_min object to use (default is gsl_mmin_nmsimplex)
virtual const char * type ()
 Return string denoting type ("min_fit")

Data Fields

gsl_mmin_simp< multi_funct
< vec_t > > 
def_multi_min
 The default minimizer.

Protected Member Functions

double min_func (size_t np, const vec_t &xp, func_par *&fp)
 The function to minimize.

Static Protected Member Functions

static int func (const gsl_vector *x, void *pa, gsl_vector *f)
 Evaluate the function.
static int dfunc (const gsl_vector *x, void *pa, gsl_matrix *jac)
 Evaluate the jacobian.
static int fdfunc (const gsl_vector *x, void *pa, gsl_vector *f, gsl_matrix *jac)
 Evaluate the function and the jacobian.

Protected Attributes

multi_min< multi_funct< vec_t > > * mmp
 The minimizer.
bool min_set
 True if the minimizer has been set by the user.

Member Function Documentation

template<class func_t = fit_funct<>, class vec_t = ovector_base, class mat_t = omatrix_base>
virtual int min_fit< func_t, vec_t, mat_t >::fit ( size_t  ndat,
vec_t &  xdat,
vec_t &  ydat,
vec_t &  yerr,
size_t  npar,
vec_t &  par,
mat_t &  covar,
double &  chi2,
func_t &  fitfun 
) [inline, virtual]

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

Implements fit_base< func_t, vec_t, mat_t >.

Definition at line 96 of file min_fit.h.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.