/Users/mdipierro/fermiqcd/development/Libraries/mdp_fitting_functions.h File Reference

Go to the source code of this file.


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


void linear_fit (float *x, Measure *y, mdp_int i0, mdp_int 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 *, mdp_int, void *), float &xmin, float ax, float bx, float cx, float tol=0.001, mdp_int niter=100, void *dummy=0)
float BLMaux (float *x, Measure *y, mdp_int i_min, mdp_int 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, mdp_int i_min, mdp_int i_max, float *a, int ma, mdp_matrix &covar, BLM_function func, float h=0.001, mdp_int nmax=1000, void *junk=0)

Detailed Description

Massimo Di Pierro <mdipierro@cs.depaul.edu>

Contains mdp_field::update()

Licensed under GPL2 license Read attached license in file mdp_license.pdf This file cannot be distributed without file mdp_license.pdf

Typedef Documentation

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

Function Documentation

float BaesyanLevenbergMarquardt ( float *  x,
Measure *  y,
mdp_int  i_min,
mdp_int  i_max,
float *  a,
int  ma,
mdp_matrix covar,
BLM_function  func,
float  h = 0.001,
mdp_int  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,
mdp_int  i_min,
mdp_int  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 *, mdp_int, void *)  fp,
float &  xmin,
float  ax,
float  bx,
float  cx,
float  tol = 0.001,
mdp_int  niter = 100,
void *  dummy = 0 

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

void linear_fit ( float *  x,
Measure *  y,
mdp_int  i0,
mdp_int  in,
Measure *  a 

Fits y[i], x[i] for i0<=i<in with y=a[0]*x+a[1].

 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Defines

Generated on Wed Dec 23 14:03:14 2009 for fermiqcd by  doxygen 1.6.1