Detailed description of Fitgrid procedures

CURV1 - calculate values for CURV2 usage

This subroutine calculates certain values that are used by CURV2 in order to compute an interpolatory spline under tension through a sequence of functional values. The actual computation of the interpolated values must be done using CURV2 .
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL CURV1 (N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
SLP1,    | Real    | Input  |
SLPN,    | Real    | Input  |
ISLPSW,  | Integer | Input  |
YP,      | Real    | Output | N
TEMP,    | Real    | Input  | N
SIGMA,   | Real    | Input  |
IER)     | Integer | Output |
--------------------------------------------------------------
```
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values of the input data -- (Y(K) is the functional value at X(K) for K=1,N).
SLP1
A user-specified value for the desired slope at X(1). See ISLPSW below if you want to have a value calculated internally.
SLPN
A user-specified value for the desired slope at X(N). See ISLPSW below if you want to have a value calculated internally.
ISLPSW
A switch to indicate whether the slopes at the end points should be calculated internally.
= 0 if SLP1 and SLPN are user-specified.
= 1 if SLP1 is user-specified, but SLPN is internally calculated.
= 2 if SLPN is user-specified, but SLP1 is internally calculated.
= 3 if SLP1 and SLPN are internally calculated.
YP
Contains values for the second derivative (CURV1 computes these).
TEMP
Scratch space.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.
IER
An error return value. If IER is returned as 0, then no errors were detected.
= 1 if N is less than 2.
= 2 if X values are not strictly increasing.

CURV2 - interpolate at a specified point

This function interpolates a value at a specified point using a spline under tension. CURV1 must be called prior to calling CURV2, and the values thus obtained used as input to CURV2. CURV2 returns the interpolated function value at the X-coordinate specified.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
FUNCTION CURV2 (T,       | Real    | Input  |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
YP,      | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
T
The abscissa for which an interpolated function value is desired.
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values of the input data -- Y(K) is the functional value at X(K) for K=1,N.
YP
Contains values for the second derivative (as calculated by CURV1).
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

CURVD - calculate a derivative at a specified point

This function calculates a derivative at a specified point using a spline under tension. CURV1 must be called prior to calling CURVD, and the values thus obtained used as input to CURVD. The derivative value is returned.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
FUNCTION CURVD (T,       | Real    | Input  |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
YP,      | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
T
The abscissa for which an interpolated function value is desired.
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values of the input function -- Y(K) is the functional value at X(K) for K=1,N.
YP
Contains values for the second derivative (as calculated by CURV1).
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

CURVI - integrate a spline curve

This function calculates an integral between two specified limits. CURV1 must be called prior to calling CURVI, and the values thus obtained used as input to CURVI. The value of the integral is returned.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
FUNCTION CURVI (XL,      | Real    | Input  |
XU,      | Real    | Input  |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
YP,      | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
XL
The lower limit of the integration.
XR
The upper limit of the integration.
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values of the input function -- Y(K) is the functional value at X(K) for K=1,N.
YP
Contains values for the second derivative (as calculated by CURV1).
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

CURVP1 - calculate values for CURVP2 usage

This subroutine calculates certain values that are used by CURVP2 in order to compute an interpolatory spline under tension through a sequence of functional values for a periodic function. The actual computation of the interpolated values must be done using CURVP2 .
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL CURVP1 (N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
P,       | Real    | Input  |
YP,      | Real    | Output | N
TEMP,    | Real    | Input  | N x 2
SIGMA,   | Real    | Input  |
IER)     | Integer | Output |
--------------------------------------------------------------
```
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values of the input function -- Y(K) is the functional value at X(K) for K=1,N.
P
The period of the function. P must be greater than X(N)-X(1).
YP
Contains values for the second derivative (these are calculated by CURVP1).
TEMP
Scratch space.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.
IER
An error return value. If IER is returned as 0, then no errors were detected.
= 1 if N is less than 2.
= 2 if P is less than or equal to X(N)-X(1).
= 3 if the X values are not strictly increasing.

CURVP2 - interpolate a periodic function at a specified point

