# chickadee » bvsp-spline » compute

##### Identifier search
compute n k x y #!key (shape-constraint 'none) (boundary-condition 'none) (derivative-computation 'order2) (d0 #f) (dnp #f) (d20 #f) (d2np #f) (eps 0.0001) (constr #f) (beta #f) (betainv #f) (rho #f) (rhoinv #f) (kmax #f) (maxstp #f) (d #f) (d2 #f)procedure

Computes the coefficients of a shape-preserving spline, of continuity class C(k), k=1,2 , which interpolates a set of data points and, if required, satisfies additional boundary conditions.

The result of the routine is a list of the form (D D2 CONSTR ERRC DIAGN). D D2 ERRC provide the input parameters for evaluate, which evaluates the spline and its derivatives along a set of tabulation points. CONSTR is an SRFI-4 s32vector that contains computed constraint information.

The required arguments are:

N
the degree of the spline (must be integer >= 3)
K
the class of continuity of the spline (first or second derivative). K=1 or K=2 and N >= 3*K
X
SRFI-4 f64vector value containing the x coordinates of the data points (must be the same length as Y)
Y
SRFI-4 f64vector value containing the y coordinates of the data points (must be the same length as X)

The optional arguments are:

shape-constraint
one of 'none, 'monotonicity, 'convexity, 'monotonicity+convexity, 'local. Default is 'none
boundary-condition
one of 'none, 'non-separable, 'separable. Default is 'none
derivative-computation
one of 'order1, 'order2, 'order3, 'classic. Default is 'order2
d0
left separable boundary condition for the first derivative (only used when boundary-condition is 'separable)
dnp
right separable boundary condition for the first derivative (only used when boundary-condition is 'separable)
d20
left separable boundary condition for the second derivative (only used when boundary-condition is 'separable and K=2)
d2np
right separable boundary condition for the second derivative (only used when boundary-condition is 'separable and K=2)
eps
relative tolerance of the method. Default is 1e-4
constr
if shape-constraint is 'local, this argument containts a s32vector value with the desired constraints on the shape for each subinterval. Each element can be one of 0,1,2,3 (none, monotonicity, convexity, monotonicity and convexity constraint)
beta
user-supplied procedure of the form (LAMBDA X), which represents non-separable boundary conditions for the first derivatives (only used when boundary-condition is 'non-separable)
betainv
user-supplied procedure of the form (LAMBDA X), which is the inverse of BETA (only used when boundary-condition is 'non-separable)
rho
user-supplied procedure of the form (LAMBDA X), which represents non-separable boundary conditions for the second derivatives (only used when boundary-condition is 'non-separable and K=2)
rhoinv
user-supplied procedure of the form (LAMBDA X), which is the inverse of RHO (only used when boundary-condition is 'non-separable and K=2)
kmax
the number of iterations allowed for selecting the minimal set ASTAR (described in the paper)
maxstp
the number of iterations allowed for finding the set DSTAR (described in the paper)
d
SRFI-4 f64vector value containing the first derivatives at the points in X (only used when derivative-computation is 'classic)
d2
SRFI-4 f64vector value containing the second derivatives at the points in X (only used when derivative-computation is 'classic and K=2)