NAG CL Interfacee01cfc (dim1_​monconv_​eval)

Settings help

CL Name Style:

1Purpose

e01cfc evaluates a monotonic convex interpolant at a set of points.

2Specification

 #include
 void e01cfc (Integer m, const double x[], double val[], double fwd[], double comm[], NagError *fail)
The function may be called by the names: e01cfc, nag_interp_dim1_monconv_eval or nag_interp_1d_monconv_eval.

3Description

e01cfc evaluates a monotonic convex interpolant, as setup by e01cec, at the points $x$. The function is derived from the work of Hagan and West and is described in Hagan and West (2006), Hagan and West (2008) and West (2011).

4References

Hagan P S and West G (2006) Interpolation methods for curve construction Applied Mathematical Finance 13(2) 89–129
Hagan P S and West G (2008) Methods for constructing a yield curve WILLMOTT Magazine May 70–81
West G (2011) The monotone convex method of interpolation Financial Modelling Agency

5Arguments

1: $\mathbf{m}$Integer Input
On entry: $m$, the number of points at which the interpolant is to be evaluated.
2: $\mathbf{x}\left[{\mathbf{m}}\right]$const double Input
On entry: $x$, the points at which the interpolant is to be evaluated.
3: $\mathbf{val}\left[{\mathbf{m}}\right]$double Output
On exit: the values of the interpolant at $x$.
4: $\mathbf{fwd}\left[{\mathbf{m}}\right]$double Output
On exit: the values of the forward rates at $x$.
5: $\mathbf{comm}\left[\mathit{dim}\right]$double Communication Array
Note: the actual argument supplied must be the array comm supplied to the initialization routine e01cec.
On entry: contains details of the interpolant.
Constraint: comm should not be changed following a call to e01cec.
6: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
Either e01cec was not called first or the communication array has become corrupted.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

7Accuracy

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

8Parallelism and Performance

e01cfc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

e01cfc internally allocates $4n+3$ reals.

10Example

This example reads in a set of data points, calls e01cec to compute a monotonic convex interpolant, and then calls e01cfc to evaluate the interpolant at equally spaced points.

10.1Program Text

Program Text (e01cfce.c)

10.2Program Data

Program Data (e01cfce.d)

10.3Program Results

Program Results (e01cfce.r)