Class LagrangeInterpolator

Class Documentation

class LagrangeInterpolator

Lagrange-polynomial interpolator for evaluating one or more tabulated functions at a fixed query point xi, using a fixed-order local polynomial centered near xi.

Used by the EOP (GetEopData, lupnt/data/eop.cc) and IAU SOFA constants (GetIauSofaData, lupnt/data/iau_sofa.cc) loaders to interpolate tabulated Earth-orientation/precession-nutation series to an arbitrary epoch: constructing the interpolator once selects the order+1 table points nearest xi and precomputes the Lagrange weights, and Interpolate is then called once per data column (e.g. x_pole, y_pole, UT1-UTC, …) sharing the same abscissa x.

Public Functions

LagrangeInterpolator(const VecXd &x, double xi, int order)

Construct an interpolator for query point xi over abscissa table x, using a local Lagrange polynomial of degree order (i.e. order table points).

Selects the order consecutive points of x whose span is best centered on xi (via ComputeFirstIndex) and precomputes the corresponding Lagrange basis weights (via ComputeWeights).

Parameters:
  • x – Strictly monotonic table of abscissa samples (e.g. MJD/JD epochs)

  • xi – Query point; must lie within [x(0), x(end)] (within EPS), else throws

  • order – Number of table points used by the local interpolant (interpolant degree = order - 1); x.size() must be > order

double Interpolate(const VecXd &z)

Evaluate the Lagrange interpolant of tabulated values z (sharing the abscissa x passed to the constructor) at the query point xi.

Parameters:

z – Table of dependent-variable values, same size as x

Returns:

Interpolated value of z at xi