CMSISDSP
Version 1.10.0
CMSIS DSP Software Library

Functions  
void  arm_spline_f32 (arm_spline_instance_f32 *S, const float32_t *xq, float32_t *pDst, uint32_t blockSize) 
Processing function for the floatingpoint cubic spline interpolation. More...  
void  arm_spline_init_f32 (arm_spline_instance_f32 *S, arm_spline_type type, const float32_t *x, const float32_t *y, uint32_t n, float32_t *coeffs, float32_t *tempBuffer) 
Initialization function for the floatingpoint cubic spline interpolation. More...  
Spline interpolation is a method of interpolation where the interpolant is a piecewisedefined polynomial called "spline".
Given a function f defined on the interval [a,b], a set of n nodes x(i) where a=x(1)<x(2)<...<x(n)=b and a set of n values y(i) = f(x(i)), a cubic spline interpolant S(x) is defined as:
S1(x) x(1) < x < x(2) S(x) = ... Sn1(x) x(n1) < x < x(n)
where
Si(x) = a_i+b_i(xxi)+c_i(xxi)^2+d_i(xxi)^3 i=1, ..., n1
Having defined h(i) = x(i+1)  x(i)
h(i1)c(i1)+2[h(i1)+h(i)]c(i)+h(i)c(i+1) = 3/h(i)*[a(i+1)a(i)]3/h(i1)*[a(i)a(i1)] i=2, ..., n1
It is possible to write the previous conditions in matrix form (Ax=B). In order to solve the system two boundary conidtions are needed.
 1 0 0 ... 0 0 0  c(1)   0   h(0) 2[h(0)+h(1)] h(1) ... 0 0 0  c(2)   3/h(2)*[a(3)a(2)]3/h(1)*[a(2)a(1)]   ... ... ... ... ... ... ...  ... = ...   0 0 0 ... h(n2) 2[h(n2)+h(n1)] h(n1)  c(n1)   3/h(n1)*[a(n)a(n1)]3/h(n2)*[a(n1)a(n2)]   0 0 0 ... 0 0 1  c(n)   0 
 1 1 0 ... 0 0 0  c(1)   0   h(0) 2[h(0)+h(1)] h(1) ... 0 0 0  c(2)   3/h(2)*[a(3)a(2)]3/h(1)*[a(2)a(1)]   ... ... ... ... ... ... ...  ... = ...   0 0 0 ... h(n2) 2[h(n2)+h(n1)] h(n1)  c(n1)   3/h(n1)*[a(n)a(n1)]3/h(n2)*[a(n1)a(n2)]   0 0 0 ... 0 1 1  c(n)   0 
A is a tridiagonal matrix (a band matrix of bandwidth 3) of size N=n+1. The factorization algorithms (A=LU) can be simplified considerably because a large number of zeros appear in regular patterns. The Crout method has been used: 1) Solve LZ=B
u(1,2) = A(1,2)/A(1,1) z(1) = B(1)/l(11)
FOR i=2, ..., N1 l(i,i) = A(i,i)A(i,i1)u(i1,i) u(i,i+1) = a(i,i+1)/l(i,i) z(i) = [B(i)A(i,i1)z(i1)]/l(i,i)
l(N,N) = A(N,N)A(N,N1)u(N1,N) z(N) = [B(N)A(N,N1)z(N1)]/l(N,N)
2) Solve UX=Z
c(N)=z(N)
FOR i=N1, ..., 1 c(i)=z(i)u(i,i+1)c(i+1)
c(i) for i=1, ..., n1 are needed to compute the n1 polynomials. b(i) and d(i) are computed as:
It is possible to compute the interpolated vector for x values outside the input range (xq<x(1); xq>x(n)). The coefficients used to compute the y values for xq<x(1) are going to be the ones used for the first interval, while for xq>x(n) the coefficients used for the last interval.
The initialization function takes as input two arrays that the user has to allocate: coeffs
will contain the b, c, and d coefficients for the (n1) intervals (n is the number of known points), hence its size must be 3*(n1); tempBuffer
is temporally used for internal computations and its size is n+n1.
The x input array must be strictly sorted in ascending order and it must not contain twice the same value (x(i)<x(i+1)).
void arm_spline_f32  (  arm_spline_instance_f32 *  S, 
const float32_t *  xq,  
float32_t *  pDst,  
uint32_t  blockSize  
) 
[in]  S  points to an instance of the floatingpoint spline structure. 
[in]  xq  points to the x values ot the interpolated data points. 
[out]  pDst  points to the block of output data. 
[in]  blockSize  number of samples of output data. 
[in]  S  points to an instance of the floatingpoint spline structure. 
[in]  xq  points to the x values of the interpolated data points. 
[out]  pDst  points to the block of output data. 
[in]  blockSize  number of samples of output data. 
void arm_spline_init_f32  (  arm_spline_instance_f32 *  S, 
arm_spline_type  type,  
const float32_t *  x,  
const float32_t *  y,  
uint32_t  n,  
float32_t *  coeffs,  
float32_t *  tempBuffer  
) 
[in,out]  S  points to an instance of the floatingpoint spline structure. 
[in]  type  type of cubic spline interpolation (boundary conditions) 
[in]  x  points to the x values of the known data points. 
[in]  y  points to the y values of the known data points. 
[in]  n  number of known data points. 
[in]  coeffs  coefficients array for b, c, and d 
[in]  tempBuffer  buffer array for internal computations 