Vespucci  1.0.0
Vespucci::Math::LinLeastSq Namespace Reference

Functions

VESPUCCI_EXPORT arma::uword IModPoly (const arma::vec &spectrum, const arma::vec &abscissa, arma::vec &baseline, arma::vec &corrected, double &err, const arma::uword poly_order, const arma::uword max_it, const double threshold)
 Vespucci::Math::LinLeastSq::IModPoly Perform the Vancouver Raman Algorithm to correct baseline. More...
 
double CalcDev (const arma::vec &spectrum, const arma::vec &fit)
 Vespucci::Math::LinLeastSq::CalcDev. More...
 
arma::uvec NonPeakInd (const arma::vec &spectrum, const double dev)
 Vespucci::Math::LinLeastSq::NonPeakInd. More...
 
arma::vec CalcPoly (const arma::vec &coefs, const arma::vec &x)
 Vespucci::Math::LinLeastSq::CalcPoly Calculate the values of a polynomial. More...
 
VESPUCCI_EXPORT arma::mat OrdinaryLeastSquares (const arma::mat &X, const arma::mat &y)
 Vespucci::Math::LinLeastSq::OrdinaryLeastSquares Perform Squares. More...
 
VESPUCCI_EXPORT arma::mat OrdinaryLeastSquares (const arma::mat &X, const arma::mat &y, arma::mat &coef_errors, arma::mat &predicted)
 
VESPUCCI_EXPORT arma::vec OrdinaryLeastSquares (const arma::mat &X, const arma::vec &y, arma::vec &fit, std::map< std::string, double > &stats)
 
VESPUCCI_EXPORT arma::mat Vandermonde (const arma::vec &x, const int poly_order)
 Vespucci::Math::LinLeastSq::Vandermonde Build a Vandermonde matrix for OLS. More...
 
double CalcErr (const double &dev, const double &prev_dev)
 Vespucci::Math::LinLeastSq::CalcErr Calculate the error criterion. More...
 
VESPUCCI_EXPORT arma::vec FitGaussian (const arma::vec &x, const arma::vec &y, arma::vec &fit, std::map< std::string, double > &stats)
 Vespucci::Math::LinLeastSq::FitGaussian. More...
 

Function Documentation

double Vespucci::Math::LinLeastSq::CalcDev ( const arma::vec &  spectrum,
const arma::vec &  fit 
)

Vespucci::Math::LinLeastSq::CalcDev.

Parameters
spectrum
fit
Returns

Definition at line 103 of file linleastsq.cpp.

double Vespucci::Math::LinLeastSq::CalcErr ( const double &  dev,
const double &  prev_dev 
)

Vespucci::Math::LinLeastSq::CalcErr Calculate the error criterion.

Parameters
dev
prev_dev
Returns

Definition at line 178 of file linleastsq.cpp.

arma::vec Vespucci::Math::LinLeastSq::CalcPoly ( const arma::vec &  coefs,
const arma::vec &  x 
)

Vespucci::Math::LinLeastSq::CalcPoly Calculate the values of a polynomial.

Parameters
coefsThe polynomial coefficients ordered from 0th order to nth order
xThe values for which the polynomial is to be calculated
Returns
The calculated values

Definition at line 132 of file linleastsq.cpp.

arma::vec Vespucci::Math::LinLeastSq::FitGaussian ( const arma::vec &  x,
const arma::vec &  y,
arma::vec &  fit,
std::map< std::string, double > &  stats 
)

Vespucci::Math::LinLeastSq::FitGaussian.

Parameters
x
y
fit
stats
Returns
Fits a Gaussian using Caruana's algorithm

Definition at line 232 of file linleastsq.cpp.

arma::uword Vespucci::Math::LinLeastSq::IModPoly ( const arma::vec &  spectrum,
const arma::vec &  abscissa,
arma::vec &  baseline,
arma::vec &  corrected,
double &  err,
const arma::uword  poly_order,
const arma::uword  max_it,
const double  threshold 
)

Vespucci::Math::LinLeastSq::IModPoly Perform the Vancouver Raman Algorithm to correct baseline.

Parameters
spectrumA vector containing the signal to be corrected
abscissaThe x-values of spectrum
baselineWill contain the fitted baseline
correctedWill contain the corrected spectrum
poly_orderPolynomial order for the baseline fits
max_itMaximum number of iterations to perform. if set to 0 there is no maximum
thresholdA value specifying the upper limit of the error criterion
errThe final error criterion
Returns
The number of iterations

Definition at line 35 of file linleastsq.cpp.

arma::uvec Vespucci::Math::LinLeastSq::NonPeakInd ( const arma::vec &  spectrum,
const double  dev 
)

Vespucci::Math::LinLeastSq::NonPeakInd.

Parameters
spectrum
dev
Returns

Definition at line 119 of file linleastsq.cpp.

arma::mat Vespucci::Math::LinLeastSq::OrdinaryLeastSquares ( const arma::mat &  X,
const arma::mat &  y 
)

Vespucci::Math::LinLeastSq::OrdinaryLeastSquares Perform Squares.

Parameters
XThe design matrix of the regression
yThe response vector
Returns

Definition at line 149 of file linleastsq.cpp.

VESPUCCI_EXPORT arma::mat Vespucci::Math::LinLeastSq::OrdinaryLeastSquares ( const arma::mat &  X,
const arma::mat &  y,
arma::mat &  coef_errors,
arma::mat &  predicted 
)
arma::vec Vespucci::Math::LinLeastSq::OrdinaryLeastSquares ( const arma::mat &  X,
const arma::vec &  y,
arma::vec &  fit,
std::map< std::string, double > &  stats 
)

Definition at line 184 of file linleastsq.cpp.

arma::mat Vespucci::Math::LinLeastSq::Vandermonde ( const arma::vec &  x,
const int  poly_order 
)

Vespucci::Math::LinLeastSq::Vandermonde Build a Vandermonde matrix for OLS.

Parameters
xA vector containing a signal
poly_orderThe polynomial order
Returns
A Vandermonde matrix of x for the polynomial of order poly_order

Definition at line 162 of file linleastsq.cpp.