Raw Univariate Polynomial Operations #
Operations and evaluation lemmas for raw computable univariate polynomials.
Evaluates a CPolynomial.Raw at x : S using Horner's method.
Computes f(aₙ) + x * (f(aₙ₋₁) + x * (... + x * f(a₀))) via a right fold.
Instances For
Evaluates a CPolynomial.Raw at a given value
Instances For
Right scalar multiplication: multiplies each coefficient by r on the right.
Corresponds to p.toPoly * Polynomial.C r, in contrast to smul which corresponds
to Polynomial.C r * p.toPoly. The distinction matters in non-commutative semirings.
Instances For
Multiplication accumulator using the naive O(n²) algorithm: Σᵢ (aᵢ * q) * X^i.
The partial sums are combined with the untrimmed addRaw, so the result may carry
trailing zeros and should be trimmed for canonical form. Deferring the trim to the
end (see mul) avoids an O(size) scan after every partial sum.
Instances For
Multiplication using the naive O(n²) algorithm: Σᵢ (aᵢ * q) * X^i.
Trims only once, at the end of the convolution fold, rather than after every
partial sum (mulRaw does the untrimmed accumulation).
Instances For
Exponentiation of a CPolynomial.Raw by a natural number n via repeated multiplication.
This is the specification; powBySq is the efficient O(log n) implementation.
Instances For
Repeated-squaring core that accumulates with the untrimmed mulRaw, deferring
the canonicalization trim to the outer powBySq wrapper. The output may carry
trailing zeros and is not in canonical form.
For $ n > 0 $, computes $ p ^ n $ by recursing on $ n / 2 $:
- If $ n $ is even: $ (p ^ {n/2})^2 $
- If $ n $ is odd: $ p \cdot (p ^ {n/2})^2 $
Instances For
Exponentiation via repeated squaring: $ O(\log n) $ multiplications
instead of $ O(n) $. Delegates to powBySqUntrimmed and trims only once
at the end, rather than after every squaring step.
Instances For
Backend for computing the low k coefficients of a raw product.
Return the low
kcoefficients ofp * q.The backend does not return coefficients at degree
>= k.Low coefficients agree with ordinary raw multiplication.
Instances For
Convert degreeBound to a natural number by sending ⊥ to 0.
Instances For
Pseudo-division by X: removes the constant term and shifts remaining coefficients left.