'Lawful' finite supports #
This file defines the Lawful subtype, which consists of Unlawful polynomials
where all stored coefficients are guaranteed to be non-zero. This provides a canonical
representation (similar to Finsupp) and is the primary representation used for
computable multivariate polynomials.
Main definitions #
CPoly.Lawful n R: The subtype ofUnlawful n Rwith no zero coefficients.
Note to self: This goes too far.
Polynomial exponentiation via repeated multiplication. O(k) multiplications.
This is the specification; npowBySq is the efficient O(log k) implementation
used by the NatPow instance once the equivalence with this naive form has been
proven.
Instances For
Polynomial exponentiation via repeated squaring. O(log k) multiplications
instead of O(k).
For k > 0, computes p ^ k by recursing on k / 2:
- If
kis even:(p ^ (k / 2))² - If
kis odd:p · (p ^ (k / 2))²
Equivalent to npow (see npowBySq_eq_npow).
Instances For
The list of monomials in a polynomial.
Instances For
Lift a binary polynomial operation to handle polynomials with different numbers of variables.