int lsqline( // Data in: const Vector& x, // ordinates const Vector& y, // y(x) data values const int fixb, // 1: define bhat / 0: fit it const double eps, // numerical bandwidth to prevent overflow on division // Data in/out: double& bhat, // best-fitting (or supplied) intercept // Data out: double& ahat, // best-fitting gradient double& sd // standard deviation )Returns 1 on success; 0 if failed because gradient or intercept calculation would involve division by small number.
ArrayReturns polynomial coefficients (order of increasing powers of x), or an Array of length zero if it fails.polyfitg( const Array & x, // Array of x-ordinates const Array & y, // Array of y-values const Array & w, // Array of weights const int n, // number of polynomial coefficients, i.e. order + 1 double& res, // residual of l2 fit (returned value) const double eps = 1.0e-6 // numerical bandwidth for spotting singular matrix )
ArrayReturns coefficients for the functions {1,x,y,xy} respectively, or an Array of no elements if the fitting fails.frectfit( const Array & x, // x ordinates of corners (2) const Array & y, // y ordinates of corners (2) const matrix& f, // function values (2x2) const eps = 1.0e-6 // numerical bandwidth )
int fitstart( const Array(returns index of first point)& r, // Array of ordinates const double rr, // value around which fit is to be performed const int nr // number of points required for the fit )