• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2Copyright (c) 2019 Nick Thompson
3Use, modification and distribution are subject to the
4Boost Software License, Version 1.0. (See accompanying file
5LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6]
7
8[section:cardinal_quadratic_b Cardinal Quadratic B-spline interpolation]
9
10[heading Synopsis]
11``
12  #include <boost/math/interpolators/cardinal_quadratic_b_spline.hpp>
13``
14
15    namespace boost{ namespace math{ namespace interpolators {
16
17    template <class Real>
18    class cardinal_quadratic_b_spline
19    {
20    public:
21        // If you don't know the value of the derivative at the endpoints, leave them as NaNs and the routine will estimate them.
22        // y[0] = y(a), y[n - 1] = y(b), step_size = (b - a)/(n -1).
23        cardinal_quadratic_b_spline(const Real* const y,
24                                    size_t n,
25                                    Real t0 /* initial time, left endpoint */,
26                                    Real h  /*spacing, stepsize*/,
27                                    Real left_endpoint_derivative = std::numeric_limits<Real>::quiet_NaN(),
28                                    Real right_endpoint_derivative = std::numeric_limits<Real>::quiet_NaN())
29
30        cardinal_quadratic_b_spline(std::vector<Real> const & y,
31                                    Real t0 /* initial time, left endpoint */,
32                                    Real h  /*spacing, stepsize*/,
33                                    Real left_endpoint_derivative = std::numeric_limits<Real>::quiet_NaN(),
34                                    Real right_endpoint_derivative = std::numeric_limits<Real>::quiet_NaN())
35
36        Real operator()(Real t) const;
37
38        Real prime(Real t) const;
39    };
40    }}}
41
42[heading Cardinal Quadratic B-Spline Interpolation]
43
44The cardinal quadratic B-spline interpolator is very nearly the same as the cubic B-spline interpolator,
45with the modification that the basis functions are constructed by convolving a box function with itself twice,
46rather than three times as is done with the cubic B-spline.
47
48Since the basis functions are less smooth than the cubic B-spline,
49you will nearly always wish to use the cubic B-spline interpolator rather than this.
50However, this interpolator is occasionally useful for approximating functions of reduced smoothness,
51as hence finds use internally in the Boost.Math library.
52
53It is reasonable to test this interpolator against the cubic b-spline interpolator when you are approximating functions
54which are two or three times continuously differentiable, but not three or four times differentiable.
55
56[endsect] [/section:cardinal_quadratic_b]
57