NAG FL Interface
e01cff (dim1_​monconv_​eval)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

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

2 Specification

Fortran Interface
Subroutine e01cff ( m, x, val, fwd, comm, ifail)
Integer, Intent (In) :: m
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: x(m)
Real (Kind=nag_wp), Intent (Inout) :: comm(*)
Real (Kind=nag_wp), Intent (Out) :: val(m), fwd(m)
C Header Interface
#include <nag.h>
void  e01cff_ (const Integer *m, const double x[], double val[], double fwd[], double comm[], Integer *ifail)
The routine may be called by the names e01cff or nagf_interp_dim1_monconv_eval.

3 Description

e01cff evaluates a monotonic convex interpolant, as setup by e01cef, at the points x. The routine 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) Real (Kind=nag_wp) array Input
On entry: x, the points at which the interpolant is to be evaluated.
3: val(m) Real (Kind=nag_wp) array Output
On exit: the values of the interpolant at x.
4: fwd(m) Real (Kind=nag_wp) array Output
On exit: the values of the forward rates at x.
5: comm(*) Real (Kind=nag_wp) array Communication Array
Note: the actual argument supplied must be the array comm supplied to the initialization routine e01cef.
On entry: contains details of the interpolant.
Constraint: comm should not be changed following a call to e01cef.
6: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or −1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
Either e01cef was not called first or the communication array has become corrupted.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

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

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
e01cff 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

e01cff internally allocates 4n+3 reals.

10 Example

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

10.1 Program Text

Program Text (e01cffe.f90)

10.2 Program Data

Program Data (e01cffe.d)

10.3 Program Results

Program Results (e01cffe.r)