Raw Univariate Polynomial Division #
Division algorithms for raw computable univariate polynomials.
Division with remainder by a monic polynomial using polynomial long division.
Equations
Instances For
Division of p : CPolynomial.Raw R by a monic q : CPolynomial.Raw R.
Equations
- p.divByMonic q = (p.divModByMonicAux q).1
Instances For
Modulus of p : CPolynomial.Raw R by a monic q : CPolynomial.Raw R.
Equations
- p.modByMonic q = (p.divModByMonicAux q).2
Instances For
Subtract scale * q * X^shift from p without using general polynomial multiplication.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Remainder-only long division by a monic polynomial.
Unlike modByMonic, this does not compute the quotient and avoids the general
polynomial multiplications used by each cancellation step. It is intended as an
executable implementation for the canonical modByMonic specification.
Equations
Instances For
Inverse modulo X^k, using Newton iteration and the supplied low-product backend.
Equations
- CompPoly.CPolynomial.Raw.inverseModX M k p = if k = 0 then #[] else CompPoly.CPolynomial.Raw.inverseModX.go M k p (k + 1) 1 (CompPoly.CPolynomial.Raw.C (p.coeff 0)⁻¹)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- CompPoly.CPolynomial.Raw.inverseModX.go M k p 0 a✝¹ a✝ = CompPoly.CPolynomial.Raw.truncate k a✝
Instances For
Remainder by a monic polynomial through reversal and truncated products.
For canonical monic inputs this computes the quotient from the reversed divisor
inverse modulo X^k, then subtracts only the low coefficients needed for the
remainder. Inputs outside the fast-path guard use the simple monic-remainder
implementation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Division of two CPolynomial.Raws.
Equations
- p.div q = (CompPoly.CPolynomial.Raw.C q.leadingCoeff⁻¹ • p).divByMonic (CompPoly.CPolynomial.Raw.C q.leadingCoeff⁻¹ * q)
Instances For
Modulus of two CPolynomial.Raws.
Equations
- p.mod q = (CompPoly.CPolynomial.Raw.C q.leadingCoeff⁻¹ • p).modByMonic (CompPoly.CPolynomial.Raw.C q.leadingCoeff⁻¹ * q)
Instances For
Equations
Equations
Raw Euclidean gcd with explicit fuel, normalized to a monic result.
Equations
- CompPoly.CPolynomial.Raw.gcdMonicWithFuel 0 x✝¹ x✝ = x✝¹.monicNormalize
- CompPoly.CPolynomial.Raw.gcdMonicWithFuel n.succ x✝¹ x✝ = if (x✝.trim == 0) = true then x✝¹.trim.monicNormalize else CompPoly.CPolynomial.Raw.gcdMonicWithFuel n x✝.trim (x✝¹.trim % x✝.trim)
Instances For
Raw monic Euclidean gcd.
Equations
- p.gcdMonic q = CompPoly.CPolynomial.Raw.gcdMonicWithFuel (Array.size p + Array.size q + 1) p q