Interpolate a smooth, expensive function of a positive scalar
Source:R/vectorised_conjugate_inference.R
interpolate_smooth_function.RdEvaluates f at Chebyshev-Lobatto nodes in log(x) over the
range of x and interpolates barycentrically between them, which converges
geometrically for a function analytic in log(x). The interpolant is checked
against f halfway between the nodes; the nodes are doubled, reusing every
evaluation, until the largest relative error there is below tolerance.
When x has no more distinct values than the nodes would take, f is
evaluated at those values directly instead.