yat  0.21pre
GSLInterpolation.h
1 #ifndef _theplu_yat_regression_gslinterpolation_
2 #define _theplu_yat_regression_gslinterpolation_
3 
4 // $Id: GSLInterpolation.h 4207 2022-08-26 04:36:28Z peter $
5 
6 /*
7  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009 Jari Häkkinen
9  Copyright (C) 2022 Peter Johansson
10 
11  This file is part of the yat library, http://dev.thep.lu.se/yat
12 
13  The yat library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License as
15  published by the Free Software Foundation; either version 3 of the
16  License, or (at your option) any later version.
17 
18  The yat library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with yat. If not, see <http://www.gnu.org/licenses/>.
25 */
26 
27 #include <memory>
28 
29 #include <gsl/gsl_interp.h>
30 
31 namespace theplu {
32 namespace yat {
33 namespace utility {
34  class VectorBase;
35 }
36 namespace regression {
37 
63  {
64 
65  public:
79  GSLInterpolation(const gsl_interp_type*, const utility::VectorBase& x,
80  const utility::VectorBase& y);
81 
85  virtual ~GSLInterpolation(void)=0;
86 
96  double evaluate(double x);
97 
107  double evaluate_derivative(double x);
108 
118  double evaluate_derivative2(double x);
119 
129  double evaluate_integral(double a, double b);
130 
137  double evaluation(void) const;
138 
148  unsigned int min_size(void) const;
149 
150  private:
155  // no assignment
156  GSLInterpolation& operator=(const GSLInterpolation&);
157 
158  gsl_interp_accel* accelerator_;
159  double evaluation_;
160  gsl_interp* interpolator_;
161  std::unique_ptr<double[]> x_;
162  std::unique_ptr<double[]> y_;
163  };
164 
165 }}} // of namespaces regression, yat, and theplu
166 
167 #endif
virtual ~GSLInterpolation(void)=0
The destructor.
double evaluate(double x)
Calculate the interpolated value for x.
The Department of Theoretical Physics namespace as we define it.
double evaluate_derivative2(double x)
Calculate the 2nd derivative of the interpolated function at x.
double evaluate_derivative(double x)
Calculate the derivative of the interpolated function at x.
GSLInterpolation(const gsl_interp_type *, const utility::VectorBase &x, const utility::VectorBase &y)
The default constructor.
double evaluation(void) const
The result of the latest evaluaion function call is stored and can be retrieved with this function...
This is the yat interface to GSL vector.
Definition: VectorBase.h:55
double evaluate_integral(double a, double b)
Calculate the numerical integral of the interpolated function over the range .
unsigned int min_size(void) const
This function returns the minimum number of points required by the interpolation type.
Base class for interfacing GSL interpolation.
Definition: GSLInterpolation.h:62

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14