Skip to main content
Kent Academic Repository

Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm

Hanson, Richard J., Hopkins, Tim (2018) Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Transactions on Mathematical Software, 44 (3). pp. 1-23. ISSN 0098-3500. E-ISSN 1557-7295. (doi:10.1145/3134441) (KAR id:67205)

Abstract

We propose a set of new Fortran reference implementations, based on an algorithm proposed by Kahan,

for the Level 1 BLAS routines *NRM2 that compute the Euclidean norm of a real or complex input vector.

The principal advantage of these routines over the current offerings is that, rather than losing accuracy

as the length of the vector increases, they generate results that are accurate to almost machine precision

for vectors of length N < Nmax where Nmax depends upon the precision of the floating point arithmetic

being used. In addition we make use of intrinsic modules, introduced in the latest Fortran standards, to

detect occurrences of non-finite numbers in the input data and return suitable values as well as setting

IEEE floating point status flags as appropriate. A set of C interface routines is also provided to allow simple,

portable access to the new routines.

To improve execution speed, we advocate a hybrid algorithm; a simple loop is used first and, only if IEEE

floating point exception flags signal, do we fall back on Kahan’s algorithm. Since most input vectors are

‘easy’, i.e., they do not require the sophistication of Kahan’s algorithm, the simple loop improves performance

while the use of compensated summation ensures high accuracy.

We also report on a comprehensive suite of test problems that has been developed to test both our new

implementation and existing codes for both accuracy and the appropriate settings of the IEEE arithmetic

status flags.

Item Type: Article
DOI/Identification number: 10.1145/3134441
Uncontrolled keywords: Design, Algorithms, Performance, Portability, Reliability
Divisions: Divisions > Division of Computing, Engineering and Mathematical Sciences > School of Computing
Depositing User: Tim Hopkins
Date Deposited: 05 Jun 2018 14:28 UTC
Last Modified: 05 Nov 2024 11:07 UTC
Resource URI: https://kar.kent.ac.uk/id/eprint/67205 (The current URI for this page, for reference purposes)

University of Kent Author Information

Hopkins, Tim.

Creator's ORCID:
CReDIT Contributor Roles:
  • Depositors only (login required):

Total unique views for this document in KAR since July 2020. For more details click on the image.