XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ pchic()

void pchic ( int  ic[],
double  vc[],
double  sw,
int  n,
double  x[],
double  f[],
double  d[],
int  incfd,
double  work[],
int  lwork,
int *  info 
)

Piecewise cubic Hermite interpolation

Purpose
This routine sets derivatives needed to determine a monotone piecewise cubic Hermite interpolant. User control is available over boundary conditions and/or treatment of points where monotonicity switches direction.

The resulting piecewise cubic Hermite function may be evaluated by pchfe or pchfd.
Parameters
[in]ic[]Array ic[lic] (lic >= 2)
Specification of desired boundary conditions.
ic[0] = Desired condition at beginning of data.
  = 0: The default boundary condition (the same as used by pchim).
  > 0: The boundary derivative is not to be adjusted for monotonicity.
  < 0: The derivative is to be adjusted for monotonicity.
  Allowable values for the magnitude of ic[0] are:
  = 1: if first derivative at x[0] is given in vc[0]
  = 2: if second derivative at x[0] is given in vc[0]
  = 3: to use the 3-point difference formula for d[0] (reverts to the default boundary conditions if n < 3)
  = 4: to use the 4-point difference formula for d[0] (reverts to the default boundary conditions if n < 4)
  = 5: to set d[0] so that the second derivative is continuous at x[1] (reverts to the default boundary conditions if n < 4)
ic[1] = Desired condition at end of data.
  It may take on the same values as ic[0], but applied to derivative at x[n-1]. In the case ic[1] = 1 or 2, the value is given in vc[1].
[in]vc[]Array vc[lvc] (lvc >= 2)
Specification of desired boundary values, as indicated above.
vc[0] need to be set only if ic[0] = 1 or 2.
vc[1] need to be set only if ic[1] = 1 or 2.
[in]swIndicates desired treatment of points where direction of monotonicity switches.
= 0: Interpolant is required to be monotonic in each interval, regardless of monotonicity of data.
!= 0: Use a formula based on the 3-point difference formula in the vicinity of switch points.
> 0: The interpolant on each interval containing an extremum is controlled to not deviate from the data by more than sw*dfloc, where dfloc is the maximum of the change of f[] on this interval and its two immediate neighbors.
< 0: No such control is to be imposed.
[in]nNumber of data points. (n >= 2)
[in]x[]Array x[lx] (lx >= n)
independent variable values. The elements of x[] must be strictly increasing.
[in]f[]Array f[lf] (lf >= incfd*(n - 1) + 1)
Dependent variable values to be interpolated.
[out]d[]Array d[ld] (ld >= incfd*(n - 1) + 1)
Derivative values at the data points.
[in]incfdIncrement between successive values in f[] and d[]. f[i*incfd] and d[i*incfd] are the values corresponding to x[i]. (i = 0 to n - 1)
[out]work[]Array work[lwork]
Work array.
[out]lworkThe size of array work[]. (lwork >= 2*(n - 1))
[out]info= 0: Successful exit
= -1: The argument ic[] had an illegal value (abs(ic[0]) > 5 and/or abs(ic[1]) > 5)
= -4: The argument n had an illegal value (n < 2)
= -5: The argument x[] had an illegal value (not strictly increasing)
= -8: The argument incfd had an illegal value (incfd < 1)
= -10: The argument lwork had an illegal value (lwork < 2*(n-1))
= 1 ic[0] < 0 and d[0] had to be adjusted for monotonicity
= 2 ic[1] < 0 and d[(n-1)*incfd] had to be adjusted for monotonicity
= 3: Both of the above are true
Reference
SLATEC (PCHIP)