|
template<class T > |
static void | SWAP (T &a, T &b) |
| exchange (swap) two values. More...
|
|
template<class T > |
static const T | SQR (const T a) |
| compute the square of a value More...
|
|
static void | linearFit (boost::numeric::ublas::vector< double > &_x, boost::numeric::ublas::vector< double > &_y, boost::numeric::ublas::vector< double > &_sig, boost::numeric::ublas::vector< double > &_a, boost::numeric::ublas::vector< bool > &_ia, boost::numeric::ublas::matrix< double > &_covar, double &_chisq, void _funcs(const double, boost::numeric::ublas::vector< double > &)) |
| linear least-square solver using normal equations More...
|
|
static void | gaussj (boost::numeric::ublas::matrix< double > &a, boost::numeric::ublas::matrix< double > &b) |
| Gauss-Jordan elimination. More...
|
|
static void | covsrt (boost::numeric::ublas::matrix< double > &_covar, boost::numeric::ublas::vector< bool > &_ia, const int _mfit) |
| Sorts covariance matrix. More...
|
|
template<typename T > |
static std::vector< std::vector< int > > | subSets (T N, T m) |
| construct subsets of size m out of n elements More...
|
|
static Nice::SeqPoint | generateSpiral (const Nice::Circle &c, int type, double latConst) |
| construct a chain of points on a c.c.w. spiral. More...
|
|
template<class T > |
static void | SWAP (T &a, T &b) |
| exchange (swap) two values. More...
|
|
template<class T > |
static const T | SQR (const T a) |
| compute the square of a value More...
|
|
static void | linearFit (boost::numeric::ublas::vector< double > &_x, boost::numeric::ublas::vector< double > &_y, boost::numeric::ublas::vector< double > &_sig, boost::numeric::ublas::vector< double > &_a, boost::numeric::ublas::vector< bool > &_ia, boost::numeric::ublas::matrix< double > &_covar, double &_chisq, void _funcs(const double, boost::numeric::ublas::vector< double > &)) |
|
static void | gaussj (boost::numeric::ublas::matrix< double > &a, boost::numeric::ublas::matrix< double > &b) |
|
static void | covsrt (boost::numeric::ublas::matrix< double > &_covar, boost::numeric::ublas::vector< bool > &_ia, const int _mfit) |
|
template<typename T > |
static std::vector< std::vector< int > > | subSets (T N, T m) |
|
static Nice::SeqPoint | generateSpiral (const Nice::Circle &c, int type, double latConst) |
|
void Nice::Alg::linearFit |
( |
boost::numeric::ublas::vector< double > & |
_x, |
|
|
boost::numeric::ublas::vector< double > & |
_y, |
|
|
boost::numeric::ublas::vector< double > & |
_sig, |
|
|
boost::numeric::ublas::vector< double > & |
_a, |
|
|
boost::numeric::ublas::vector< bool > & |
_ia, |
|
|
boost::numeric::ublas::matrix< double > & |
_covar, |
|
|
double & |
_chisq, |
|
|
void |
_funcsconst double, boost::numeric::ublas::vector< double > & |
|
) |
| |
|
static |
linear least-square solver using normal equations
Given a set of data points _x[0..ndat-1], _y[0..ndat-1] with inidividual standard deviations sig[0..ndat-1], use chi-squared minimization to fit for some or all of the coefficeints a[0..ma-1] of a function that depends linearly on a, y=sum_i a_i*afunc_i(x). The boolean input array ia[0..ma-1] indicates by true entries those components of a that should be fitted for, and by false entries those components that should be held fixed at their input values. The program returns values for a[0..ma-1], chi-square=chisq, and the covariance matrix covar[0..ma-1][0..ma-1]. (Parameters held fixed will return zero covariances.) The user supplies a routine funcs(x,afunc) that returns the ma basis functions evaluated at x=x in the array afunc[0..ma-1]). (Excerpt of numerical recipies section 15.4)
- Parameters
-
[in] | _x | data points (x) |
[in] | _y | data points (y) |
[in] | _sig | standard deviations of the data points |
[out] | _a | coefficients |
[in] | _ia | flags for each coefficient. if false, coefficient will be kept constant |
[out] | _covar | covariance matrix will be returned |
[out] | _chisq | chi^2 as return value |
[in] | _funcs | the function that is linear to the coefficients a |
template<typename T >
std::vector< std::vector< int > > Nice::Alg::subSets |
( |
T |
N, |
|
|
T |
m |
|
) |
| |
|
static |
construct subsets of size m out of n elements
This is the standard combinatorial sub-set construction. For N=5 , m=3 we construct <0,1,2>, <0,1,3>, <0,1,4>, <0,2,3>, <0,2,4>...., <2,3,4>.
- Parameters
-
N | The number of elements to choose from. |
m | The number of elements selected in each element of the result. |
- Returns
- ordered lists of numbers in the range 0..n-1 where each list has m elements. The cardinality of the outer vector is biomial(N,m).
- Since
- 2017-03-30
- Author
- R. J. Mathar