Public Member Functions | Public Attributes | Protected Attributes | List of all members
o2scl::fit_linear< vec_t, mat_t > Class Template Reference

Linear least-squares fitting class (GSL) More...

#include <fit_linear.h>

Public Member Functions

virtual void fit_svd (size_t ndat, size_t npar)
 Perform the SV decomposition.
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. More...
virtual const char * type ()
 Return string denoting type ("fit_linear")

Public Attributes

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()

Protected Attributes

size_t size_par
 Number of parameters.
size_t size_dat
 Number of data points.
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)

Detailed Description

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

Definition at line 67 of file fit_linear.h.

Member Function Documentation

◆ fit()

template<class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
virtual void o2scl::fit_linear< vec_t, mat_t >::fit ( size_t  npar,
size_t  ndat,
const vec_t &  ydat,
const mat_t &  xpred,
vec_t &  parms,
mat_t &  covar,
double &  chi2 

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.

Definition at line 140 of file fit_linear.h.

The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).