sablib
Loading...
Searching...
No Matches
whittaker.h File Reference

Smoothing using Whittaker smoother. More...

#include <stdexcept>
#include <vector>
#include "../misc/diff.h"

Go to the source code of this file.

Functions

const std::vector< double > sablib::Whittaker (const std::vector< double > &y, const std::vector< double > &w, const double lambda, const unsigned int s=2)
 Performs Whittaker smoothing (std::vector<double> version, with weights).
const std::vector< double > sablib::Whittaker (const std::vector< double > &y, const double lambda, const unsigned int s=2)
 Performs Whittaker smoothing (std::vector<double> version, without weights).
template<typename Derived>
const Derived::PlainObject sablib::Whittaker (const Eigen::MatrixBase< Derived > &y, const Eigen::MatrixBase< Derived > &w, const Eigen::SparseMatrix< typename Derived::PlainObject::Scalar > &lambdaDTD)
 Performs Whittaker smoothing.

Detailed Description

Smoothing using Whittaker smoother.

Author
Izadori

References:

  • Whittaker, E. T. On A New Method of Graduation. Proc. Edinburgh Math. Soc., 1922, 41, 63-75.
  • Eilers, P. A Perfect Smoother. Analytical Chemistry, 2003, 75(14), 3631-3636.

Definition in file whittaker.h.

Function Documentation

◆ Whittaker() [1/3]

template<typename Derived>
const Derived::PlainObject sablib::Whittaker ( const Eigen::MatrixBase< Derived > & y,
const Eigen::MatrixBase< Derived > & w,
const Eigen::SparseMatrix< typename Derived::PlainObject::Scalar > & lambdaDTD )

Performs Whittaker smoothing.

Parameters
yThe input data to be smoothed.
wWeights for each data point.
lambdaDTDThe matrix used for smoothness (lambda * D' * D).
Returns
The smoothed data.

Definition at line 58 of file whittaker.h.

◆ Whittaker() [2/3]

const std::vector< double > sablib::Whittaker ( const std::vector< double > & y,
const double lambda,
const unsigned int s = 2 )

Performs Whittaker smoothing (std::vector<double> version, without weights).

Parameters
yThe input data to be smoothed.
lambdaSmoothing parameter (larger values lead to more smoothing, but may flatten peaks).
sThe order of the difference (usually s = 1, 2, or 3).
Returns
The smoothed data.

Definition at line 58 of file whittaker.cpp.

◆ Whittaker() [3/3]

const std::vector< double > sablib::Whittaker ( const std::vector< double > & y,
const std::vector< double > & w,
const double lambda,
const unsigned int s = 2 )

Performs Whittaker smoothing (std::vector<double> version, with weights).

Parameters
yThe input data to be smoothed.
wWeights for each data point.
lambdaSmoothing parameter (larger values lead to more smoothing, but may flatten peaks).
sThe order of the difference (usually s = 1, 2, or 3).
Returns
The smoothed data.
Exceptions
std::invalid_argumentOne or more parameters wrong.

Definition at line 14 of file whittaker.cpp.