ProteoWizard
WhittakerSmoother.hpp
Go to the documentation of this file.
1 //
2 // $Id: WhittakerSmoother.hpp 1191 2009-08-14 19:33:05Z chambm $
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers <a.t> vanderbilt.edu>
6 //
7 // Copyright 2008 Vanderbilt University - Nashville, TN 37232
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 //
21 
22 
23 // Derived from ACS article:
24 // A Perfect Smoother
25 // Paul H. C. Eilers
26 // Anal. Chem., 2003, 75 (14), 3631-3636 DOI: 10.1021/ac034173t
27 
28 
29 #ifndef _WHITTAKERSMOOTHER_HPP_
30 #define _WHITTAKERSMOOTHER_HPP_
31 
32 
33 #include "Smoother.hpp"
34 
35 
36 namespace pwiz {
37 namespace analysis {
38 
39 
41 {
42  WhittakerSmoother(double lambdaCoefficient);
43 
44  /// smooth y values to existing vectors using Whittaker algorithm;
45  /// note: in the case of sparse vectors, smoothing may fill in samples not present
46  /// in the original data, so make sure to check the size of the output vectors
47  virtual void smooth(const std::vector<double>& x, const std::vector<double>& y,
48  std::vector<double>& xSmoothed, std::vector<double>& ySmoothed);
49 
50  /// smooth y values and copy back to the input vectors using Whittaker algorithm;
51  /// note: in the case of sparse vectors, smoothing may fill in samples not present
52  /// in the original data, so make sure to check the size of the output vectors
53  virtual void smooth_copy(std::vector<double>& x, std::vector<double>& y);
54 
55  private:
56  double lambda;
57 };
58 
59 
60 } // namespace analysis
61 } // namespace pwiz
62 
63 #endif // _WHITTAKERSMOOTHER_HPP_