logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Author

Generated automatically by Doxygen for LAPACK from the source code. Version 3.12.0 Sun Jul 20 2025 01:40:05 nrm2(3)

Detailed Description

Function Documentation

real(wp)functiondnrm2(integern,real(wp),dimension(*)x,integerincx)DNRM2Purpose: DNRM2 returns the euclidean norm of a vector via the function name, so that DNRM2 := sqrt( x'*x ) ParametersN N is INTEGER number of elements in input vector(s) X X is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) INCX INCX is INTEGER, storage spacing between elements of X If INCX > 0, X(1+(i-1)*INCX) = x(i) for 1 <= i <= n If INCX < 0, X(1-(n-i)*INCX) = x(i) for 1 <= i <= n If INCX = 0, x isn't a vector so there is no need to call this subroutine. If you call it anyway, it will count x(1) in the vector norm N times. Author Edward Anderson, Lockheed Martin Date August 2016 Contributors: Weslley Pereira, University of Colorado Denver, USA FurtherDetails: Anderson E. (2017) Algorithm 978: Safe Scaling in the Level 1 BLAS ACM Trans Math Softw 44:1--28 https://doi.org/10.1145/3061665 Blue, James L. (1978) A Portable Fortran Program to Find the Euclidean Norm of a Vector ACM Trans Math Softw 4:15--23 https://doi.org/10.1145/355769.355771 real(wp)functiondznrm2(integern,complex(wp),dimension(*)x,integerincx)DZNRM2Purpose: DZNRM2 returns the euclidean norm of a vector via the function name, so that DZNRM2 := sqrt( x**H*x ) ParametersN N is INTEGER number of elements in input vector(s) X X is COMPLEX*16 array, dimension (N) complex vector with N elements INCX INCX is INTEGER, storage spacing between elements of X If INCX > 0, X(1+(i-1)*INCX) = x(i) for 1 <= i <= n If INCX < 0, X(1-(n-i)*INCX) = x(i) for 1 <= i <= n If INCX = 0, x isn't a vector so there is no need to call this subroutine. If you call it anyway, it will count x(1) in the vector norm N times. Author Edward Anderson, Lockheed Martin Date August 2016 Contributors: Weslley Pereira, University of Colorado Denver, USA FurtherDetails: Anderson E. (2017) Algorithm 978: Safe Scaling in the Level 1 BLAS ACM Trans Math Softw 44:1--28 https://doi.org/10.1145/3061665 Blue, James L. (1978) A Portable Fortran Program to Find the Euclidean Norm of a Vector ACM Trans Math Softw 4:15--23 https://doi.org/10.1145/355769.355771 real(wp)functionscnrm2(integern,complex(wp),dimension(*)x,integerincx)SCNRM2Purpose: SCNRM2 returns the euclidean norm of a vector via the function name, so that SCNRM2 := sqrt( x**H*x ) ParametersN N is INTEGER number of elements in input vector(s) X X is COMPLEX array, dimension (N) complex vector with N elements INCX INCX is INTEGER, storage spacing between elements of X If INCX > 0, X(1+(i-1)*INCX) = x(i) for 1 <= i <= n If INCX < 0, X(1-(n-i)*INCX) = x(i) for 1 <= i <= n If INCX = 0, x isn't a vector so there is no need to call this subroutine. If you call it anyway, it will count x(1) in the vector norm N times. Author Edward Anderson, Lockheed Martin Date August 2016 Contributors: Weslley Pereira, University of Colorado Denver, USA FurtherDetails: Anderson E. (2017) Algorithm 978: Safe Scaling in the Level 1 BLAS ACM Trans Math Softw 44:1--28 https://doi.org/10.1145/3061665 Blue, James L. (1978) A Portable Fortran Program to Find the Euclidean Norm of a Vector ACM Trans Math Softw 4:15--23 https://doi.org/10.1145/355769.355771 real(wp)functionsnrm2(integern,real(wp),dimension(*)x,integerincx)SNRM2Purpose: SNRM2 returns the euclidean norm of a vector via the function name, so that SNRM2 := sqrt( x'*x ). ParametersN N is INTEGER number of elements in input vector(s) X X is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) INCX INCX is INTEGER, storage spacing between elements of X If INCX > 0, X(1+(i-1)*INCX) = x(i) for 1 <= i <= n If INCX < 0, X(1-(n-i)*INCX) = x(i) for 1 <= i <= n If INCX = 0, x isn't a vector so there is no need to call this subroutine. If you call it anyway, it will count x(1) in the vector norm N times. Author Edward Anderson, Lockheed Martin Date August 2016 Contributors: Weslley Pereira, University of Colorado Denver, USA FurtherDetails: Anderson E. (2017) Algorithm 978: Safe Scaling in the Level 1 BLAS ACM Trans Math Softw 44:1--28 https://doi.org/10.1145/3061665 Blue, James L. (1978) A Portable Fortran Program to Find the Euclidean Norm of a Vector ACM Trans Math Softw 4:15--23 https://doi.org/10.1145/355769.355771

Name

nrm2 - nrm2: || x ||_2

Synopsis

Functions real(wp) function dnrm2 (n, x, incx) DNRM2 real(wp) function dznrm2 (n, x, incx) DZNRM2 real(wp) function scnrm2 (n, x, incx) SCNRM2 real(wp) function snrm2 (n, x, incx) SNRM2

See Also