Class fit_linear (o2scl)

O2scl : Class List

template<class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
class fit_linear

Linear least-squares fitting class (GSL)

Storage

mat_t A

Local copy of xpred (and used as workspace by the SV decomposition)

mat_t Q

The first unitary matrix from the SV decomposition.

mat_t QSI

Workspace for the SV decomposition and storage for \( Q S^{-1} \).

vec_t S

The singular values from the SV decomposition.

vec_t xt

SV decomposition workspace and also used to store new predicted values.

vec_t D

Balancing factors for A.

vec_t t

Only used for the weighted fit (not yet implemented)

size_t size_par

Number of parameters.

size_t size_dat

Number of data points.

bool column_scaling

If true, discard fit components if the associated singular value becomes too small (default true)

double tol

Tolerance (default \( \sim 2.22\times 10^{-16} \))

size_t rank

The rank of the linear system from the last call to fit_linear()

inline fit_linear()
inline virtual ~fit_linear()
inline virtual void fit_svd(size_t ndat, size_t npar)

Perform the SV decomposition.

inline virtual void fit(size_t npar, size_t ndat, const vec_t &ydat, const mat_t &xpred, vec_t &parms, mat_t &covar, double &chi2)

Perform a least-squares fit of a linear system.

This function performs a least-squares fit of the system

\[ \mathrm{xpred} \cdot \mathrm{parms} = \mathrm{ydat} \]

The variance-covariance matrix for the parameters is returned in covar and the value of \( \chi^2 \) is returned in chi2.

inline virtual const char *type()

Return string denoting type (“fit_linear”)