diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-09-04 21:15:31 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-11-30 19:35:44 +0100 |
commit | 1e624fa13455e932573b9f421d2865e1fea0cd48 (patch) | |
tree | 01eb84d282b9bf70b25cbf08a837f74b173c91de /numpy/lib/arraypad.py | |
parent | f4749b7b2514db9f12978438a2131df981dc14d6 (diff) | |
download | numpy-1e624fa13455e932573b9f421d2865e1fea0cd48.tar.gz |
ENH: implement pairwise summation
pairwise summation has an average error of O(log(n)) instead of O(n) of
the regular summation.
It is implemented as summing pairs of small blocks of regulary summed
values in order to archive the same performance as the old sum.
An example of data which profits greatly is
d = np.ones(500000)
(d / 10.).sum() - d.size / 10.
An alternative to pairwise summation is kahan summation but in order to
have a low performance penalty one must unroll and vectorize it,
while pairwise summation has the same speed without any vectorization.
The better error bound of O(1) is negligible in many cases.
Diffstat (limited to 'numpy/lib/arraypad.py')
0 files changed, 0 insertions, 0 deletions