Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions freeimodpoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ uword FreeIModPoly::IModPoly(const vec &spectrum,
double prev_dev = dev; //used in while loop critera

//find major peak areas to remove and remove them
uvec non_peak_ind = NonPeakInd(spectrum, dev);
uvec non_peak_ind = NonPeakInd(spectrum, fit , dev);
vec new_abscissa = abscissa(non_peak_ind);

vec prev_fit = spectrum(non_peak_ind);//not a fit here, but in the loop.
Expand Down Expand Up @@ -136,13 +136,14 @@ double FreeIModPoly::CalcDev(const vec &spectrum, const vec &fit)
/// \param dev
/// \return
///
uvec FreeIModPoly::NonPeakInd(const vec &spectrum, const double dev)
uvec FreeIModPoly::NonPeakInd(const vec &spectrum, const vec &fit, const double dev)
{
using namespace arma;
vec SUM = spectrum + dev * ones(spectrum.n_rows);
vec SUM = fit + dev * ones(fit.n_rows);
return find(spectrum <= SUM);
}


///
/// \brief FreeIModPoly::CalcPoly Calculate the values of a polynomial
/// \param coefs The polynomial coefficients ordered from 0th order to nth order
Expand Down
2 changes: 1 addition & 1 deletion freeimodpoly.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace FreeIModPoly{
const double threshold);

double CalcDev(const vec &spectrum, const vec &fit);
uvec NonPeakInd(const vec &spectrum, const double dev);
uvec NonPeakInd(const vec &spectrum, const vec &fit, const double dev);
vec CalcPoly(const vec &coefs, const vec &x);
vec OrdinaryLeastSquares(const mat &X, const vec &y);
mat Vandermonde(const vec &x, const int poly_order);
Expand Down