hmf.core._kernels.interpolation¶
Interpolation kernels: local interpolants on uniform lattices, and frozen splines.
The local interpolants work in a coordinate u in [0, 1] between two adjacent
nodes x0 and x0 + h of a uniform lattice, from the values (and derivatives)
at a fixed set of nodes. Each result depends only on those nodes and on u, so
interpolants on a lazily extended lattice do not change as the lattice grows, and
all of them are elementwise (batch-size independent).
hermite_cubic(): values and first derivatives at the two ends;hermite_quintic(): values, first and second derivatives at the two ends;lagrange4(): values at four nodes,-1, 0, 1, 2(in units ofh);invert_hermite(): the inverse of a decreasing Hermite interpolant.
Tables (of a transfer function, a growth factor, a power spectrum) are interpolated by cubic splines, fitted once and kept as their coefficients:
FrozenSpline: ascipy.interpolate.CubicSpline’s breakpoints and piecewise-polynomial coefficients, evaluated byscipy.interpolate.PPoly.construct_fast(), so it gives exactly the spline’s values;extrapolate_power_law(): a spline of ln y against ln x, continued beyond its ends as straight lines (power laws in y) with its slopes there.
Classes
|
A cubic spline, fitted once and kept as its piecewise-polynomial coefficients. |
Functions
|
A spline of ln y against ln x, continued as power laws beyond its ends. |
|
The cubic Hermite interpolant on |
|
The quintic Hermite interpolant on |
|
Solve |
|
The 4-point Lagrange interpolant through nodes at -1, 0, 1, 2, evaluated at |