Linear least-squares fit of data to a function
Use this version for large data sets and when the number of parameters is NOT known at compile time.
Function objects have to conform to a simple interface: (it is a template object in this example, but does not need to be).
template<typename T, typename Tpar, int N> class Poly1D { public: typedef Tpar param_vector_type; typedef T value_type;
// get number of paramters int npar ();
// evaluate at location x
for parameter vector p
T operator()( const T x, const TPar& p ) const;
// return the n-th basis function evaluated at values in array x
MArray<T,1> get_nth_basis( const int n, const MArray<T,1>& x )
// optional static void prettyPrint(ostream& os, const TPar& p); };
typedef Function::Tpar UnivariateLinearLsqFitLarge< T, Function >::param_vec_type |
UnivariateLinearLsqFitLarge< T, Function >::UnivariateLinearLsqFitLarge | ( | const Function & | F, | |
bool | quiet = true | |||
) | [inline] |
virtual UnivariateLinearLsqFitLarge< T, Function >::~UnivariateLinearLsqFitLarge | ( | ) | [inline, virtual] |
UnivariateLinearLsqFitLarge< T, Function >::param_vec_type UnivariateLinearLsqFitLarge< T, Function >::fit | ( | const MArray< T, 1 > & | x, | |
const MArray< T, 1 > & | y, | |||
const MArray< T, 1 > & | y_errors, | |||
param_vec_type & | errors | |||
) | const [inline] |
References b, UnivariateLinearLsqFitLarge< T, Function >::F_, and UnivariateLinearLsqFitLarge< T, Function >::quiet_.
Referenced by ProfExtractor::extract_profile_fit().
const Function& UnivariateLinearLsqFitLarge< T, Function >::F_ [protected] |
Referenced by UnivariateLinearLsqFitLarge< T, Function >::fit().
bool UnivariateLinearLsqFitLarge< T, Function >::quiet_ [protected] |
Referenced by UnivariateLinearLsqFitLarge< T, Function >::fit().