When using an AbstractExtrapolation object etp, the behavior of knots(etp) depends on the boundary condition (extrapolation_bc):
- Finite Sequences: For
Throw, Flat, and Line, knots(etp) iterates over the knots exactly once. length and size are defined. - Infinite Sequences: For
Periodic and Reflect, knots(etp) generates an infinite sequence of knots. For these, length and size are undefined.
Periodic
Knots repeat indefinitely, and the first and last knots are co-located (e.g., the value at the first knot is the same as the value at the periodic-wrapped knot).
Reflect
Knots repeat indefinitely following a reflection pattern: k[1], k[2], ..., k[end], k[end-1], k[end-2], ....
# Periodic Example
x = [1.0, 1.5, 1.75, 2.0];
etp = linear_interpolation(x, x.^2, extrapolation_bc=Periodic());
kiter = knots(etp);
Iterators.take(kiter, 6) |> collect
# 6-element Vector{Float64}: [1.0, 1.5, 1.75, 2.0, 2.5, 2.75]
# Reflect Example
etp = linear_interpolation(x, x.^2, extrapolation_bc=Reflect());
kiter = knots(etp);
Iterators.take(kiter, 6) |> collect
# 6-element Vector{Float64}: [1.0, 1.5, 1.75, 2.0, 2.25, 2.5]