NAG CL Interface
e01cfc (dim1_​monconv_​eval)

Settings help

CL Name Style:


1 Purpose

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

2 Specification

#include <nag.h>
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.

3 Description

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).

4 References

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

5 Arguments

1: m Integer Input
On entry: m, the number of points at which the interpolant is to be evaluated.
2: x[m] const double Input
On entry: x, the points at which the interpolant is to be evaluated.
3: val[m] double Output
On exit: the values of the interpolant at x.
4: fwd[m] double Output
On exit: the values of the forward rates at x.
5: comm[dim] 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: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error 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.
NE_BAD_PARAM
Either e01cec was not called first or the communication array has become corrupted.
On entry, argument 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.

7 Accuracy

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

8 Parallelism 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.

9 Further Comments

e01cfc internally allocates 4n+3 reals.

10 Example

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.1 Program Text

Program Text (e01cfce.c)

10.2 Program Data

Program Data (e01cfce.d)

10.3 Program Results

Program Results (e01cfce.r)