[2727] | 1 | //
|
---|
| 2 | // C++ Interface: PolynomialInterpolator1D
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | //
|
---|
| 7 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2012
|
---|
| 8 | //
|
---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
| 12 | #ifndef ASAP_POLYNOMIAL_INTERPOLATOR_1D_H
|
---|
| 13 | #define ASAP_POLYNOMIAL_INTERPOLATOR_1D_H
|
---|
| 14 |
|
---|
| 15 | #include "Interpolator1D.h"
|
---|
| 16 |
|
---|
| 17 | namespace asap {
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
[2730] | 20 | * Implementation of polynomial interpolation.
|
---|
[2727] | 21 | * @author TakeshiNakazato
|
---|
| 22 | */
|
---|
[2733] | 23 | template <class T, class U>
|
---|
| 24 | class PolynomialInterpolator1D : public Interpolator1D<T, U> {
|
---|
[2727] | 25 | public:
|
---|
[2730] | 26 | // Default constructor.
|
---|
[2727] | 27 | PolynomialInterpolator1D();
|
---|
| 28 |
|
---|
[2730] | 29 | // Destructor.
|
---|
[2727] | 30 | virtual ~PolynomialInterpolator1D();
|
---|
| 31 |
|
---|
[2730] | 32 | // Perform interpolation.
|
---|
| 33 | // @param[in] x horizontal location where the value is evaluated
|
---|
| 34 | // by interpolation.
|
---|
| 35 | // @return interpolated value at x.
|
---|
[2733] | 36 | U interpolate(T x);
|
---|
[2727] | 37 | private:
|
---|
[2730] | 38 | // Perform polynomial interpolation.
|
---|
| 39 | // If (number of data points) > (polynomial order + 1), polynomial
|
---|
| 40 | // interpolation must be done in the sub-region that contains x.
|
---|
| 41 | // This method takes arguments that specifies sub-region to be used.
|
---|
| 42 | // @param[in] x horizontal location where the value is evaluated
|
---|
| 43 | // by interpolation.
|
---|
| 44 | // @param[in] left the leftmost index of sub-region.
|
---|
| 45 | // @param[in] n number of data points of sub-region.
|
---|
| 46 | // @return interpolated value at x.
|
---|
[2733] | 47 | U dopoly(T x, unsigned int left, unsigned int n);
|
---|
[2727] | 48 | };
|
---|
| 49 |
|
---|
| 50 | }
|
---|
[2733] | 51 |
|
---|
| 52 | #include "PolynomialInterpolator1D.tcc"
|
---|
| 53 |
|
---|
[2727] | 54 | #endif
|
---|