27#ifndef fitGammaDistribution_hpp
28#define fitGammaDistribution_hpp
40template <
typename realT>
64template <
typename fitterT>
69 typedef typename fitterT::realT realT;
71 static const int nparams = fitterT::nparams;
81 fitGammaDistribution()
86 ~fitGammaDistribution()
97 static_assert( nparams == 4,
"fitGammaDistribution: Wrong setGuess called for no location parameter." );
111 static_assert( nparams == 3,
"fitGammaDistribution: Wrong setGuess called for no location parameter." );
123 static_assert( nparams == 2,
"fitGammaDistribution: Wrong setGuess called for location parameter." );
129 void setArray( realT *data,
int n )
152 void theta( realT na )
158 void denom( realT nd )
210template <
typename realT>
228template <
typename _realT>
231 typedef _realT realT;
233 static const int nparams = 4;
235 static void func( realT *p, realT *hx,
int m,
int n,
void *adata )
239 for(
int i = 0; i < arr->
n; i++ )
252template <
typename _realT>
255 typedef _realT realT;
257 static const int nparams = 3;
259 static void func( realT *p, realT *hx,
int m,
int n,
void *adata )
265 for(
int i = 0; i < arr->
n; i++ )
278template <
typename _realT>
281 typedef _realT realT;
283 static const int nparams = 2;
285 static void func( realT *p, realT *hx,
int m,
int n,
void *adata )
291 for(
int i = 0; i < arr->
n; i++ )
void setGuess(realT x0, realT k, realT theta, realT denom)
Set the initial guess.
void setGuess(realT x0, realT k, realT theta)
Set the initial guess.
void setGuess(realT k, realT theta)
Set the initial guess when no location parameter is used.
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.
levmarInterface()
Default constructor.
void * adata
Pointer to possibly additional data, passed uninterpreted to func & jacf.
realT gammaDistributionDenom(realT k, realT q)
The denominator of the Gamma Distribution.
realT gammaDistribution(realT x, realT x0, realT k, realT q, realT denom)
The general shifted Gamma Distribution at a point using an arbitrary peak scaling parameter.
A c++ interface to the templatized levmar minimization routines..
Wrapper for a native array to pass to levmarInterface, with GammaDistribution details.
realT k
the shape parameter
realT * data
Pointer to the array.
realT denom
the denominator or 1/peak-scale
realT theta
the scale parameter
size_t n
dimension of the array
realT x0
the location parameter.
levmarInterface fitter structure for the Gamma Distribution
levmarInterface fitter structure for the shifted Gamma Distribution
levmarInterface fitter structure for the shifted Gamma Distribution with arbitrary peak scaling