Fast polynomial evaluation and composition


The library fast polynomial for Sage compiles multivariate polynomials for subsequent fast evaluation. Several evaluation schemes are handled, such as Hörner, 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 fast polynomial library. The sage package can be downloaded at: In Section 1, we present the notion of evaluation tree and function scheme that unifies and extends state of the art algorithms for polynomial evaluation, such as the Hörner scheme [Mul06] or divide and conquer algorithms [Mul06, Est60, BK75, BZ11]. Section 2 reviews the different optimisations implemented in the library (multi-threads, template, fast exponentiation), that allows the library to compete with state-of-the art implementations. Finally, Section 3 shows experimental results. 1 Polynomial preprocessing Given a polynomial with integer, floating points, or even polynomial coefficients, there is several way to evaluate it. Some are better suited than others for specific data type. An evaluation tree specifies how the polynomial will be evaluated. Definition 1.1. An evaluation tree Tp associated to a polynomial p is an acyclic graph with a root node R. Each node N corresponds to a monomial of p and has 2 labels, denoted by c(N), the coefficient associated to N , and d(N), the partial degree associated to N . The result of an evaluation tree on x is defined recursively: T (x) = { c(R)xd(R) if R is the only node of T . (c(R) + ∑ i Si(x))x d(R) otherwise, where Si are the children tree of R. Each node of an evaluation tree is naturally associated with a term of the input polynomial. However, the partial degree of a node N is not the degree of monomial associated to N . The degree of the monomial associated to N is rather the sum of the partial degrees of its ancestors. If we order the terms of p in a decreasing lexicographical ordering, we induce naturally an ordering on the nodes of Tp. This ordering is also a topological ordering of Tp and will be denoted subsequently by <t. The first node is the bigger for <t and will have index 0. The last node is the root of the tree and will have index n. In particular, all the children of a node of index i have an index lower than i. 1.1 Function scheme A way to define an evaluation scheme for univariate polynomials is to use a function scheme.

Extracted Key Phrases

2 Figures and Tables

Cite this paper

@article{Moroz2013FastPE, title={Fast polynomial evaluation and composition}, author={Guillaume Moroz}, journal={CoRR}, year={2013}, volume={abs/1307.5655} }