Cardinal Basis for Lagrange interpolation.

1 | ```
cardinalBasis_lagrange(x, xout)
``` |

`x` |
Numeric vector of design points. |

`xout` |
Numeric vector giving new points. |

This is a simple and raw interface to `alterp`

Fortran
subroutine. It is a wrapper for `cardinalBasis_ceschino`

function with `cubic = FALSE`

and `deriv = 0L`

.

A list with the following elements

`x` |
Numeric vector of abscissas at which the basis is evaluated. This
is a copy of |

`CB` |
Matrix of the Cardinal Basis function values. |

This function does not allow extrapolation, so an error will
result when `xout`

contains element outside of the range of
`x`

. The function used here is a spline of degree 1 (order 2).

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
set.seed(123)
n <- 16; nout <- 300
x <- sort(runif(n))
##' ## let 'xout' contain n + nout points including nodes
xout <- sort(c(x, runif(nout, min = x[1], max = x[n])))
res <- cardinalBasis_lagrange(x, xout = xout)
matplot(res$x, res$CB, type = "n", main = "Cardinal Basis")
abline(v = x, h = 1.0, col = "gray")
points(x = x, y = rep(0, n), pch = 21, col = "black", lwd = 2, bg = "white")
matlines(res$x, res$CB, type = "l")
## Lebesgue's function is constant = 1.0: check it
L <- apply(res$CB, 1, function(x) sum(abs(x)))
range(L)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.