e01bf evaluates a piecewise cubic Hermite interpolant at a set of points.

# Syntax

C# |
---|

public static void e01bf( int n, double[] x, double[] f, double[] d, int m, double[] px, double[] pf, out int ifail ) |

Visual Basic |
---|

Public Shared Sub e01bf ( _ n As Integer, _ x As Double(), _ f As Double(), _ d As Double(), _ m As Integer, _ px As Double(), _ pf As Double(), _ <OutAttribute> ByRef ifail As Integer _ ) |

Visual C++ |
---|

public: static void e01bf( int n, array<double>^ x, array<double>^ f, array<double>^ d, int m, array<double>^ px, array<double>^ pf, [OutAttribute] int% ifail ) |

F# |
---|

static member e01bf : n : int * x : float[] * f : float[] * d : float[] * m : int * px : float[] * pf : float[] * ifail : int byref -> unit |

#### Parameters

- n
- Type: System..::..Int32An array of size []

- x
- Type: array<System..::..Double>[]()[][]An array of size []

- f
- Type: array<System..::..Double>[]()[][]An array of size []

- d
- Type: array<System..::..Double>[]()[][]An array of size []

- m
- Type: System..::..Int32
*On entry*: $m$, the number of points at which the interpolant is to be evaluated.*Constraint*: ${\mathbf{m}}\ge 1$.

- px
- Type: array<System..::..Double>[]()[][]An array of size [m]
*On entry*: the $m$ values of $x$ at which the interpolant is to be evaluated.

- pf
- Type: array<System..::..Double>[]()[][]An array of size [m]
*On exit*: ${\mathbf{pf}}\left[\mathit{i}-1\right]$ contains the value of the interpolant evaluated at the point ${\mathbf{px}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,m$.

- ifail
- Type: System..::..Int32%
*On exit*: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

e01bf evaluates a piecewise cubic Hermite interpolant, as computed by e01be, at the points ${\mathbf{px}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,m$. If any point lies outside the interval from ${\mathbf{x}}\left[0\right]$ to ${\mathbf{x}}\left[{\mathbf{n}}-1\right]$, a value is extrapolated from the nearest extreme cubic, and a warning is returned.

The method is derived from method PCHFE in Fritsch (1982).

# References

Fritsch F N (1982) PCHIP final specifications

*Report UCID-30194*Lawrence Livermore National Laboratory# Error Indicators and Warnings

Errors or warnings detected by the method:

- ${\mathbf{ifail}}=1$
On entry, ${\mathbf{n}}<2$.

- ${\mathbf{ifail}}=2$
- The values of ${\mathbf{x}}\left[\mathit{r}-1\right]$, for $\mathit{r}=1,2,\dots ,{\mathbf{n}}$, are not in strictly increasing order.

- ${\mathbf{ifail}}=3$
On entry, ${\mathbf{m}}<1$.

- ${\mathbf{ifail}}=4$
- At least one of the points ${\mathbf{px}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{m}}$, lies outside the interval [${\mathbf{x}}\left[0\right],{\mathbf{x}}\left[{\mathbf{n}}-1\right]$], and extrapolation was performed at all such points. Values computed at such points may be very unreliable.

# Accuracy

The computational errors in the array pf should be negligible in most practical situations.

# Parallelism and Performance

None.

# Further Comments

The time taken by e01bf is approximately proportional to the number of evaluation points, $m$. The evaluation will be most efficient if the elements of px are in nondecreasing order (or,
more generally, if they are grouped in increasing order of the intervals $\left[{\mathbf{x}}\left[r-1\right],{\mathbf{x}}\left[r\right]\right]$). A single call of
e01bf with $m>1$ is more efficient than several calls with $m=1$.

# Example

This example reads in values of n, x, f and d, and then calls
e01bf to evaluate the interpolant at equally spaced points.

Example program (C#): e01bfe.cs