uxarray.utils.computing._norm_g

Contents

uxarray.utils.computing._norm_g#

uxarray.utils.computing._norm_g(x)#

Compute the compensated Euclidean norm of a vector.

This function calculates the Euclidean norm (L2 norm) of a vector, using a compensated algorithm to reduce numerical errors.

Parameters:

x (list of float) – The vector whose norm is to be computed.

Returns:

The compensated Euclidean norm of the vector.

Return type:

float

Examples

>>> _norm_g([1.0, 2.0, 3.0])
3.7416573867739413

Stef Graillat, Christoph Lauter, PING Tak Peter Tang, Naoya Yamanaka, and Shin’ichi Oishi. Efficient Calculations of Faith- fully Rounded L2-Norms of n-Vectors. ACM Transactions on Mathemat- ical Software, 41(4), Article 24, 2015. 10.1145/2699469. Available at: https://doi.org/10.1145/2699469.