QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BSpline Class Reference

B-spline basis functions. More...

#include <ql/math/bspline.hpp>

+ Collaboration diagram for BSpline:

Public Member Functions

 BSpline (Natural p, Natural n, const std::vector< Real > &knots)
 
Real operator() (Natural i, Real x) const
 

Private Member Functions

Real N (Natural i, Natural p, Real x) const
 

Private Attributes

Natural p_
 
Natural n_
 
std::vector< Realknots_
 

Detailed Description

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

\( (p+1) \)-th order B-spline (or p degree polynomial) basis functions \( N_{i,p}(x), i = 0,1,2 \ldots n \), with \( n+1 \) control points, or equivalently, an associated knot vector of size \( p+n+2 \) defined at the increasingly sorted points \( (x_0, x_1 \ldots x_{n+p+1}) \). A linear B-spline has \( p=1 \), quadratic B-spline has \( p=2 \), a cubic B-spline has \( p=3 \), 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} \]

Definition at line 58 of file bspline.hpp.

Constructor & Destructor Documentation

◆ BSpline()

BSpline ( Natural  p,
Natural  n,
const std::vector< Real > &  knots 
)

Definition at line 25 of file bspline.cpp.

Member Function Documentation

◆ operator()()

Real operator() ( Natural  i,
Real  x 
) const

Definition at line 43 of file bspline.cpp.

+ Here is the call graph for this function:

◆ N()

Real N ( Natural  i,
Natural  p,
Real  x 
) const
private

Definition at line 49 of file bspline.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ p_

Natural p_
private

Definition at line 70 of file bspline.hpp.

◆ n_

Natural n_
private

Definition at line 72 of file bspline.hpp.

◆ knots_

std::vector<Real> knots_
private

Definition at line 73 of file bspline.hpp.