volumential.lagrange#

Stable Lagrange basis evaluation helpers.

This module owns the barycentric (first-kind) formulation of tensor-product Lagrange interpolation used by the near-field tables and the volume FMM wranglers. The barycentric form is what keeps high-order weights finite: weights are normalized in log space, so orders in the hundreds survive a float32 round trip.

volumential.lagrange.barycentric_lagrange_weights(nodes: ArrayLike) → ndarray[source]#

Return first-kind barycentric weights for distinct interpolation nodes.

The weights are normalized so that the largest one has unit magnitude, which keeps high-order node sets representable in single precision.

volumential.lagrange.evaluate_lagrange_basis_1d(nodes: ArrayLike, index: int, x: ArrayLike, weights: ArrayLike | None = None) → ndarray | float[source]#

Evaluate one Lagrange basis function with the barycentric formula.

Parameters:
  • index – which basis function to evaluate, in range(len(nodes)).

  • x – evaluation point(s); a scalar in gives a float out.

  • weights – barycentric weights from barycentric_lagrange_weights(), recomputed when not given.