/** * Dense univariate polynomial arithmetic over ℤ, backed by `bigint[]`. * * Convention: index = degree (coefficient of x^i lives at index i). * `[]` denotes the zero polynomial. After `trim`, the last entry (highest * degree) is guaranteed nonzero. `degree([])` is -1 by convention. * * This module is part of the univariate factorization engine * (`functions/src/typed/factorization/`) and is `bigint`-only by design: * float64 loses correctness once coefficients exceed 2^53 during Hensel * lifting to p^k. */ /** Dense polynomial over ℤ: index i holds the coefficient of x^i. */ export type IntPoly = bigint[]; /** * Removes trailing (highest-degree) zero coefficients so the last entry * (if any) is nonzero. Does not mutate the input. */ export declare function trim(p: IntPoly): IntPoly; /** Degree of `p`; the zero polynomial has degree -1 by convention. */ export declare function degree(p: IntPoly): number; /** Leading coefficient of `p` (0n for the zero polynomial). */ export declare function lc(p: IntPoly): bigint; /** True iff `p` is the zero polynomial (ignoring trailing zero padding). */ export declare function isZero(p: IntPoly): boolean; /** `a + b`, trimmed. */ export declare function add(a: IntPoly, b: IntPoly): IntPoly; /** `a - b`, trimmed. */ export declare function sub(a: IntPoly, b: IntPoly): IntPoly; /** `-a`, trimmed. */ export declare function neg(a: IntPoly): IntPoly; /** `a * b` via the schoolbook convolution, trimmed. */ export declare function mul(a: IntPoly, b: IntPoly): IntPoly; /** `p * k` for a scalar `k: bigint`, trimmed. */ export declare function scalarMul(p: IntPoly, k: bigint): IntPoly; /** Structural equality after trimming (so trailing-zero padding is ignored). */ export declare function equals(a: IntPoly, b: IntPoly): boolean; /** Evaluates `p(x)` at a bigint `x` via Horner's method. */ export declare function evaluate(p: IntPoly, x: bigint): bigint; /** Non-negative gcd of two bigints (gcd(0,0) = 0). */ export declare function bigintGcd(a: bigint, b: bigint): bigint; /** Content of `p`: the non-negative gcd of its (trimmed) coefficients. */ export declare function content(p: IntPoly): bigint; /** * Primitive part of `p`: divide out the content, then flip sign so the * leading coefficient is positive. The zero polynomial maps to itself. */ export declare function primitivePart(p: IntPoly): IntPoly; /** * Exact polynomial quotient `a / b` over ℤ: performs schoolbook long division * and returns the quotient only if the remainder is exactly zero AND every * intermediate coefficient division was integral (no rounding). Returns * `null` whenever `b` does not divide `a` exactly over ℤ. This is the * recombination correctness test used by subset factor-recombination — * it must never silently round. */ export declare function exactDivide(a: IntPoly, b: IntPoly): IntPoly | null; /** Formal derivative `p'` over ℤ: coefficient i*p[i] at index i-1. */ export declare function derivative(p: IntPoly): IntPoly; /** * Gcd of two polynomials over ℤ via the Euclidean pseudo-remainder sequence * (stays in ℤ throughout via pseudo-division), returned as a primitive * polynomial with positive leading coefficient. `gcd(0, b) = primitivePart(b)` * and symmetrically for `gcd(a, 0)`; `gcd(0,0) = []`. */ export declare function polyGcdZ(a: IntPoly, b: IntPoly): IntPoly; /** * Landau–Mignotte coefficient bound: any integer factor of `p` has all * coefficients bounded in absolute value by this quantity. Uses the * generous form `ceil(sqrt(deg+1) * 2^deg * |lc(p)|)`, computed entirely * with bigint integer arithmetic (integer sqrt rounded UP so the bound * stays safe/over-estimating). Always positive. */ export declare function landauMignotte(p: IntPoly): bigint; /** * Reduces every coefficient of `p` into the symmetric residue range * `(-m/2, m/2]` modulo `m`. `m` must be a positive modulus. Coefficient * count is preserved (no trailing-zero trim) — a coefficient that reduces * to 0 mod `m` stays as an explicit 0 at its original index. */ export declare function modSymmetric(p: IntPoly, m: bigint): IntPoly; //# sourceMappingURL=integer-poly.d.ts.map