Gromacs
2024.4
|
Declares simple statistics toolbox.
Typedefs | |
typedef struct gmx_stats * | gmx_stats_t |
Abstract container type. | |
Enumerations | |
enum | { elsqWEIGHT_NONE, elsqWEIGHT_X, elsqWEIGHT_Y, elsqWEIGHT_XY, elsqWEIGHT_NR } |
Enum for statistical weights. | |
Functions | |
gmx_stats_t | gmx_stats_init () |
Initiate a data structure. More... | |
void | gmx_stats_free (gmx_stats_t stats) |
Destroy a data structure. More... | |
void | gmx_stats_add_point (gmx_stats_t stats, double x, double y, double dx, double dy) |
Add a point to the data set. More... | |
void | gmx_stats_get_ab (gmx_stats_t stats, int weight, real *a, real *b, real *da, real *db, real *chi2, real *Rfit) |
Fit the data to y = ax + b, possibly weighted, if uncertainties have been input. da and db may be NULL. More... | |
real | gmx_stats_get_average (gmx_stats_t stats) |
Computes and returns the average value. More... | |
std::tuple< real, real, real > | gmx_stats_get_ase (gmx_stats_t stats) |
Pointers may be null, in which case no assignment will be done. More... | |
void | lsq_y_ax_b (int n, real x[], real y[], real *a, real *b, real *r, real *chi2) |
Fit a straight line y=ax+b thru the n data points x, y. More... | |
void | lsq_y_ax_b_xdouble (int n, double x[], real y[], real *a, real *b, real *r, real *chi2) |
Fit a straight line y=ax+b thru the n data points x, y. More... | |
void | lsq_y_ax_b_error (int n, real x[], real y[], real dy[], real *a, real *b, real *da, real *db, real *r, real *chi2) |
Fit a straight line y=ax+b thru the n data points x, y. More... | |
void gmx_stats_add_point | ( | gmx_stats_t | stats, |
double | x, | ||
double | y, | ||
double | dx, | ||
double | dy | ||
) |
Add a point to the data set.
[in] | stats | The data structure |
[in] | x | The x value |
[in] | y | The y value |
[in] | dx | The error in the x value |
[in] | dy | The error in the y value |
void gmx_stats_free | ( | gmx_stats_t | stats | ) |
Destroy a data structure.
stats | The data structure |
void gmx_stats_get_ab | ( | gmx_stats_t | stats, |
int | weight, | ||
real * | a, | ||
real * | b, | ||
real * | da, | ||
real * | db, | ||
real * | chi2, | ||
real * | Rfit | ||
) |
Fit the data to y = ax + b, possibly weighted, if uncertainties have been input. da and db may be NULL.
[in] | stats | The data structure |
[in] | weight | type of weighting |
[out] | a | slope |
[out] | b | intercept |
[out] | da | sigma in a |
[out] | db | sigma in b |
[out] | chi2 | normalized quality of fit |
[out] | Rfit | correlation coefficient |
std::tuple<real, real, real> gmx_stats_get_ase | ( | gmx_stats_t | stats | ) |
Pointers may be null, in which case no assignment will be done.
[in] | stats | The data structure |
InconsistentInputError | if given no points to analyze |
real gmx_stats_get_average | ( | gmx_stats_t | stats | ) |
Computes and returns the average value.
[in] | stats | The data structure |
InconsistentInputError | if given no points to average |
gmx_stats_t gmx_stats_init | ( | ) |
Initiate a data structure.
Fit a straight line y=ax+b thru the n data points x, y.
[in] | n | number of points |
[in] | x | data points x |
[in] | y | data point y |
[out] | a | slope |
[out] | b | intercept |
[out] | r | correlation coefficient |
[out] | chi2 | quality of fit |
InconsistentInputError | if given no points to fit |
void lsq_y_ax_b_error | ( | int | n, |
real | x[], | ||
real | y[], | ||
real | dy[], | ||
real * | a, | ||
real * | b, | ||
real * | da, | ||
real * | db, | ||
real * | r, | ||
real * | chi2 | ||
) |
Fit a straight line y=ax+b thru the n data points x, y.
[in] | n | number of points |
[in] | x | data points x |
[in] | y | data point y |
[in] | dy | uncertainty in data point y |
[out] | a | slope |
[out] | b | intercept |
[out] | da | error in slope |
[out] | db | error in intercept |
[out] | r | correlation coefficient |
[out] | chi2 | quality of fit |
InconsistentInputError | if given no points to fit |
Fit a straight line y=ax+b thru the n data points x, y.
[in] | n | number of points |
[in] | x | data points x |
[in] | y | data point y |
[out] | a | slope |
[out] | b | intercept |
[out] | r | correlation coefficient |
[out] | chi2 | quality of fit |
InconsistentInputError | if given no points to fit Suits cases where x is already always computed in double precision even in a mixed-precision build configuration. |