The seeded-CL adapter, part 2: affine reparametrization of a line answer #
Both tests answer a line question with a univariate polynomial in the parameter of the line,
and they parametrize the same line differently: the base points differ by a multiple of the
direction and the directions differ by a scalar (see
MIPRE.Background.LIDT.Adapter.Geometry, and the correction in
planning/lidt-cl-adapter.md). So converting an answer means substituting an affine map
t ↦ a t + b into the polynomial — the "canonicalization and rebasing" of
rem:lidt-cl-adapter.
Answers are coefficient vectors (LinePoly F k = Fin (k+1) → F), and the substitution has to
preserve the degree bound exactly, since the bound is the answer alphabet: an adapter that
raised the degree would not be producing an answer of the canonical-line test at all.
Doing this directly on coefficient vectors means a Taylor shift, hence the binomial theorem by
hand. Going through Polynomial F avoids that entirely: toPoly and ofPoly are mutually
inverse between coefficient vectors and polynomials of degree at most k
(ofPoly_toPoly, toPoly_ofPoly), natDegree_comp_le gives the degree bound for free, and
the inverse substitution is the composition with the inverse affine map, so the
reparametrization is a bijection with no computation on coefficients at all.
Coefficient vectors and polynomials #
A coefficient vector, as a polynomial.
Equations
- MIPRE.LIDT.Adapter.toPoly f = ∑ i : Fin (k + 1), Polynomial.C (f i) * Polynomial.X ^ ↑i
Instances For
A polynomial's coefficients, truncated to degree k.
Equations
- MIPRE.LIDT.Adapter.ofPoly p i = p.coeff ↑i
Instances For
Evaluation agrees with Polynomial.eval.
Evaluating the truncation of a polynomial of degree at most k.
The affine substitution #
The affine map to substitute.