Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

mdp_fitting_functions.h File Reference

Go to the source code of this file.


typedef float(* BLM_function )(float, float *, long, void *)


void linear_fit (float *x, Measure *y, long i0, long in, Measure *a)
 Fits y[i], x[i] for i0<=i<in with y=a[0]*x+a[1].
float golden_rule (float(*fp)(float *, long, void *), float &xmin, float ax, float bx, float cx, float tol=0.001, long niter=100, void *dummy=0)
float BLMaux (float *x, Measure *y, long i_min, long i_max, float *a, float *a0, mdp_matrix &sigma, int ma, mdp_matrix &alpha, mdp_matrix &beta, BLM_function func, float h, void *junk)
float BaesyanLevenbergMarquardt (float *x, Measure *y, long i_min, long i_max, float *a, int ma, mdp_matrix &covar, BLM_function func, float h=0.001, long nmax=1000, void *junk=0)

Detailed Description

Massimo Di Pierro <>
Contains mdp_field::update()

This file is copyrighted by MetaCryption LLC Read attached license in file mdp_license.pdf This file cannot be distributed without file mdp_license.pdf

Function Documentation

float BaesyanLevenbergMarquardt float *  x,
Measure *  y,
long  i_min,
long  i_max,
float *  a,
int  ma,
mdp_matrix covar,
BLM_function  func,
float  h = 0.001,
long  nmax = 1000,
void *  junk = 0

This implements the BaesyanLevenbergMarquardt It uses mdp_matrix. Arguments are:

x[i] : an array of float y[i] : an array of Measures i_min, i_max : range to be used in the fit points within the range that have y[i].num=0 are ignored a[i], ma : vector of paramters for the fit and number of parameters they are all used in the fit the initial values are used as preons covar(i,j) : covariance matrix for the preons func(x,a,ma,junk) : the function to be used in the fit h : a float used to evaluate derivatives nmax : max number of iterations junk : junk to be passed to func

Return the Baesyan ChiSquare. To obtain the correct chi_square rerun it with same ftting values and nmax=1;

float BLMaux float *  x,
Measure *  y,
long  i_min,
long  i_max,
float *  a,
float *  a0,
mdp_matrix sigma,
int  ma,
mdp_matrix alpha,
mdp_matrix beta,
BLM_function  func,
float  h,
void *  junk

This function is used by the BayesianLevenbergMarquardt It computes the chi_square (including the Baesyan term) and fills alpha and beta

alpha(j,k)= (Dy(x[i],a)/Da[j])*(Dy(x[i],a)/Da[k])/dy[i]^2 beta(j)=sum_i (y[i]-y(x[i],a))*(dy(x[i],a)/da[j])/dy[i]^2

chi_square= (y[i]-y(x[i],a))*(y[i]-y(x[i],a))/dy[i]^2 +{j,k} (a[j]-a0[j])*(a[k]-a0[k])*sigma(j,k)

This function take into account multipliticty factors y[i].num, i.e. the numbers of measures used to determine y[i].mean This is used as a weight factor!

float golden_rule float(*)(float *, long, void *)  fp,
float &  xmin,
float  ax,
float  bx,
float  cx,
float  tol = 0.001,
long  niter = 100,
void *  dummy = 0

finds x=xmin that minimizes (*fp)(&x,1,dummy) must be: (*fp)(&ax) > (*fp)(&bx) && (*fp)(&cx) > (*fp)(&bx)

Generated on Sun Feb 27 15:12:23 2005 by  doxygen 1.4.1