RhysU / ar

Autoregressive process modeling tools in header-only C++
Mozilla Public License 2.0
44 stars 13 forks source link

Use Kahan variant adding final error to sum #13

Closed RhysU closed 11 years ago

RhysU commented 11 years ago

On page 791 of http://dx.doi.org/10.1137/0914050 Higham mentions a Kahan variant with slightly nicer behavior which can be had by simply using

s = s + e

at the end of the compensated loop. This merges the final accumulated loss into the total sum. Higham cites two works by Kaham (refs 17 and 18) but those refs look time consuming to dig up.

Try this out as the additional cost and coding is minimal.

RhysU commented 11 years ago

Done in 1e8e6cd0fbaf73bee1739f546cb10efa3cb4fd6d on develop branch.