- QuantLib
- BSpline
 
B-spline basis functions. More...
#include <ql/math/bspline.hpp>
| Public Member Functions | |
| BSpline (Natural p, Natural n, const std::vector< Real > &knots) | |
| Real | operator() (Natural i, Real x) const | 
B-spline basis functions.
Follows treatment and notation from:
Weisstein, Eric W. "B-Spline." From MathWorld--A Wolfram Web Resource. <http://mathworld.wolfram.com/B-Spline.html>
 -th order B-spline (or p degree polynomial) basis functions
-th order B-spline (or p degree polynomial) basis functions  , with
, with  control points, or equivalently, an associated knot vector of size
 control points, or equivalently, an associated knot vector of size  defined at the increasingly sorted points
 defined at the increasingly sorted points  . A linear B-spline has
. A linear B-spline has  , quadratic B-spline has
, quadratic B-spline has  , a cubic B-spline has
, a cubic B-spline has  , etc.
, etc.
The B-spline basis functions are defined recursively as follows:
![\[ \begin{array}{rcl} N_{i,0}(x) &=& 1 \textrm{\ if\ } x_{i} \leq x < x_{i+1} \\ &=& 0 \textrm{\ otherwise} \\ N_{i,p}(x) &=& N_{i,p-1}(x) \frac{(x - x_{i})}{ (x_{i+p-1} - x_{i})} + N_{i+1,p-1}(x) \frac{(x_{i+p} - x)}{(x_{i+p} - x_{i+1})} \end{array} \]](form_178.png)