Class smooth_gsl (o2scl)

O2scl : Class List

class smooth_gsl

Smooth a GSL vector using GSL bsplines.

Todo

In function pair_density():

  • Needs a bit more error checking and more documentation.

  • Future: Generalize to generic vector types. (Does this require reworking the GSL linear fitting routines? Doesn’t matter now, the GSL linear fitting routines are now reworked.)

  • Future: Possibly create a new gsl_bspline class which replaces the GSL bspline workspace

  • Future: Allow user to probe chi squared and the covariance?

Public Functions

inline smooth_gsl()
inline smooth_gsl(const gsl_vector *ix)

Begin using x-values from vector ix.

inline ~smooth_gsl()
inline void set_ncoeff(int incoeffs)

Set the number of coefficients.

inline void set_order(int order)

Set order.

inline void set_pars(int incoeffs, int order)

Set parameters.

inline void set_x(const gsl_vector *ix)

Set the x-values.

int smooth_data(const gsl_vector *y, const gsl_vector *e, gsl_vector *ys)

Smooth data in y with errors e returning result ys.

int smooth_data(const gsl_vector *y, gsl_vector *ys)

Smooth data in y returning result ys.

Protected Functions

int fit(const gsl_vector *y)

Construct un-weighted fit.

int fit_errors(const gsl_vector *y, const gsl_vector *e)

Construct weighted fit.

double calc_for_x(double xi)

calculate smoothed curve value for a certain xi

int init()

Allocate memory and initialize splines.

void init_pointers_and_defs()

Set default values and zero pointers.

int free()

Free memory.

Protected Attributes

size_t ncoeffs

Number of free coefficients for spline.

size_t norder

Order of spline to be used (4=cubic)

size_t nbreak

internally calculated, number of “segment” to split the data into

bool x_set

True of the x values have been set.

gsl_bspline_workspace *bw

Spline workspace.

gsl_vector *B

Spline temporary vector.

gsl_vector *c

Parameters of linear fit, y=X*c.

gsl_multifit_linear_workspace *mw

Linear fit workspace.

gsl_matrix *X

Workspace for spline fitting.

const gsl_vector *x

Values of the independent variable.

gsl_matrix *cov

Covariance matrix.