27 #ifndef fitWeibull_hpp
28 #define fitWeibull_hpp
31 #include "../func/weibull.hpp"
40 template<
typename realT>
41 struct array2FitWeibull;
65 template<
typename fitterT>
71 typedef typename fitterT::realT realT;
73 static const int nparams = fitterT::nparams;
98 static_assert( nparams==3 ,
"fitWeibull: Wrong setGuess called for no location parameter.");
110 static_assert( nparams==2 ,
"fitWeibull: Wrong setGuess called for location parameter.");
116 void setArray(realT *data,
int n)
140 void lambda( realT nl )
181 template<
typename realT>
198 template<
typename _realT>
201 typedef _realT realT;
203 static const int nparams = 3;
205 static void func(realT *p, realT *hx,
int m,
int n,
void *adata)
209 for(
int i=0;i<arr->
n; i++)
211 hx[i] = func::weibull<realT>(i, p[2], p[0], p[1]) - arr->
data[i];
222 template<
typename _realT>
225 typedef _realT realT;
227 static const int nparams = 2;
229 static void func(realT *p, realT *hx,
int m,
int n,
void *adata)
233 for(
int i=0;i<arr->
n; i++)
235 hx[i] = func::weibull<realT>(i, 0.0, p[0], p[1]) - arr->
data[i];
Class to manage fitting the Weibull Distribution to data via the levmarInterface.
void setGuess(realT k, realT lambda)
Set the initial guess when platescale and central obscuration are fixed.
void setGuess(realT x0, realT k, realT lambda)
Set the initial guess when platescale and central obscuration are fixed.
A templatized interface to the levmar package.
int fit()
Perform the fit.
void allocate_params()
Allocate parameters array based on previous call to nParams.
realT * p
Parameter array. On input is the initial estimates. On output has the estimated solution.
int n
I: measurement vector dimension.
void * adata
Pointer to possibly additional data, passed uninterpreted to func & jacf.
A c++ interface to the templatized levmar minimization routines..
Wrapper for a native array to pass to levmarInterface, with Weibull details.
realT x0
the location parameter.
size_t n
dimension of the array
realT k
the shape parameter
realT lambda
the scale parameter
realT * data
Pointer to the array.
levmarInterface fitter structure for the shifted Weibull Distribution
levmarInterface fitter structure for the shifted Weibull Distribution