|
|
◆ bint4()
| void bint4 |
( |
double |
x[], |
|
|
double |
y[], |
|
|
int |
ndata, |
|
|
int |
ibcl, |
|
|
int |
ibcr, |
|
|
double |
fbcl, |
|
|
double |
fbcr, |
|
|
int |
kntopt, |
|
|
double |
t[], |
|
|
double |
bcoef[], |
|
|
int * |
n, |
|
|
int * |
k, |
|
|
double |
work[], |
|
|
int * |
info |
|
) |
| |
B-representation of the cubic spline interpolation
- Purpose
- This routine computes the B-representation (t[], bcoef[], n, k) of a cubic spline (k = 4) which interpolates given data. The spline or any of its derivatives can be evaluated by calls to bvalu.
Parameters ibcl, ibcr, fbcl, fbcr allow the specification of the spline first or second derivative at both x[0] and x[ndata-1]. When this data is not specified by the problem, it is common practice to use a natural spline by setting second derivatives at x[0] and x[ndata-1] to zero (ibcl = ibcr = 2, fbcl = fbcr = 0).
The spline is defined on t[3] <= x <= t[n] with (ordered) interior knots at x[i] values where n = ndata+2. The knots t[0], t[1], t[2] lie to the left of t[3] = x[0] and the knots t[n+1], t[n+2], t[n+3] lie to the right of t[n] = x[ndata-1] in increasing order. If no extrapolation outside [x[0], x[ndata-1]] is anticipated, the knots t[0] = t[1] = t[2] = t[3] = x[0] and t[n] = t[n+1] = t[n+2] = t[n+3] = x[ndata-1] can be specified by kntopt = 1. kntopt = 2 selects a knot placement for t[0], t[1], t[2] to make the first 7 knots symmetric about t[3] = x[0] and similarly for t[n+1], t[n+2], t[n+3] about t[n] = x[ndata-1]. kntopt = 3 allows the user to make his own selection, in increasing order, for t[0], t[1], t[2] to the left of x[0] and t[n+1], t[n+2], t[n+3] to the right of x[ndata-1] in the work array work[0] through work[5]. In any case, the interpolation on t[3] <= x <= t[n] by using function bvalu is unique for given boundary conditions.
- Parameters
-
| [in] | x[] | Array x[lx] (lx >= ndata)
X vector of abscissae, distinct and in increasing order. |
| [in] | y[] | Array y[ly] (ly >= ndata)
Y vector of ordinates. |
| [in] | ndata | Number of data points. (ndata >= 2) |
| [in] | ibcl | Selection parameter for left boundary condition.
= 1: Constrain the first derivative at x[0] to fbcl.
= 2: Constrain the second derivative at x[0] to fbcl. |
| [in] | ibcr | Selection parameter for right boundary condition.
= 1: Constrain the first derivative at x[ndata - 1] to fbcr.
= 2: Constrain the second derivative at x[ndata - 1] to fbcr. |
| [in] | fbcl | Left boundary values governed by ibcl. |
| [in] | fbcr | Right boundary values governed by ibcr. |
| [in] | kntopt | Knot selection parameter.
= 1: Sets knot multiplicity at t[3] and t[n] to 4.
= 2: Sets a symmetric placement of knots about t[3] and t[n].
= 3: Sets t[i] = work[i] and t[n+1+i] = work[3+i] (i = 0 to 2) where work[i] (i = 0 to 5) are supplied by the user. |
| [out] | t[] | Array t[lt] (lt >= n + 4)
Knot values. |
| [out] | bcoef[] | Array bcoef[lbcoef] (lbcoef >= n)
B-spline coefficients. |
| [out] | n | Number of coefficients. (n = ndata + 2) |
| [out] | k | Order of spline. (k = 4) |
| [out] | work[] | Array work[lwork] (lwork >= 5*(ndata + 2))
Work array. |
| [out] | info | = 0: Successful exit
= -1: The argument x[] had an illegal value (not distinct or not in increasing order)
= -3: The argument ndata had an illegal value (ndata < 2)
= -4: The argument ibcl had an illegal value (ibcl != 1 and ibcl != 2)
= -5: The argument ibcr had an illegal value (ibcr != 1 and ibcr != 2)
= -8: The argument kntopt had an illegal value (kntopt < 1 or kntopt > 3)
= -13: The argument work[] had an illegal value (knot input through work[0] to work[5] is not ordered properly when kntopt = 3)
= 1: The system of equations for computing coefficients is singular |
- Reference
- SLATEC
|