# NAG FL Interfacee01cff (dim1_​monconv_​eval)

## 1Purpose

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

## 2Specification

Fortran Interface
 Subroutine e01cff ( m, x, val, fwd, comm,
 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)
#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.

## 3Description

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

## 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)$Real (Kind=nag_wp) array Input
On entry: $x$, the points at which the interpolant is to be evaluated.
3: $\mathbf{val}\left({\mathbf{m}}\right)$Real (Kind=nag_wp) array Output
On exit: the values of the interpolant at $x$.
4: $\mathbf{fwd}\left({\mathbf{m}}\right)$Real (Kind=nag_wp) array Output
On exit: the values of the forward rates at $x$.
5: $\mathbf{comm}\left(*\right)$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: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, . If you are unfamiliar with this argument you should refer to Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{ifail}}=1$
Either e01cef was not called first or the communication array has become corrupted.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{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.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

## 7Accuracy

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

## 8Parallelism and Performance

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.

e01cff internally allocates $4n+3$ reals.

## 10Example

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

Program Text (e01cffe.f90)

### 10.2Program Data

Program Data (e01cffe.d)

### 10.3Program Results

Program Results (e01cffe.r)