source: trunk/yat/regression/GSLInterpolation.h @ 1644

Last change on this file since 1644 was 1644, checked in by Jari Häkkinen, 13 years ago

Addresses #466. Changed to VectorBase? passing. Added documentation.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1#ifndef _theplu_yat_regression_gslinterpolation_
2#define _theplu_yat_regression_gslinterpolation_
3
4// $Id: GSLInterpolation.h 1644 2008-12-13 08:14:51Z jari $
5
6/*
7  Copyright (C) 2008 Jari Häkkinen
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <gsl/gsl_interp.h>
26
27namespace theplu {
28namespace yat {
29namespace utility {
30  class VectorBase;
31}
32namespace regression {
33
34  /**
35     \brief Base class for interfacing GSL interpolation.
36
37     The GSL interpolation is descibed in
38     http://www.gnu.org/software/gsl/manual/html_node/Interpolation.html. The
39     GSL library provides a variety of interpolation methods,
40     including Cubic splines and Akima splines. Interpolations can be
41     defined for both normal and periodic boundary
42     conditions. Additional functions are available for computing
43     derivatives and integrals of interpolating functions.
44
45     Given a set of data points \f$ (x_1, y_1) \dots (x_n, y_n) \f$
46     the sub classescompute a continuous interpolating function \f$
47     y(x) \f$ such that \f$ y(x_i) = y_i \f$. The interpolation is
48     piecewise smooth, and its behavior at the end-points is
49     determined by the type of interpolation used.
50  */
51  class GSLInterpolation
52  {
53
54  public:
55
56    /**
57       \brief Calculate the interpolated value for \a x.
58
59       \return The interpolated value of \f$ y \f$ for a given point
60       \a x.
61    */
62    double evaluate(const double x) const;
63
64  protected:
65    /**
66       \brief The default constructor
67
68       Initializion of the interpolation object for the data \f$ (x,
69       y) \f$ where \a x and \a y are vector like objects of the same
70       size. The content of \a x and \a y are copied for internal
71       storage. \a x is always assumed to be strictly ordered, with
72       increasing \a x values; the behavior for other arrangements is
73       not defined.
74    */
75    GSLInterpolation(const gsl_interp_type*, const utility::VectorBase& x,
76                     const utility::VectorBase& y);
77
78    /**
79       \brief The destructor
80    */
81    virtual ~GSLInterpolation(void);
82
83  private:
84    /**
85       \brief Copy Constructor. (not implemented)
86    */
87    GSLInterpolation(const GSLInterpolation&);
88
89    gsl_interp_accel* accelerator_;
90    gsl_interp* interpolator_;
91    double* x_;
92    double* y_;
93  };
94
95}}} // of namespaces regression, yat, and theplu
96
97#endif
Note: See TracBrowser for help on using the repository browser.