This function interpolates a value at a specified point using a spline under tension. CURVP1 must be called prior to calling CURVP2, and the values thus obtained used as input to CURVP2. The interpolated value is returned.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
FUNCTION CURVP2 (T,       | Real    | Input  |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
P,       | Real    | Input  |
YP,      | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
T
The abscissa for which an interpolated function value is desired.
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values for the input function -- Y(K) is the functional value at X(K) for K=1,N.
P
The period of the function.
YP
Contains values for the second derivative (as computed by CURVP1).
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

CURVPI - integrate a periodic spline curve

This function calculates an integral between two specified limits. CURVP1 must be called prior to calling CURVPI, and the values thus obtained used as input to CURVPI. The value of the integral is returned.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
FUNCTION CURVI (XL,      | Real    | Input  |
XU,      | Real    | Input  |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
P,       | Real    | Input  |
YP,      | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
XL
The lower limit of the integration.
XR
The upper limit of the integration.
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values of the input function -- Y(K) is the functional value at X(K) for K=1,N.
P
The period of the function.
YP
Contains values for the second derivative (as calculated by CURVP1).
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

CURVS - calculate values for a smoothing spline

This subroutine calculates certain values that are used by CURV2 in order to compute an interpolatory smoothing spline under tension through a sequence of functional values. The actual computation of the interpolated values must be done using CURV2.

Three parameters are used to control the degree of smoothness -- D, S, and EPS.

The parameter D is a value indicating the degree of confidence in the accuracy of the input function values -- it should be an approximation of the standard deviation of error. Effectively the value of D controls how close the smoothed curve comes to the input data points. If D is small then the interpolated curve will pass close to the input data. The larger the value of D, the more freedom the smooth curve has in how close it comes to the input data values.

S is a more subtle global smoothing parameter. S must be non-negative. For small values of S, the interpolated curve approximates the tension spline and for larger values of S, the curve is smoother. A reasonable value for EPS is REAL(N).

EPS controls the precision to which S is interpreted; EPS must be between 0. and 1. inclusive. A reasonable value for S is SQRT(2./REAL(N)).

```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL CURVS (N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
D,       | Real    | Input  | N
ISW,     | Integer | Input  |
S,       | Real    | Input  |
EPS,     | Real    | Input  |
YS,      | Real    | Output | N
YSP,     | Real    | Output | N
SIGMA,   | Real    | Input  |
TEMP,    | Real    | Input  | N x 9
IER)     | Integer | Output |
--------------------------------------------------------------
```
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values for the input function -- Y(K) is the functional value at X(K) for K=1,N.
D
A user-specified value containing the observed weights. D may be either an array or a scalar, depending on the value of ISW (as described below).
ISW
A switch for interpreting the value of D. If ISW=0, then D is an array of length N (D contains an individual error estimate for each input data value); if ISW=1, then D is a scalar that serves as an error estimate for every single data item.
S
Contains the value for smoothing. S must be non-negative. Larger values for S yield greater smoothing. A reasonable value is REAL(N).
EPS
Contains a tolerance value for the relative precision to which S should be interpreted. EPS must be between 0. and 1. inclusive. A reasonable value is SQRT(2./REAL(N)).
YS
An array of length N.
YSP
An array of length N.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.
TEMP
Scratch space.
IER
An error return value. If IER is returned as 0, then no errors were detected.
= 1 if N is less than 2.
= 2 if S is negative.
= 3 if EPS is negative or greater than 1.
= 4 if X values are not strictly increasing.
= 5 if D is negative.

CURVPS - calculate values for a smoothing spline

This subroutine calculates certain values that are used by CURVP2 in order to compute an interpolatory smoothing spline under tension through a sequence of functional values for a periodic function. The actual computation of the interpolated values must be done using CURVP2.

Three parameters are used to control the degree of smoothness -- D, S, and EPS.

The parameter D is a value indicating the degree of confidence in the accuracy of the input function values -- it should be an approximation of the standard deviation of error. Effectively the value of D controls how close the smoothed curve comes to the input data points. If D is small then the interpolated curve will pass close to the input data. The larger the value of D, the more freedom the smooth curve has in how close it comes to the input data values.

S is a more subtle global smoothing parameter. S must be non-negative. For small values of S, the curve approximates the tension spline and for larger values of S, the curve is smoother. A reasonable value for S is REAL(N).

EPS controls the precision to which S is interpreted; EPS must be between 0. and 1. inclusive. A reasonable value for EPS is SQRT(2./REAL(N)).

```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL CURVPS (N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
P,       | Real    | Input  |
D,       | Real    | Input  | N
ISW,     | Integer | Input  |
S,       | Real    | Input  |
EPS,     | Real    | Input  |
YS,      | Real    | Output | N
YSP,     | Real    | Output | N
SIGMA,   | Real    | Input  |
TEMP,    | Real    | Input  | N x 11
IER)     | Integer | Output |
--------------------------------------------------------------
```
N
The number of input data values. (N > 1)
X
An array containing the abscissae for the input function.
Y
An array containing the functional values of the input function -- Y(K) is the functional value at X(K) for K=1,N.
P
The period of the function. P must be greater than X(N)-X(1).
D
A user-specified value containing the observed weights. D may either be an array or a scalar, depending on the value of ISW.
ISW
A switch for interpreting the value of D. If ISW=0, then D is an array of length N (an error estimate for each input data value); if ISW=1, then D is a scalar that serves as an error estimate for every single data item.
S
Contains the value for smoothing. S must be non-negative. Larger values for S yield greater smoothing. A reasonable value is REAL(N).
EPS
Contains a tolerance value for the relative precision to which S should be interpreted. EPS must be between 0. and 1. inclusive. A reasonable value is SQRT(2./REAL(N)).
YS
An array of length N.
YSP
An array of length N.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.
TEMP
Scratch space.
IER
An error return value. If IER is returned as 0, then no errors were detected.
= 1 if N is less than 2.
= 2 if S is negative.
= 3 if EPS is negative or greater than 1.
= 4 if X values are not strictly increasing.
= 5 if D is negative.
= 6 if P is less than or equal to X(N)-X(1).

KURV1 - calculate values for KURV2 usage

This subroutine calculates certain values that are used by KURV2 in order to compute an interpolatory spline under tension through a sequence of points in the plane. The actual computation of the interpolated values must be done using KURV2 .
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL KURV1 (N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
SLP1,    | Real    | Input  |
SLPN,    | Real    | Input  |
ISLPSW,  | Integer | Input  |
XP,      | Real    | Output | N
YP,      | Real    | Output | N
TEMP,    | Real    | Input  | N
S,       | Real    | Output | N
SIGMA,   | Real    | Input  |
IER)     | Integer | Output |
--------------------------------------------------------------
```
N
The number of input data values. (N > 1)
X
An array containing the X values of the points.
Y
An array containing the Y values of the points. Adjacent pairs of points must be distinct.
SLP1
A value (in radians) containing the slope at (X(1),Y(1)). The angles are measured counter-clockwise from the X axis and the positive sense of the curve is assumed to be that moving from point 1 to point N. A value for SLP1 may be omitted as indicated by the switch ISLPSW.
SLPN
A value (in radians) containing the slope at (X(N),Y(N)). The angles are measured counter-clockwise from the X axis and the positive sense of the curve is assumed to be that moving from point 1 to point N. A value for SLP2 may be omitted as indicated by the switch ISLPSW.
ISLPSW
A switch to indicate whether the slopes at the end points should be calculated internally.
= 0 if SLP1 and SLPN are user-specified.
= 1 if SLP1 is user-specified, but SLPN calculated internally.
= 2 if SLPN is user-specified, but SLP1 calculated internally.
= 3 if SLP1 and SLPN are internally calculated.
XP
An array of length N.
YP
An array of length N.
TEMP
Scratch space.
S
An array of length N. On output, S contains the polygonal arclengths of the curve.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.
IER
An error return value. If IER is returned as 0, then no errors were detected.
= 1 if N is less than 2.
= 2 if a pair of adjacent points coincide.

KURV2 - does interpolation for parametric curves

The interpolated curve is parameterized by mapping points in the interval [0.,1.] onto the interpolated curve. The resulting curve has a parametric representation both of whose components are splines under tension and functions of the polygonal arc length. The value 0. is mapped onto (X[1],Y[1]) and the value 1. is mapped onto (X[N],Y[N]). KURV1 must be called before calling KURV2.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL KURV2 (T,       | Real    | Input  |
XS,      | Real    | Output |
YS,      | Real    | Output |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
XP,      | Real    | Input  | N
YP,      | Real    | Input  | N
S,       | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
T
A value to be mapped to a point on the curve. The interval [0.,1.] is mapped onto the curve such that 0. is mapped to (X(1),Y(1)) and 1. is mapped to (X(N),Y(N)). Values outside of [0.,1.] result in extrapolation.
XS
Contains the X coordinate of the interpolated point that T maps to.
YS
Contains the Y coordinate of the interpolated point that T maps to.
N
The number of input data points. (N > 1)
X
An array containing the X values of the input points.
Y
An array containing the Y values of the input points. Adjacent pairs of points must be distinct.
XP
An array of length N as computed by KURV1.
YP
An array of length N as computed by KURV1.
S
An array of length N containing the polygonal arc lengths of the curve.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

KURVD - interpolation and derivatives for parametric curves

This subroutine behaves like KURV2 except that in addition it returns the first and second derivatives of the component functions in the parameterization. The interval [0.,1.] maps onto a curve in the plane. The resulting curve has a parametric representation both of whose components are splines under tension and functions of the polygonal arc length. KURV1 must be called before calling KURVD.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL KURVD (T,       | Real    | Input  |
XS,      | Real    | Output |
YS,      | Real    | Output |
XST,     | Real    | Output |
YST,     | Real    | Output |
XSTT,    | Real    | Output |
YSTT,    | Real    | Output |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
XP,      | Real    | Input  | N
YP,      | Real    | Input  | N
S,       | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
T
A value to be mapped to a point on the curve. The interval [0.,1.] is mapped onto the curve such that 0. is mapped to (X(1),Y(1)) and 1. is mapped to (X(N),Y(N)). Values outside of [0.,1.] result in extrapolation.
XS
Contains the X coordinate of the point that T maps to.
YS
Contains the Y coordinate of the point that T maps to.
XST
Contains the first derivatives of the X component with respect to T.
YST
Contains the first derivatives of the Y component with respect to T.
XSTT
Contains the second derivatives of the X component with respect to T.
YSTT
Contains the second derivatives of the X component with respect to T.
N
The number of input data points. (N > 1)
X
An array containing the X values of the input points.
Y
An array containing the Y values of the input points. Adjacent pairs of points must be distinct.
XP
An array of length N as computed by KURV1.
YP
An array of length N as computed by KURV1.
S
An array of length N containing the polygonal arc lengths of the curve, as computed by KURV1.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

KURVP1 - calculate values for KURVP2 usage

This subroutine calculates certain values that are used by KURVP2 in order to compute an interpolatory spline under tension through a sequence of points in the plane that form a closed curve. The actual computation of the interpolated values must be done using KURVP2 .
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL KURVP1 (N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
XP,      | Real    | Output | N
YP,      | Real    | Output | N
TEMP,    | Real    | Input  | N x 2
S,       | Real    | Output | N
SIGMA,   | Real    | Input  |
IER)     | Integer | Output |
--------------------------------------------------------------
```
N
The number of input data points. (N > 1)
X
An array containing the X values of the points.
Y
An array containing the Y values of the points. Adjacent pairs of points must be distinct.
XP
An array of length N.
YP
An array of length N.
TEMP
Scratch space.
S
An array of length N.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.
IER
An error return value. If IER is returned as 0, then no errors were detected.
= 1 if N is less than 2.
= 2 if a pair of adjacent points coincide.

KURVP2 - does interpolation for closed parametric curves

The interpolated curve is parameterized by mapping points in the interval [0.,1.] onto an interpolated closed curve. The resulting curve has a parametric representation both of whose components are splines under tension and functions of the polygonal arc length. The value 0. is mapped onto (X[1],Y[1]) and the value 1. is also mapped onto (X[1],Y[1]), since the interpolated curve is closed. KURVP1 must be called before calling KURVP2.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL KURVP2 (T,       | Real    | Input  |
XS,      | Real    | Output |
YS,      | Real    | Output |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
XP,      | Real    | Input  | N
YP,      | Real    | Input  | N
S,       | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
T
A value to be mapped to a point on the curve. The interval [0.,1.] is mapped onto the curve such that 0. is mapped to (X(1),Y(1)) and 1. is mapped to (X(1),Y(1)), since the interpolated curve is closed. Any interval [TT,TT+1.] maps onto the entire curve.
XS
Contains the X coordinate of the point that T maps to.
YS
Contains the Y coordinate of the point that T maps to.
N
The number of input data points. (N > 1)
X
An array containing the X values of the points.
Y
An array containing the Y values of the points. Adjacent pairs of points must be distinct.
XP
An array of length N as computed by KURV1.
YP
An array of length N as computed by KURV1.
S
An array of length N containing the polygonal arc lengths of the curve, as computed by KURV1.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

KURVPD - interpolation and derivatives for closed parametric curves

This subroutine behaves like KURVP2 except that in addition it returns the first and second derivatives of the component functions in the parameterization. The interval [0.,1.] maps onto a closed curve in the plane. The resulting curve has a parametric representation both of whose components are splines under tension and functions of the polygonal arc length. KURVP1 must be called before calling KURVPD.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL KURVPD (T,       | Real    | Input  |
XS,      | Real    | Output |
YS,      | Real    | Output |
XST,     | Real    | Output |
YST,     | Real    | Output |
XSTT,    | Real    | Output |
YSTT,    | Real    | Output |
N,       | Integer | Input  |
X,       | Real    | Input  | N
Y,       | Real    | Input  | N
XP,      | Real    | Input  | N
YP,      | Real    | Input  | N
S,       | Real    | Input  | N
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
T
A value to be mapped to a point on the curve. The interval [0.,1.] is mapped onto the curve such that 0. is mapped to (X(1),Y(1)) and 1. is mapped to (X(1),Y(1)). Any interval [TT,TT+1.] maps onto the entire closed curve.
XS
Contains the X coordinate of the point that T maps to.
YS
Contains the Y coordinate of the point that T maps to.
XST
Contains the first derivatives of the X component with respect to T.
YST
Contains the first derivatives of the Y component with respect to T.
XSTT
Contains the second derivatives of the X component with respect to T.
YSTT
Contains the second derivatives of the X component with respect to T.
N
The number of input data points. (N > 1)
X
An array containing the X values of the input points.
Y
An array containing the Y values of the input points. Adjacent pairs of points must be distinct.
XP
An array of length N as computed by KURVP1.
YP
An array of length N as computed by KURVP1.
S
An array of length N containing the polygonal arc lengths of the curve, as computed by KURVP1.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

SURF1 - calculate values for SURF2 usage

This subroutine calculates certain values that are used by SURF2 in order to compute an interpolatory surface passing through a rectangular grid of function values. The surface computed is a tensor product of splines under tension. To calculate actual interpolated values, SURF2 must be called.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
CALL SURF1 (M,       | Integer | Input  |
N,       | Integer | Input  |
X,       | Real    | Input  | M
Y,       | Real    | Input  | N
Z,       | Real    | Input  | IZ x N
IZ,      | Integer | Input  |
ZX1,     | Real    | Input  | N
ZXM,     | Real    | Input  | N
ZY1,     | Real    | Input  | M
ZYN,     | Real    | Input  | M
ZXY11,   | Real    | Input  |
ZXYM1,   | Real    | Input  |
ZXY1N,   | Real    | Input  |
ZXYMN,   | Real    | Input  |
ISLPSW,  | Integer | Input  |
ZP,      | Real    | Output | M x N x 3
TEMP,    | Real    | Input  | N + N + M
SIGMA,   | Real    | Input  |
IER)     | Integer | Output |
--------------------------------------------------------------
```
M
The number of grid lines in the X direction. (M > 1)
N
The number of grid lines in the Y direction. (N > 1)
X
An array containing M X coordinates for grid lines in the X direction. These values must be strictly increasing.
Y
An array containing N Y coordinates for grid lines in the Y direction. These values must be strictly increasing.
Z
An array containing M x N functional values at the grid points; Z(I,J) contains the functional value at (X(I),Y(J)) for I=1,M and J=1,N.
IZ
The row dimension of the matrix Z (IZ is greater than or equal to M).
ZX1
An array containing N X-partial derivatives of the function along the line X(1), that is ZX1(J) is the X-partial derivative at point (X(1),Y(J)) for J=1,N. This parameter may be defaulted by setting ISLPSW appropriately.
ZXM
An array containing N X-partial derivatives of the function along the line X(M), that is ZXM(J) is the X-partial derivative at point (X(M),Y(J)) for J=1,N. This parameter may be defaulted by setting ISLPSW appropriately.
ZY1
An array containing M Y-partial derivatives of the function along the line Y(1), that is ZY1(I) is the Y-partial derivative at point (X(I),Y(1)) for I=1,M. This parameter may be defaulted by setting ISLPSW appropriately.
ZYN
An array containing M Y-partial derivatives of the function along the line Y(N), that is ZY1(I) is the Y-partial derivative at point (X(I),Y(N)) for I=1,M. This parameter may be defaulted by setting ISLPSW appropriately.
ZXY11
The X-Y-partial derivative at (X(1),Y(1). This parameter may be defaulted by setting ISLPSW appropriately.
ZXYM1
The X-Y-partial derivative at (X(M),Y(1). This parameter may be defaulted by setting ISLPSW appropriately.
ZXY1N
The X-Y-partial derivative at (X(1),Y(N). This parameter may be defaulted by setting ISLPSW appropriately.
ZXYMN
The X-Y-partial derivative at (X(M),Y(N). This parameter may be defaulted by setting ISLPSW appropriately.
ISLPSW
A switch to indicate which boundary derivatives are user supplied and which should be estimated internally. Where

I1 = 0 if ZX1 is user-supplied and 1 otherwise.
I2 = 0 if ZXM is user-supplied and 1 otherwise.
I3 = 0 if ZY1 is user-supplied and 1 otherwise.
I4 = 0 if ZYN is user-supplied and 1 otherwise.
I5 = 0 if ZXY11 is user-supplied and 1 otherwise.
I6 = 0 if ZXYM1 is user-supplied and 1 otherwise.
I7 = 0 if ZXY1N is user-supplied and 1 otherwise.
I8 = 0 if ZXYMN is user-supplied and 1 otherwise.

set ISLPSW = I1 + 2*I2 + 4*I3 +8*I4 +16*I5 +32*I6 + 64*I7 + 128*I8. Then, for example, if ISLPSW=0, then all derivative information is user-supplied and if ISLPSW=255, then all derivative information is to be internally estimated.

ZP
An array of size M x N x 3. On output this contains partial derivatives of the surface at the given nodes. ZP is used by SURF2.
TEMP
Scratch space.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.
IER
An error return value. If IER is returned as 0, then no errors were detected.
= 1 if N is less than 2.
= 2 if X or Y values are not strictly increasing.

SURF2 - 2D interpolation for gridded data

This function interpolates a surface value at a specified coordinate using bi-splines under tension. SURF1 must be called before invoking SURF2. The desired interpolated value is returned as the value of the function.
```--------------------------------------------------------------
Argument | Type    |  Mode  | Dimension
--------------------------------------------------------------
FUNCTION SURF2 (XX,      | Real    | Input  |
YY,      | Real    | Input  |
M,       | Integer | Input  |
N,       | Integer | Input  |
X,       | Real    | Input  | M
Y,       | Real    | Input  | N
Z,       | Real    | Input  | IZ x N
IZ,      | Integer | Input  |
ZP,      | Real    | Input  | M x N x 3
SIGMA)   | Real    | Input  |
--------------------------------------------------------------
```
XX
Contains the X coordinate of a point to be mapped onto the interpolated surface.
YY
Contains the Y coordinate of a point to be mapped onto the interpolated surface.
M
The number of grid lines in the X direction. (M > 1)
N
The number of grid lines in the Y direction. (N > 1)
X
An array containing M X coordinates for grid lines in the X direction. These values must be strictly increasing.
Y
An array containing N Y coordinates for grid lines in the Y direction. These values must be strictly increasing.
Z
An array containing M x N functional values at the grid points; Z(I,J) contains the functional value at (X(I),Y(J)) for I=1,M and J=1,N.
IZ
The row dimension of the matrix Z (IZ is greater than or equal to M).
ZP
An array of size M x N x 3.
SIGMA
Tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1.

c_ftcurv - 1D interpolation for non-periodic functions

This function calculates an interpolatory spline under tension through a sequence of functional values.

c_ftcurv is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. Control parameters that apply to c_ftcurv are: sig, sl1, sln, sf1.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

The values for sl1 and sln specify the slope of the curve at the first point and last point, respectively.

The value of sf1 controls whether to use the values for sl1 and sln, or compute those values internally. Specifically, sf1

= 0 if sl1 and sln are user-specified.
= 1 if sl1 is user-specified, but sln is internally calculated.
= 2 if sln is user-specified, but sl1 is internally calculated.
= 3 if sl1 and sln are internally calculated.
By default the slopes at the end points are computed internally.

Function prototype:

```  int c_ftcurv (int, float [], float [], int, float [], float []);
```
Return value:

c_ftcurv returns an error value as per:

= 0 -- no error.
= 1 -- if n is less than 2.
= 2 -- if X values are not strictly increasing.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftcurv (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
m,       | int      |
xo,      | float [] | m
yo       | float [] | m
);
-------------------------------------------------
```
n
The number of input data points. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values of the input function -- yi[k] is the functional value at xi[k] for k=0,n-1.
m
The number of desired interpolated values.
xo
An array containing the abscissae for the interpolated values.
yo
An array containing the interpolated functional values -- yo[k] is the functional value at xo[k] for k=0,n.

c_ftcurvd - calculate derivatives

This function calculates the derivatives of an interpolatory spline under tension.

c_ftcurvd is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. Control parameters that apply to c_ftcurvd are: sig, sl1, sln, sf1.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

The values for sl1 and sln specify the slope of the curve at the first point and last point, respectively.

The value of sf1 controls whether to use the values for sl1 and sln, or compute those values internally. Specifically, sf1

= 0 if sl1 and sln are user-specified.
= 1 if sl1 is user-specified, but sln is internally calculated.
= 2 if sln is user-specified, but sl1 is internally calculated.
= 3 if sl1 and sln are internally calculated.
By default the slopes at the end points are computed internally.

Function prototype:

```  int c_ftcurvd (int, float [], float [], int, float [], float []);
```
Return value:

c_ftcurvd returns an error value as per:

= 0 -- no error.
= 1 -- if N is less than 2.
= 2 -- if X values are not strictly increasing.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftcurvd (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
m,       | int      |
xo,      | float [] | m
yo       | float [] | m
);
-------------------------------------------------
```
n
The number of input data points. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values (y[k] is the functional value at x[k] for k=0,n).
m
The number of desired derivatives.
xo
An array containing the abscissae for the output points.
yo
An array containing the interpolated derivative values -- yo[k] is the functional derivative at xo[k] for k=0,n.

c_ftcurvi - calculate integrals

This function calculates integrals of an interpolatory spline under tension between two user-specified limits.

c_ftcurvi is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. Control parameters that apply to c_ftcurvd are: sig, sl1, sln, sf1.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

The values for sl1 and sln specify the slope of the curve at the first point and last point, respectively.

The value of sf1 controls whether to use the values for sl1 and sln, or compute those values internally. Specifically, sf1

= 0 if sl1 and sln are user-specified.
= 1 if sl1 is user-specified, but sln is internally calculated.
= 2 if sln is user-specified, but sl1 is internally calculated.
= 3 if sl1 and sln are internally calculated.
By default the slopes at the end points are computed internally.

Function prototype:

```  int c_ftcurvi (float, float, int, float [], float [], float *);
```
Return value:

c_ftcurvi returns an error value as per:

= 0 -- no error.
= 1 -- if n is less than 2.
= 2 -- if X values are not strictly increasing.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftcurvi (xl,      | float    |
xr,      | float    |
n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
integral | float *  |
);
-------------------------------------------------
```
xl
The lower limit of the integration.
xr
The upper limit of the integration.
n
The number of input data points. (N > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values of the input function (y[k] is the functional value at x[k] for k=0,n).
integral
The integral of the function from xl to xr is given by *integral.

c_ftcurvp - 1D interpolation for periodic functions

This function calculates an interpolatory spline under tension through a sequence of functional values for a periodic function.

c_ftcurvp is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. The only control parameter that applies to c_ftcurvp is: sig.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

Function prototype:

```  int c_ftcurvp (int, float [], float [], float, int, float [], float []);
```
Return value:

c_ftcurvp returns an error value as per:

= 0 -- no error.
= 1 -- if n is less than 2.
= 2 -- if the period is strictly less than the span of the abscissae.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftcurvp (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
p,       | float    |
m,       | int      |
xo,      | float [] | m
yo       | float [] | m
);
-------------------------------------------------
```
n
The number of input data points. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the input functional values (y[k] is the functional value at x[k] for k=0,n).
p
The period of the function; p must not be less than xi[n-1] - xi[0].
m
The number of desired interpolated points.
xo
An array containing the abscissae for the interpolated values.
yo
An array containing the interpolated functional values (yo[k] is the functional value at xo[k] for k=0,n).

c_ftcurvpi - calculate integrals for periodic functions

This function calculates an integral between two specified points.

c_ftcurvpi is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. The only control parameter that applies to c_ftcurvpi is: sig.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

Function prototype:

```  int c_ftcurvpi (float, float, float, int, float [], float [], float *);
```
Return value:

c_ftcurpi returns an error value as per:

= 0 -- no error.
= 1 -- if n is less than 2.
= 2 -- if the period is strictly less than the span of the abscissae.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftcurvpi (xl,      | float    |
xr,      | float    |
p,       | float    |
m,       | int      |
xi,      | float [] | m
yi,      | float [] | m
integral | float *  |
);
-------------------------------------------------
```
xl
The lower limit of the integration.
xr
The upper limit of the integration.
p
The period of the function; p must not be less than xi[n-1] - xi[0].
m
The number of input points.
xi
An array containing the abscissae for the input points.
yi
An array containing the values of the input points (yi[k] is the functional value at xi[k] for k=0,n).
integral
The desired integral value is returned in *integral.

c_ftcurvs - smoothing spline

This function computes an interpolatory smoothing spline under tension through a sequence of functional values.

Two parameters and one function argument used to control the degree of smoothness -- the parameters are smt, and eps and the function argument is d.

The argument d is a value indicating the degree of confidence in the accuracy of the input function values -- it should be an approximation of the standard deviation of error. Effectively the value of d controls how close the smoothed curve comes to the input data points. If d is small, then the interpolated curve will pass close to the input data. The larger the value of d, the more freedom the smooth curve has in how close it comes to the input data values.

The parameter smt is a more subtle global smoothing parameter; smt must be non-negative. For small values of smt, the curve approximates the tension spline and for larger values of smt, the curve is smoother. A reasonable value for smt is (float) n.

The parameter eps controls the precision to which smt is interpreted; eps must be between 0. and 1. inclusive. A reasonable value for eps is sqrt( 2./(float) n ).

c_ftcurvs is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. Control parameters that apply to c_ftcurvs are: sig, smt, eps, sf2.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

Function prototype:

```   int c_ftcurvs (int, float [], float [], int, float [], int,
float [], float []);
```
Return value:

c_ftcurvs returns an error value as per:

= 1 if N is less than 2.
= 2 if smt is negative.
= 3 if eps is negative or greater than 1.
= 4 if X values are not strictly increasing.
= 5 if d is negative.

Argument description:

```--------------------------------------------------------------
Argument | Type     |  size
--------------------------------------------------------------
int c_ftcurvs (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
dflg,    | int      |
d,       | float [] | n
m,       | int      |
xo,      | float [] | m
yo       | float [] | m
);
--------------------------------------------------------------
```
n
The number of input data points. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values of the input function (yi[k] is the functional value at x[k] for k=0,n-1).
dflg
A switch for interpreting the value of d (as described below). If dflg=0, then d is an array of length n (an error estimate for each input data value); if dflg=1, then d is a scalar that serves as an error estimate for every single data item.
d
A user-specified value containing the observed weights. d may either be an array or a scalar, depending on the value of dflg.
m
The number of output values.
xo
Contains the abscissae for the output values.
yo
Contains the functional values for the smoothing spline ((yo[k] is the functional value at xo[k] for k=0,n-1).

c_ftcurvps - smoothing spline for periodic functions

This function computes an interpolatory smoothing spline under tension through a sequence of functional values for a periodic function.

Two parameters and one function argument used to control the degree of smoothness -- the parameters are smt, and eps and the function argument is d.

The argument d is a value indicating the degree of confidence in the accuracy of the input function values -- it should be an approximation of the standard deviation of error. Effectively the value of d controls how close the smoothed curve comes to the input data points. If d is small, then the interpolated curve will pass close to the input data. The larger the value of d, the more freedom the smooth curve has in how close it must come to the input data values.

The parameter smt is a more subtle global smoothing parameter; smt must be positive. For small values of smt, the curve approximates the tension spline and for larger values of smt, the curve is smoother. A reasonable value for smt is (float) n.

The parameter eps controls the precision to which smt is interpreted; eps must be between 0. and 1. inclusive. A reasonable value for eps sqrt( 2./(float) n ).

c_ftcurvps is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. Control parameters that apply to c_ftcurvps are: sig, smt, eps, sf2.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

Function prototype:

```   int c_ftcurvps (int, float [], float [], float, int, float [], int,
float [], float []);
```
Return value:

c_ftcurvps returns an error value as per:

= 1 if N is less than 2.
= 2 if smt is negative.
= 3 if eps is negative or greater than 1.
= 4 if X values are not strictly increasing.
= 5 if d is negative.

Argument description:

```--------------------------------------------------------------
Argument | Type     |  size
--------------------------------------------------------------
int c_ftcurvps (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
p,       | float    |
dflg,    | int      |
d,       | float [] | n
m,       | m        |
xo,      | float [] | m
yo       | float [] | m
);
--------------------------------------------------------------
```
n
The number of input data values. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values of the input function (yi[k] is the functional value at x[k] for k=0,n-1).
p
The period of the function.
dflg
A switch for interpreting the value of the argument d (described below). If dflg=0, then d is an array of length n (an error estimate for each input data value); if dflg=1, then d is a scalar that serves as an error estimate for every single data item.
d
A user-specified value containing the observed weights. d may either be an array or a scalar, depending on the value of dflg.
m
The number of output values.
xo
Contains the abscissae for the output values.
yo
Contains the functional values for the smoothing spline ((yo[k] is the functional value at xo[k] for k=0,m-1).

c_ftkurv - interpolation for parametric curves

This function calculates an interpolatory spline under tension through a sequence of points in the plane.

Given a sequence of input points ( (x[0],y[0]), ... , (x[n-1],y[n-1]), the interpolated curve is parameterized by mapping points in the interval [0.,1.] onto the interpolated curve. The resulting curve has a parametric representation both of whose components are splines under tension and functions of the polygonal arc length. The value 0. is mapped onto (x[0],y[0]) and the value 1. is mapped onto (x[n-1],y[n-1]).

c_ftkurv is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. Control parameters that apply to c_ftkurv are: sig, sl1, sln, sf1.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

The value for parameter sl1 is in radians and contains the slope at (x[0],y[0]). The angle is measured counter-clockwise from the X axis and the positive sense of the curve is assumed to be that moving from point 0 to point n-1. A value for sl1 may be omitted as indicated by the switch sf1.

The value for parameter sln is in radians and contains the slope at (x[n-1],y[n-1]). The angle is measured counter-clockwise from the X axis and the positive sense of the curve is assumed to be that moving from point 0 to point n-1. A value for sln may be omitted as indicated by the switch sf1.

The value of sf1 controls whether to use the values for sl1 and sln, or compute those values internally. Specifically, sf1

= 0 if sl1 and sln are user-specified.
= 1 if sl1 is user-specified, but sln is internally calculated.
= 2 if sln is user-specified, but sl1 is internally calculated.
= 3 if sl1 and sln are internally calculated.
By default the slopes at the end points are computed internally.

Function prototype:

```  int c_ftkurv (int, float [], float [], int, float [], float [], float []);
```
Return value:

c_ftkurv returns an error value as per:

= 0 -- no error.
= 1 -- if n is less than 2.
= 2 -- if adjacent coordinate pairs coincide.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftkurv (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
m,       | int      |
t,       | float [] | m
xo,      | float [] | m
yo       | float [] | m
);
-------------------------------------------------
```
n
The number of input data values. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values (y[k] is the functional value at x[k] for k=0,n-1).
m
The number of desired interpolated values.
t
Contains an array of values for the parameter mapping onto the interpolated curve.
xo
An array containing the X values for the interpolated points. t[k] maps to (xo[k],yo[k]) for k=0,m-1.
yo
An array containing the Y values for the interpolated points. t[k] maps to (xo[k],yo[k]) for k=0,m-1.

c_ftkurvp - interpolation for closed parametric curves

This procedure calculates an interpolatory spline under tension through a sequence of points in the plane forming a closed curve.

Given a sequence of distinct input points ( (x[0],y[0]), ... , (x[n-1],y[n-1]), the interpolated curve is parameterized by mapping points in the interval [0.,1.] onto the interpolated curve. The resulting curve has a parametric representation both of whose components are splines under tension and functions of the polygonal arc length. The value 0. is mapped onto (x[0],y[0]) and the value 1. is mapped onto (x[0],y[0]) as well (completing the closed curve).

c_ftkurvp is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. The only control parameter that applies to c_ftkurvp is: sig.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

Function prototype:

```  int c_ftkurvp (int, float [], float [], int, float [], float [], float []);
```
Return value:

c_ftkurvp returns an error value as per:

= 0 -- no error.
= 1 -- if n is less than 2.
= 2 -- if adjacent coordinate pairs coincide.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftkurv (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
m,       | int      |
t,       | float [] | m
xo,      | float [] | m
yo       | float [] | m
);
-------------------------------------------------
```
n
The number of input data points. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values (y[k] is the functional value at x[k] for k=0,n-1).
m
The number of desired interpolated points.
t
Contains an array of values for the parameter mapping onto the interpolated curve. Any interval [tt,tt+1.] maps onto the entire curve.
xo
An array containing the X values for the interpolated points. t[k] maps to (xo[k],yo[k]) for k=0,n-1.
yo
An array containing the Y values for the interpolated points.

c_ftkurvd - calculate interpolated values and derivatives for parametric curves

This procedure behaves like ftkurv except that in addition it returns the first and second derivatives of the component functions in the parameterization.

Given a sequence of input points ( (x[0],y[0]), ... , (x[n-1],y[n-1]), the interpolated curve is parameterized by mapping points in the interval [0.,1.] onto the interpolated curve. The resulting curve has a parametric representation both of whose components are splines under tension and functions of the polygonal arc length. The value 0. is mapped onto (x[0],y[0]) and the value 1. is mapped onto (x[n-1],y[n-1]).

c_ftkurvd is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. Control parameters that apply to c_ftkurvd are: sig, sl1, sln, sf1.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

The value for parameter sl1 is in radians and contains the slope at (x[0],y[0]). The angle is measured counter-clockwise from the X axis and the positive sense of the curve is assumed to be that moving from point 0 to point n-1. A value for sl1 may be omitted as indicated by the switch sf1.

The value for parameter sln is in radians and contains the slope at (x[n-1],y[n-1]). The angle is measured counter-clockwise from the X axis and the positive sense of the curve is assumed to be that moving from point 0 to point n-1. A value for sln may be omitted as indicated by the switch sf1.

The value of sf1 controls whether to use the values for sl1 and sln, or compute those values internally. Specifically, sf1

= 0 if sl1 and sln are user-specified.
= 1 if sl1 is user-specified, but sln is internally calculated.
= 2 if sln is user-specified, but sln is internally calculated.
= 3 if sl1 and sln are internally calculated.
By default the slopes at the end points are computed internally.

Function prototype:

```  int c_ftkurvd (int, float [], float [], int, float [], float [], float [],
float [], float [], float [], float []);
```
Return value:

c_ftkurvd returns an error value as per:

= 0 -- no error.
= 1 -- if n is less than 2.
= 2 -- if adjacent coordinate pairs coincide.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftkurvd (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
m,       | int      |
t,       | float [] | m
xo,      | float [] | m
yo,      | float [] | m
xd,      | float [] | m
yd,      | float [] | m
xdd,     | float [] | m
ydd      | float [] | m
);
-------------------------------------------------
```
n
The number of input data points. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values (y[k] is the functional value at x[k] for k=0,n).
m
The number of desired interpolated points.
t
Contains an array of values for the parameter mapping onto the interpolated curve.
xo
An array containing the X values for the interpolated points. t[k] maps to (xo[k],yo[k]) for k=0,n-1.
yo
An array containing the Y values for the interpolated points.
xd
Contains the first derivatives of the X component with respect to t.
yd
Contains the first derivatives of the Y component with respect to t.
xdd
Contains the second derivatives of the X component with respect to t.
ydd
Contains the second derivatives of the Y component with respect to t.

c_ftkurvpd - interpolation and derivative calculation for closed parametric curves

This procedure behaves like ftkurvp except that in addition it returns the first and second derivatives of the component functions in the parameterization.

Given a sequence of distinct input points ( (x[0],y[0]), ... , (x[n-1],y[n-1]), the interpolated curve is parameterized by mapping points in the interval [0.,1.] onto the interpolated curve. The resulting curve has a parametric representation both of whose components are splines under tension and functions of the polygonal arc length. The value 0. is mapped onto (x[0],y[0]) and the value 1. is mapped onto (x[0],y[0]) as well (completing the closed curve).

c_ftkurvpd is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc. The only control parameter that applies to c_ftkurvpd is: sig.

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

Function prototype:

```  int c_ftkurvpd (int, float [], float [], int, float [], float [], float [],
float [], float [], float [], float []);
```
Return value:

c_ftkurvpd returns an error value as per:

= 0 -- no error.
= 1 -- if n is less than 2.
= 2 -- if adjacent coordinate pairs coincide.

Argument description:

```-------------------------------------------------
Argument | Type     |  Size
-------------------------------------------------
int c_ftkurvpd (n,       | int      |
xi,      | float [] | n
yi,      | float [] | n
m,       | int      |
t,       | float [] | m
xo,      | float [] | m
yo       | float [] | m
xd,      | float [] | m
yd       | float [] | m
xdd,     | float [] | m
ydd      | float [] | m
);
-------------------------------------------------
```
n
The number of input data values. (n > 1)
xi
An array containing the abscissae for the input function.
yi
An array containing the functional values (y[k] is the functional value at x[k] for k=0,n-1).
m
The number of desired interpolated points.
t
Contains an array of values for the parameter mapping onto the interpolated curve. Any interval [tt,tt+1.] maps onto the entire curve.
xo
An array containing the X values for the interpolated points. t[k] maps to (xo[k],yo[k]) for k=0,n-1.
yo
An array containing the Y values for the interpolated points.
xd
Contains the first derivatives of the X component with respect to t.
yd
Contains the first derivatives of the Y component with respect to t.
xdd
Contains the second derivatives of the X component with respect to t.
ydd
Contains the second derivatives of the Y component with respect to t.

c_ftsurf - 2D tension spline interpolation of rectangular data

This procedure calculates an interpolatory surface passing through a rectangular grid of function values. The surface computed is a tensor product of splines under tension.

c_ftsurf is called after all of the desired values for control parameters have been set using the procedures c_ftseti, c_ftsetr, c_ftsetc, c_ftsetfa. The control parameters that apply to c_ftsurf are: sig, zx1, zxm, zy1, zyn, z11, zm1, z1n, zmn, df1, df2, df3, df4, df5, df6, df7, df8

The value for the parameter sig specifies the tension factor. Values near zero result in a cubic spline; large values (e.g. 50) result in nearly a polygonal line. A typical value is 1. (the default).

zx1 is an array containing ni X-partial derivatives of the function along the line xi[0], that is zx1[j] is the X-partial derivative at point (x[0],y[j]) for j=0,ni-1. This parameter may be defaulted by setting the value for df1 appropriately. The default is to compute zx1 internally. Values for zx1 can be set using the procedure c_ftsetfa.

zxm is an array containing ni X-partial derivatives of the function along the line xi[mi-1], that is zxm[j] is the X-partial derivative at point (xi[mi-1],yi[j]) for j=0,ni-1. This parameter may be defaulted by setting the value for df2 appropriately. The default is to compute zx2 internally. Values for zxm can be set using the procedure c_ftsetfa.

zy1 is an array containing mi Y-partial derivatives of the function along the line yi[0], that is zy1[j] is the Y-partial derivative at point (x[i],y[0]) for i=0,mi-1. This parameter may be defaulted by setting the value for df3 appropriately. The default is to compute zy1 internally. Values for zy1 can be set using the procedure c_ftsetfa.

zyn is an array containing mi Y-partial derivatives of the function along the line yi[ni-1], that is zyn[j] is the Y-partial derivative at point (x[i],y[ni-1]) for i=0,mi-1. This parameter may be defaulted by setting the value for df4 appropriately. The default is to compute zyn internally. Values for zyn can be set using the procedure c_ftsetfa.

z11, zm1, z1n, zmn specify X-Y-partial derivatives of the function at the four corners (xi[0],yi[0]), (xi[mi-1],yi[0]), (xi[0],yi[ni-1]), (xi[mi-1],yi[ni-1]), These parameters may be defaulted by setting the values for df5, df6, df7, df8, appropriately. The default is to compute z11, zm1, z1n, zmn internally.

Function prototype:

```  float *c_ftsurf (int, int, float *, float *, float *,
int, int, float *, float *, int *);
```
Return value:

c_ftsurf returns a pointer to an array containing mo x no floats which are the interpolated values on the grid specified by the arrays xo and yo.

Argument description:

```---------------------------------------------------------------
Argument | Type     |  Size
---------------------------------------------------------------
float *c_ftsurf (mi,      | int      |
ni,      | int      |
xi,      | float *  | pointer to m floats
yi,      | float *  | pointer to n floats
zi,      | float *  | pointer to m * n floats
mo,      | int      |
no,      | int      |
xo,      | float *  | pointer to mo floats
yo,      | float *  | pointer to no floats
ier      | int *    |
);
---------------------------------------------------------------
```
mi
The number of grid lines in the X direction. (mi > 1)
ni
The number of grid lines in the Y direction. (ni > 1)
xi
Pointer to an array containing mi X coordinates for grid lines in the X direction.
yi
Pointer to an array containing ni Y coordinates for grid lines in the Y direction.
zi
Pointer to mi x ni floats which are the functional values at the grid points defined by xi and yi.
mo
The number of output values in the X direction.
no
The number of output values in the Y direction.
xo
Pointer to an array containing mo X coordinates for grid lines in the X direction in the output interpolation grid.
xo
Pointer to an array containing no Y coordinates for grid lines in the Y direction in the output interpolation grid.
ier
The value *ier is an error flag as per:
= 0 -- no error.
= 1 -- if n is less than 2 or m is less than 2.
= 2 -- if X or Y values are not strictly increasing.

c_ftseti - Set int valued parameters

c_ftseti is used to set values for any of the control parameters that take int values. The values set by c_ftseti remain in effect until changed by subsequent calls to c_ftseti.

Function prototype:

```  void c_ftseti(char *, int);
```
Argument description:
```-------------------------------------------
Argument | Type    |  Size
-------------------------------------------
void c_ftseti (pnam,   | char *  |
ival);  | int     |
-------------------------------------------
```
pnam
The name of the control parameter to be assigned an int value.
ival
The value to be assigned to the control parameter whose name is pointed to by pnam.

c_ftgeti - Retrieve an int valued parameter

c_ftgeti is a called to obtain current values for any of the int valued control parameters.

Function prototype:

```  void c_ftgeti(char *, int *);
```
Argument description:
```-------------------------------------------
Argument | Type    |  Size
-------------------------------------------
void c_ftgeti (pnam,   | char *  |
ival);  | int  *  |
-------------------------------------------
```
pnam
The name of the control parameter whose value is to be retrieved.
ival
*ival will be the value currently assigned to the control parameter whose name is pointed to by pnam.

c_ftsetr - Set float valued parameters

c_ftsetr is used to set values for any of the control parameters that take float values. The values set by c_ftsetr remain in effect until changed by subsequent calls to c_ftsetr.

Function prototype:

```  void c_ftsetr(char *, float);
```
Argument description:
```-------------------------------------------
Argument | Type    |  Size
-------------------------------------------
void c_ftsetr (pnam,   | char *  |
fval);  | float   |
-------------------------------------------
```
pnam
The name of the control parameter to be assigned a float value.
fval
The value to be assigned to the control parameter whose name is pointed to by pnam.

c_ftgetr - Retrieve a float valued parameter

c_ftgetr is a called to obtain current values for any of the float valued control parameters.

Function prototype:

```  void c_ftgetr(char *, float *);
```
Argument description:
```-------------------------------------------
Argument | Type    |  Size
-------------------------------------------
void c_ftgetr (pnam,   | char *  |
fval);  | float * |
-------------------------------------------
```
pnam
The name of the control parameter whose value is to be retrieved.
fval
*fval will be the value currently assigned to the control parameter whose name is pointed to by pnam.

c_ftsetc - Set char valued parameters

c_ftsetc is used to set values for any of the control parameters that take string values. The values set by c_ftsetc remain in effect until changed by subsequent calls to c_ftsetc.

Function prototype:

```  void c_ftsetc(char *, char *);
```
Argument description:
```-------------------------------------------
Argument | Type    |  Size
-------------------------------------------
void c_ftsetc (pnam,   | char *  |
cval);  | char *  |
-------------------------------------------
```
pnam
The name of the control parameter to be assigned a char value.
cval
The value to be assigned to the control parameter whose name is pointed to by pnam.

c_ftgetc - Retrieve a char valued parameter

c_ftgetc is a called to obtain current values for any of the string valued control parameters.

Function prototype:

```  void c_ftgetc(char *, char *);
```
Argument description:
```-------------------------------------------
Argument | Type    |  Size
-------------------------------------------
void c_ftgetc (pnam,   | char *  |
cval);  | char *  |
-------------------------------------------
```
pnam
The name of the control parameter whose value is to be retrieved.
cval
cval will point to a string containing the returned value. The user is required to reserve enough space to store the string.

c_ftsetfa - Set float valued array parameters

c_ftsetra is used to set values for any of the control parameters that take floating arrays. The values set by c_ftsetfa remain in effect until changed by subsequent calls to c_ftsetfa

Function prototype:

```  int c_ftsetfa(char *pnam, int n, float *far);
```
Argument description:
```-------------------------------------------
Argument | Type    |  Size
-------------------------------------------
int c_ftsetfa (pnam,   | char *  |
n,      | int     |
far);   | float * |
-------------------------------------------
```
pnam
The name of the control parameter to be assigned a float array value.
n
The number of float values in the array.
far
A pointer to the n-element input array.

c_ftgetfa_size - Retrieve the size of an array

c_ftgetfa_size is a called to obtain current sizes for any of the float valued control parameters.

Function prototype:

```  int c_ftgetfa_size(char *);
```
Return value:

c_ftgetfa_size returns the size of the array (or returns a zero if an error occurs).

Argument description:

```----------------------------------------------
Argument | Type    |  Size
----------------------------------------------
int c_ftgetfa_size (pnam   | char *  |
);     |         |
----------------------------------------------
```
pnam
The name of the control parameter whose value is to be retrieved.

c_ftgetfa_data - Retrieve array values

c_ftgetfa_data is a called to obtain current values for any of the float valued array control parameters.

Function prototype:

```  float *c_ftgetfa_data(char *);
```
Return value:

c_ftgetfa_data returns a pointer to a array of data (or returns a -1 if an error occurs). The size of the array can be obtained by using c_ftgetfa_size.

Argument description:

```------------------------------------------------
Argument | Type    |  Size
------------------------------------------------
float *c_ftgetfa_data (pnam)   | char *  |
------------------------------------------------
```
pnam
The name of the control parameter whose value is to be retrieved.

home | contents | defs | params | procedures | exmpls