Math 2.0

Numerical analysis Basic notions and error analysis Theorem

Pairwise summation

Builds on Floating-point arithmeticMachine epsilonRound-off error

Statement

Let x1,…,xnx_1, \ldots, x_n be floating-point numbers in a system with unit roundoff uu (see machine epsilon), with no overflow or underflow, and let γk=ku/(1−ku)\gamma_k = ku/(1 - ku) for ku<1ku < 1. Pairwise summation computes s^\hat s recursively, with s^=x1\hat s = x_1 if n=1n = 1. If n≥2n \ge 2, let m=⌊n/2⌋m = \floor{n/2}; it computes s^1\hat s_1 for x1,…,xmx_1, \ldots, x_m and s^2\hat s_2 for xm+1,…,xnx_{m+1}, \ldots, x_n in the same way. Then it sets s^=fl(s^1+s^2)\hat s = \mathrm{fl}(\hat s_1 + \hat s_2). If ⌈log⁡2n⌉u<1\lceil \log_2 n \rceil u < 1, then ∣s^−∑i=1nxi∣≤γ⌈log⁡2n⌉∑i=1n∣xi∣.\Bigl| \hat s - \sum_{i=1}^{n} x_i \Bigr| \le \gamma_{\lceil \log_2 n \rceil} \sum_{i=1}^{n} \abs{x_i}.

Remarks

The recursion has depth ⌈log⁡2n⌉\lceil \log_2 n \rceil, and each term xix_i takes part in at most ⌈log⁡2n⌉\lceil \log_2 n \rceil floating-point additions. Each addition multiplies the term by a factor 1+δ1 + \delta with ∣δ∣≤u\abs{\delta} \le u, so s^=∑xi(1+θi)\hat s = \sum x_i (1 + \theta_i) with ∣θi∣≤γ⌈log⁡2n⌉\abs{\theta_i} \le \gamma_{\lceil \log_2 n \rceil}, which gives the bound. For n=106n = 10^6 terms in double precision, the bound is about 20u∑∣xi∣20u \sum \abs{x_i}, against about 106u∑∣xi∣10^6 u \sum \abs{x_i} for plain recursive summation. The cost is the same n−1n - 1 additions as recursive summation. In practice the recursion stops at blocks of moderate size that are summed in a simple loop, which gives a bound of order (B+log⁡2n)u∑∣xi∣(B + \log_2 n) u \sum \abs{x_i} for blocks of size BB.

Going deeper

For a student

The error bound grows like ulog⁡2nu \log_2 n, against unu n for recursive summation. The Kahan summation algorithm does better still, with a leading term 2u2u independent of nn, at about four times the cost. Pairwise summation is the default in several numerical libraries because it costs no extra arithmetic. The same divide-and-conquer pattern appears in the fast Fourier transform, whose rounding errors also grow only logarithmically. For random rounding errors the typical error is even smaller, of order ulog⁡nu \sqrt{\log n} in a statistical model.

Reading path

To understand this page from the ground up, read these 4 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Floating-point arithmetic concept
  2. Machine epsilon concept
  3. Round-off error concept
  4. Pairwise summation statement

Further reading

  1. Web https://en.wikipedia.org/wiki/Pairwise_summation
About this page
TagSVSVMWA9NQ
URIm2://SVSVMWA9NQ
Kindstatement, theorem
WritingW0 stub
MSC65G50, 65B10
StatusThis copy of the site has no build data. Run m2 status SVSVMWA9NQ.
AboutRound-off error
UsesFloating-point arithmetic, Machine epsilon, Round-off error
Same as

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.