Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
opinion

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

Published: 18 December 2017 Publication History
  • Get Citation Alerts
  • 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.

    References

    [1]
    E. Anderson, Z. Bai, C. Bischof, S. Blackford, J. Demmel, J. J. Dongarra, J. Du Croz, A. Greenbaum, S. Hammarling, A. McKenney, and D. Sorensen. 1999. LAPACK: Users’ Guide (3rd ed.). SIAM, Philadelphia, PA. Retrieved from http://www.netlib.org/lapack/lug/.
    [2]
    ANSI. 1966. Programming Language Fortran X3.9-1966. American National Standards Institute, New York.
    [3]
    D. H. Bailey. 1995. A fortran 90-based multiprecision system. ACM Trans. Math. Software 21, 4 (Dec. 1995), 379--387.
    [4]
    J. L. Blue. 1978. A portable fortran program to find the euclidean norm of a vector. ACM Trans. Math. Software 4, 1 (1978), 15--23.
    [5]
    J. J. Dongarra, J. Du Croz, S. Hammarling, and I. Duff. 1990. Algorithm 679: A set of level 3 basic linear algebra subprograms. ACM Trans. Math. Software 16, 1 (March 1990), 18--28.
    [6]
    J. J. Dongarra, J. Du Croz, S. Hammarling, and R. J. Hanson. 1988. Algorithm 656: An extended set of basic linear algebra subprograms: Model implementation and test programs. ACM Trans. Math. Software 14, 1 (March 1988), 18--32.
    [7]
    J. J. Dongarra and E. Grosse. 1987. Distribution of mathematical software via electronic mail. Comm. ACM 30, 5 (May 1987), 403--407.
    [8]
    J. J. Dongarra, C. B. Moler, J. R. Bunch, and G. W. Stewart. 1979. LINPACK: Users’ Guide. SIAM, Philadelphia, PA.
    [9]
    S. Graillat, C. Lauter, P. Tang, N. Yamanaka, and S. Oishi. 2015. Efficient calculations of faithfully rounded L2-norms of n-vectors. ACM Trans. Math. Software 41, 4, Article 24 (Oct. 2015), 20 pages. Software package retrieved from http://www.christoph-lauter.org/faithfulnorm.tgz.
    [10]
    R. J. Hanson and T. R. Hopkins. 2015. Remark on Algorithm 539: A Modern Fortran Implementation for Carefully Computing the Euclidean Norm—User Manual. (2015). Manual accompanying the software component of this publication.
    [11]
    R. J. Hanson and F. T. Krogh. 1987. Algorithm 653: Translation of algorithm 539: PC-BLAS basic linear algebra subprograms for FORTRAN usage with the INTEL 8087 80287 numeric data processor. ACM Trans. Math. Software 13, 3 (Sept. 1987), 311--317.
    [12]
    Y. Hida, X. S. Li, and D. H. Bailey. 2007. Library for Double-Double and Quad-Double Arithmetic. Retrieved from http://crd-legacy.lbl.gov/&sim;dhbailey/mpdist/qd-2.3.17.tar.gz.
    [13]
    N. J. Higham. 2002. Accuracy and Stability of Numerical Algorithms (2nd ed.). Society for Industrial and Applied Mathematics, Philadelphia, PA.
    [14]
    T. R. Hopkins. 1996. Restructuring software: A case study. Software—Practice and Experience 26, 8 (Aug. 1996), 967--982.
    [15]
    ISO/IEC. 1991. Information Technology—Programming Languages—FORTRAN (ISO/IEC 1539:1991). ISO/IEC Copyright Office, Geneva, Switzerland.
    [16]
    ISO/IEC. 1997. Information Technology—Programming Languages—Fortran—Part 1: Base Language (ISO/IEC 1539-1:1997). ISO/IEC Copyright Office, Geneva, Switzerland.
    [17]
    ISO/IEC. 2004. Information Technology—Programming Languages—Fortran—Part 1: Base Language (ISO/IEC 1539-1:2004). ISO/IEC Copyright Office, Geneva, Switzerland.
    [18]
    ISO/IEC. 2011. Information Technology—Programming Languages—Fortran—Part 1: Base Language (ISO/IEC 1539-1:2010). ISO/IEC Copyright Office, Geneva, Switzerland.
    [19]
    W. Kahan. 1997. Lecture Notes on the IEEE Standard 754 for Binary Floating-Point Arithmetic. Technical Report. Electrical Engineering and Computer Sciences, University of California, California. Retrieved from http://www.eecs.berkeley.edu/&sim;wkahan/ieee754status/IEEE754.PDF.
    [20]
    W. Kahan. 2012. Private communication (2012).
    [21]
    C. L. Lawson, R. J. Hanson, D. R. Kincaid, and F. T. Krogh. 1979b. Algorithm 539: Basic linear algebraic subprograms for fortran usage. ACM Trans. Math. Software 5, 3 (Sept. 1979), 324--325.
    [22]
    C. L. Lawson, R. J. Hanson, D. R. Kincaid, and F. T. Krogh. 1979a. Basic linear algebra subprograms for fortran usage. ACM Trans. Math. Software 5, 3 (Sept. 1979), 308--323.
    [23]
    M. Metcalf, J. Reid, and M. Cohen. 2011. Modern Fortran Explained. Oxford University Press, Oxford, UK.
    [24]
    MPFR. 2016. The GNU MPFR (Multiple Precision Floating Point Reliable) Library Download Site. Retrieved from http://www.mpfr.org/.
    [25]
    IEEE Task P754. 1985. ANSI/IEEE 754-1985, Standard for Binary Floating-Point Arithmetic. IEEE, New York.
    [26]
    LAPACK Project. 2015. LAPACK Official Download Site. Retrieved from http://www.netlib.org/lapack/. (Accessed: 2017-09-06).

    Cited By

    View all
    • (2023)Accurate Calculation of Euclidean Norms Using Double-word ArithmeticACM Transactions on Mathematical Software10.1145/356867249:1(1-34)Online publication date: 21-Mar-2023
    • (2021)A Rapid Euclidean Norm Calculation Algorithm that Reduces Overflow and UnderflowComputational Science and Its Applications – ICCSA 202110.1007/978-3-030-86653-2_7(95-110)Online publication date: 9-Sep-2021

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Transactions on Mathematical Software
    ACM Transactions on Mathematical Software  Volume 44, Issue 3
    September 2018
    291 pages
    ISSN:0098-3500
    EISSN:1557-7295
    DOI:10.1145/3175005
    Issue’s Table of Contents
    Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 18 December 2017
    Accepted: 01 August 2017
    Revised: 01 January 2017
    Received: 01 March 2016
    Published in TOMS Volume 44, Issue 3

    Check for updates

    Author Tags

    1. C language interoperability
    2. Euclidean norms
    3. Fortran
    4. accuracy
    5. compensated summation
    6. exception handling
    7. reliability

    Qualifiers

    • Opinion
    • Research
    • Refereed

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)4
    • Downloads (Last 6 weeks)1
    Reflects downloads up to 11 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2023)Accurate Calculation of Euclidean Norms Using Double-word ArithmeticACM Transactions on Mathematical Software10.1145/356867249:1(1-34)Online publication date: 21-Mar-2023
    • (2021)A Rapid Euclidean Norm Calculation Algorithm that Reduces Overflow and UnderflowComputational Science and Its Applications – ICCSA 202110.1007/978-3-030-86653-2_7(95-110)Online publication date: 9-Sep-2021

    View Options

    Get Access

    Login options

    Full Access

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media