Skip to main content
QUICK REVIEW

[Paper Review] Fast polynomial evaluation and composition

Guillaume Moroz|arXiv (Cornell University)|Jul 22, 2013
Polynomial and algebraic computation4 references3 citations
TL;DR

This paper introduces a new balanced divide-and-conquer evaluation scheme for multivariate polynomials in the fast_polynomial library for Sage, optimizing evaluation performance by minimizing lazy height and eliminating performance bottlenecks at powers of two. The scheme integrates template-based generic programming, multi-threading via OpenMP, and precomputed fast exponentiation, achieving competitive performance with state-of-the-art libraries like Flint for big integer evaluation.

ABSTRACT

The library \\emph{fast\\_polynomial} for Sage compiles multivariate polynomials for subsequent fast evaluation. Several evaluation schemes are handled, such as H\\"orner, divide and conquer and new ones can be added easily. Notably, a new scheme is introduced that improves the classical divide and conquer scheme when the number of terms is not a pure power of two. Natively, the library handles polynomials over gmp big integers, boost intervals, python numeric types. And any type that supports addition and multiplication can extend the library thanks to the template design. Finally, the code is parallelized for the divide and conquer schemes, and memory allocation is localized and optimized for the different evaluation schemes. This extended abstract presents the concepts behind the \\emph{fast\\_polynomial} library. The sage package can be downloaded at \\url{http://trac.sagemath.org/sage_trac/ticket/13358}.

Motivation & Objective

  • To address performance degradation in classical divide-and-conquer polynomial evaluation at powers of two.
  • To unify and extend existing evaluation schemes—such as Horner and Estrin—under a single function scheme abstraction.
  • To minimize memory usage during evaluation by introducing the concept of lazy height in evaluation trees.
  • To enable efficient, generic, and parallel evaluation of polynomials over arbitrary numeric types via template specialization.
  • To provide a high-performance, extensible library for polynomial evaluation that competes with low-level optimized libraries like Flint.

Proposed method

  • The evaluation tree structure recursively decomposes a polynomial using a function scheme f(k) = ⌊k/2⌋, which defines the balanced divide-and-conquer strategy.
  • Lazy height is computed recursively: it increases only when a node has two or more children, ensuring logarithmic memory usage.
  • The library uses C++ templates to support arbitrary numeric types that support addition and multiplication, enabling extensibility.
  • Multi-threading is applied via OpenMP directives to parallelize evaluation of subtrees in divide-and-conquer schemes.
  • Powers x^d are precomputed using fast exponentiation to reduce redundant multiplications during evaluation.
  • The function scheme abstraction allows seamless combination of different strategies, such as switching to Horner for low-degree subpolynomials.

Experimental results

Research questions

  • RQ1Can a new divide-and-conquer evaluation scheme eliminate the performance penalty at powers of two seen in classical Estrin-style schemes?
  • RQ2How can evaluation tree structure be optimized to minimize temporary storage and memory allocation during polynomial evaluation?
  • RQ3To what extent can a generic, template-based C++ library achieve performance comparable to hand-optimized low-level libraries like Flint?
  • RQ4Can parallelization via OpenMP significantly improve evaluation speed for large polynomials across multiple cores?
  • RQ5How does the lazy height metric compare to traditional tree height in terms of memory efficiency and computational overhead?

Key findings

  • The balanced divide-and-conquer scheme eliminates the staircase effect in evaluation time at powers of two, which plagues classical Estrin schemes.
  • The maximal lazy height across all schemes is logarithmic in the number of terms, ensuring O(log n) temporary storage.
  • The Horner scheme achieves a lazy height of 0, while the Direct, Estrin, and Balanced schemes each have a maximal lazy height of 1.
  • The library’s performance matches or exceeds that of the state-of-the-art Flint library for big integer polynomial evaluation, particularly in the balanced scheme with two threads.
  • Precomputation of powers using fast exponentiation reduces redundant multiplications, especially effective in Estrin and Balanced schemes with logarithmic distinct degrees.
  • The template-based design enables seamless extension to new numeric types, including GMP integers, Boost intervals, and Python numeric types.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.