OpenMS
CubicSpline2d.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Lars Nilse $
6 // $Authors: Lars Nilse $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/OpenMSConfig.h>
12 
13 #include <vector>
14 #include <map>
15 
16 namespace OpenMS
17 {
27  class OPENMS_DLLAPI CubicSpline2d
28  {
29 
30  std::vector<double> a_;
31  std::vector<double> b_;
32  std::vector<double> c_;
33  std::vector<double> d_;
34  std::vector<double> x_;
35 
36 public:
37 
48  CubicSpline2d(const std::vector<double>& x, const std::vector<double>& y);
49 
55  CubicSpline2d(const std::map<double, double>& m);
56 
62  double eval(double x) const;
63 
69  double derivative(double x) const;
70 
78  double derivatives(double x, unsigned order) const;
79 
80 private:
81 
88  void init_(const std::vector<double>& x, const std::vector<double>& y);
89 
90  };
91 
92 }
93 
cubic spline interpolation as described in R.L. Burden, J.D. Faires, Numerical Analysis,...
Definition: CubicSpline2d.h:28
std::vector< double > c_
quadratic spline coefficients
Definition: CubicSpline2d.h:32
double derivative(double x) const
evaluates first derivative of spline at position x
double eval(double x) const
evaluates the spline at position x
std::vector< double > a_
constant spline coefficients
Definition: CubicSpline2d.h:30
std::vector< double > b_
linear spline coefficients
Definition: CubicSpline2d.h:31
CubicSpline2d(const std::map< double, double > &m)
constructor of spline interpolation
void init_(const std::vector< double > &x, const std::vector< double > &y)
initialize the spline
std::vector< double > x_
knots
Definition: CubicSpline2d.h:34
std::vector< double > d_
cubic spline coefficients
Definition: CubicSpline2d.h:33
CubicSpline2d(const std::vector< double > &x, const std::vector< double > &y)
constructor of spline interpolation
double derivatives(double x, unsigned order) const
evaluates derivative of spline at position x
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19