pairwise algorithm for computing sample variances

An algorithm to compute the mean and the variance of an array of numbers. By pairwise combining array elements, the total number of arithmetic operations is reduced and therefore also the noise due to finite precision arithmetic. The algorithm is described in Chan, Golub & LeVeque (1979) and a comparison with other algorithms is presented in Chan, Golub & LeVeque (1983).

© djmw, August 6, 2017