uxarray.utils.computing._comp_prod_fma

Contents

uxarray.utils.computing._comp_prod_fma#

uxarray.utils.computing._comp_prod_fma(vec)#

Compute the compensated product using Fused Multiply-Add (FMA).

This function computes the product of elements in a vector using a compensated algorithm with Fused Multiply-Add to reduce numerical errors.

Parameters:

vec (list of float) – The vector whose elements are to be multiplied.

Returns:

The compensated product of the elements in the vector.

Return type:

float

Examples

>>> _comp_prod_fma([1.1, 2.2, 3.3])
7.986000000000001

Takeshi Ogita, Siegfried M. Rump, and Shin’ichi Oishi. 2005. Accurate Sum and Dot Product. SIAM J. Sci. Comput. 26, 6 (2005), 1955–1988. https://doi.org/10.1137/030601818