Evaluate coefficients through f and variables through x. Powers are
computed by repeated squaring in Mono.prod.
Equations
- Hex.MvPoly.eval₂ f x p = Hex.MvPoly.foldTerms (fun (acc : S) (m : Hex.Mono n) (c : R) => acc + f c * Hex.Mono.prod x m) 0 p
Instances For
Evaluate a polynomial at x.
Equations
- Hex.MvPoly.eval x p = Hex.MvPoly.eval₂ id x p
Instances For
A term whose coefficient has already been mapped into the target semiring.
Equations
- Hex.MvPoly.HornerTerm n S = (Hex.Mono n × S)
Instances For
Terms sharing one exponent in the variable currently being evaluated.
Equations
- Hex.MvPoly.HornerGroup n S = (Nat × List (Hex.MvPoly.HornerTerm n S))
Instances For
Add a term to an association list keyed by one variable exponent.
Equations
Instances For
Insert an exponent group into descending exponent order.
Equations
Instances For
Collect terms into groups keyed by their exponent at variable k.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Sort exponent groups from high exponent to low exponent.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Group terms by one variable exponent, ordered from high to low.
Equations
- Hex.MvPoly.hornerGroups k terms = Hex.MvPoly.sortHornerGroups (Hex.MvPoly.collectHornerGroups k terms)
Instances For
Advance one descending sparse-Horner exponent group.
Equations
Instances For
Sparse Horner fold over already-evaluated coefficient groups. Callers must supply groups in descending exponent order. Missing exponents are skipped with repeated-squaring powers.
Equations
- Hex.MvPoly.evalSparseHornerGroups x [] = 0
- Hex.MvPoly.evalSparseHornerGroups x (group :: groups) = (List.foldl (Hex.MvPoly.hornerStep x) group groups).snd * Hex.Mono.powBySq x (List.foldl (Hex.MvPoly.hornerStep x) group groups).fst
Instances For
Evaluate sparse terms by fixed-order Horner in variables
0, 1, ..., n - 1. fuel is the number of variables left.
Equations
- One or more equations did not get rendered due to their size.
- Hex.MvPoly.eval₂HornerTerms xs 0 x✝¹ x✝ = List.foldl (fun (acc : S) (term : Hex.MvPoly.HornerTerm n S) => acc + term.snd) 0 x✝
Instances For
Evaluate using fixed-variable-order sparse Horner evaluation. The target semiring is commutative because variable nesting may reorder factors.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluate at x using fixed-variable-order sparse Horner evaluation.
Equations
Instances For
Evaluate the variables assigned by s, leaving all other variables in
the same ambient polynomial ring. Terms that collide are combined.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluation is the ordered term fold of mapped coefficients times monomial values.
Same-ring evaluation is the ordered term fold with unchanged coefficients.
Sparse Horner evaluation agrees with direct term evaluation.
Same-ring sparse Horner evaluation agrees with ordinary evaluation.