subroutine cubspl ( tau, c, n, ibcbeg, ibcend ) from * a practical guide to splines * by c. de boor ************************ input *************************** n = number of data points. assumed to be .ge. 2. (tau(i), c(1,i), i=1,...,n) = abscissae and ordinates of the data points. tau is assumed to be strictly increasing. ibcbeg, ibcend = boundary condition indicators, and c(2,1), c(2,n) = boundary condition information. specifically, ibcbeg = 0 means no boundary condition at tau(1) is given. in this case, the not-a-knot condition is used, i.e. the jump in the third derivative across tau(2) is forced to zero, thus the first and the second cubic polynomial pieces are made to coincide.) ibcbeg = 1 means that the slope at tau(1) is made to equal c(2,1), supplied by input. ibcbeg = 2 means that the second derivative at tau(1) is made to equal c(2,1), supplied by input. ibcend = 0, 1, or 2 has analogous meaning concerning the boundary condition at tau(n), with the additional infor- mation taken from c(2,n). *********************** output ************************** c(j,i), j=1,...,4; i=1,...,l (= n-1) = the polynomial coefficients of the cubic interpolating spline with interior knots (or joints) tau(2), ..., tau(n-1). precisely, in the interval (tau(i), tau(i+1)), the spline f is given by f(x) = c(1,i)+h*(c(2,i)+h*(c(3,i)+h*c(4,i)/3.)/2.) where h = x - tau(i). the function program ppvalu may be used to evaluate f or its derivatives from tau,c, l = n-1, and k=4.
Definition at line 243 of file spline.
275 double divdf1,divdf3,dtau,g=0;
283 {
for (
size_t m=1; m<
fNp ; ++m) {
313 bool forward_gauss_elimination =
true;
318 {
for (
int m=1; m<l; ++m) {
346 forward_gauss_elimination =
false;
364 forward_gauss_elimination =
false;
368 forward_gauss_elimination =
false;
377 if(forward_gauss_elimination) {
389 for (
size_t i=1; i<
fNp; ++i) {
391 divdf1 = (
fPoly[i].Y() -
fPoly[i-1].Y())/dtau;
392 divdf3 =
fPoly[i-1].B() +
fPoly[i].B() - 2.*divdf1;
393 fPoly[i-1].C() = (divdf1 -
fPoly[i-1].B() - divdf3)/dtau;
394 fPoly[i-1].D() = (divdf3/dtau)/dtau;