_d_vec_dot_thrice
#include <flint/d_vec.h>Returns the dot product computed as if in three times the working precision and then rounded to double, using error-free transformations (the algorithm Dot3 of Ogita, Rump and Oishi [ORO2005]). The result is accurate to nearly full double precision unless the dot product is extremely ill-conditioned. If err is not NULL, sets *err to the error bound of [ORO2005] in terms of the returned value r, evaluated in double precision: (\varepsilon + 2\gamma^2) |r| + \gamma^3 \|x\|_2 \|y\|_2 with \varepsilon = 2^{-52} and \gamma = (4n-2)\varepsilon / (1 - (4n-2)\varepsilon).
Each product x_i y_i is split into h_i + e_i exactly by Dekker's product with Veltkamp splitting (the code does not use FMA), the sum of the h_i is accumulated with Knuth's TwoSum, keeping the n - 1 rounding errors, and the resulting 2n terms are summed again with a cascade of TwoSums followed by an ordinary sum of the errors; see Error-free transformations for the error-free transformations. The products must not overflow, and products below about 2^{-969} lose the exactness of the splitting. A temporary vector of 2n doubles is allocated.
References#
- [ORO2005] T. Ogita, S. M. Rump and S. Oishi. Accurate sum and dot product. SIAM Journal on Scientific Computing 26:6 (2005), 1955–1988. https://doi.org/10.1137/030601818
The FLINT team, “_d_vec_dot_thrice (d_vec.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/d_vec/_d_vec_dot_thrice.html (generated 2026-10-20).
@misc{flint-doc-d-vec-d-vec-dot-thrice,
author = {{The FLINT team}},
title = {{\_d\_vec\_dot\_thrice (d\_vec.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/d_vec/_d_vec_dot_thrice.html},
note = {Generated 2026-10-20}
}