Vespucci  1.0.0
linleastsq.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright (C) 2014-2016 Wright State University - All Rights Reserved
3  Daniel P. Foose - Maintainer/Lead Developer
4 
5  This file is part of Vespucci.
6 
7  Vespucci is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Vespucci is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Vespucci. If not, see <http://www.gnu.org/licenses/>.
19 *******************************************************************************/
20 #ifndef LINLEASTSQ_H
21 #define LINLEASTSQ_H
22 #if !defined( SWIG )
23  // SWIG should not see #inlcude<armadillo> as it can not handle it
24  #include "Math/VespucciMath.h"
25  #include "Global/libvespucci.h"
26 #endif
27 namespace Vespucci{
28  namespace Math{
34  namespace LinLeastSq{
35  VESPUCCI_EXPORT arma::uword IModPoly(const arma::vec &spectrum, const arma::vec &abscissa,
36  arma::vec &baseline, arma::vec &corrected,
37  double &err,
38  const arma::uword poly_order,
39  const arma::uword max_it,
40  const double threshold);
41 
42  double CalcDev(const arma::vec &spectrum, const arma::vec &fit);
43  arma::uvec NonPeakInd(const arma::vec &spectrum, const double dev);
44  arma::vec CalcPoly(const arma::vec &coefs, const arma::vec &x);
45  VESPUCCI_EXPORT arma::mat OrdinaryLeastSquares(const arma::mat &X, const arma::mat &y);
46  VESPUCCI_EXPORT arma::mat OrdinaryLeastSquares(const arma::mat &X, const arma::mat &y, arma::mat &coef_errors, arma::mat &predicted);
47  VESPUCCI_EXPORT arma::vec OrdinaryLeastSquares(const arma::mat &X, const arma::vec &y, arma::vec &fit, std::map<std::string, double> &stats);
48  VESPUCCI_EXPORT arma::mat Vandermonde(const arma::vec &x, const int poly_order);
49  double CalcErr(const double &dev, const double &prev_dev);
50  VESPUCCI_EXPORT arma::vec FitGaussian(const arma::vec &x, const arma::vec &y, arma::vec &fit, std::map<std::string, double> &stats);
51 
52 
53  }
54  }
55 
56 }
57 
58 
59 #endif // LINLEASTSQ_H
double CalcErr(const double &dev, const double &prev_dev)
Vespucci::Math::LinLeastSq::CalcErr Calculate the error criterion.
Definition: linleastsq.cpp:178
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...
Definition: linleastsq.cpp:35
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.
Definition: linleastsq.cpp:232
arma::uvec NonPeakInd(const arma::vec &spectrum, const double dev)
Vespucci::Math::LinLeastSq::NonPeakInd.
Definition: linleastsq.cpp:119
arma::vec CalcPoly(const arma::vec &coefs, const arma::vec &x)
Vespucci::Math::LinLeastSq::CalcPoly Calculate the values of a polynomial.
Definition: linleastsq.cpp:132
#define VESPUCCI_EXPORT
Definition: libvespucci.h:7
double CalcDev(const arma::vec &spectrum, const arma::vec &fit)
Vespucci::Math::LinLeastSq::CalcDev.
Definition: linleastsq.cpp:103
VESPUCCI_EXPORT arma::mat Vandermonde(const arma::vec &x, const int poly_order)
Vespucci::Math::LinLeastSq::Vandermonde Build a Vandermonde matrix for OLS.
Definition: linleastsq.cpp:162
VESPUCCI_EXPORT arma::mat OrdinaryLeastSquares(const arma::mat &X, const arma::mat &y)
Vespucci::Math::LinLeastSq::OrdinaryLeastSquares Perform Squares.
Definition: linleastsq.cpp:149
A namespace for "global" functions, including math functions.