This article needs more citations. (September 2026) |
In numerical analysis, Estrin's scheme (after Gerald Estrin), also known as Estrin's method, is an algorithm for numerical evaluation of polynomials.
Horner's method for evaluation of polynomials is one of the most commonly used algorithms for this purpose, and unlike Estrin's scheme it is optimal in the sense that it minimizes the number of multiplications and additions required to evaluate an arbitrary polynomial. However, each operation depends on the previous one, so it cannot take advantage of modern processors' ability to perform multiple independent operations in parallel. Estrin's scheme is one method which attempts to overcome this serialization while still being reasonably close to optimal.
Estrin's scheme operates recursively, converting a degree-n polynomial in x (for n≥2) to a degree-⌊n/2⌋ polynomial in x2 using ⌈n/2⌉ independent operations (plus one to compute x2).
Given an arbitrary polynomial P(x) = C0 + C1x + C2x2 + C3x3 + ⋯ + Cnxn, one can group adjacent terms into sub-expressions of the form (A + Bx) and rewrite it as a polynomial in x2: P(x) = (C0 + C1x) + (C2 + C3x)x2 + (C4 + C5x)x4 + ⋯ = Q(x2).
Each of these sub-expressions, and x2, may be computed in parallel. They may also be evaluated using a native multiply–accumulate instruction on some architectures, an advantage that is shared with Horner's method.
This grouping can then be repeated to get a polynomial in x4: P(x) = Q(x2) = ((C0 + C1x) + (C2 + C3x)x2) + ((C4 + C5x) + (C6 + C7x)x2)x4 + ⋯ = R(x4).
Repeating this ⌊log2n⌋+1 times, one arrives at Estrin's scheme for parallel evaluation of a polynomial:
This performs a total of n multiply-accumulate operations (the same as Horner's method) in line 1, and an additional ⌊log2n⌋ squarings in line 3. In exchange for those extra squarings, all of the operations in each level of the scheme are independent and may be computed in parallel; the longest dependency path is ⌊log2n⌋+1 operations long. A similar idea enables a fast matrix multiplication algorithm to evaluate a polynomial at a series of points.
Take Pn(x) to mean the nth order polynomial of the form: Pn(x) = C0 + C1x + C2x2 + C3x3 + ⋯ + Cnxn
Written with Estrin's scheme we have:
In full detail, consider the evaluation of P15(x):
Estrin's full scheme uses a very large number of multiply–accumulate operations in the first step. While this is useful to fully exploit modern superscalar processors, it will eventually exceed the available computing resources, at which point it may be useful to use Estrin's scheme to a limited depth, and then Horner's method on the residual.
For example, if a computer can perform four multiply-accumulate operations before the result of the first operation is available, then two levels of Estrin's scheme will keep its instruction pipeline full. Each iteration, it can perform the following operations in parallel:
The final result is F0.
A more capable processor may be able to have four 4-operand SIMD operations in progress at once, in which case four levels of Estrin's scheme could be used to evaluate a sufficiently high-degree polynomial.