nrm2(3)
β¨ nrm2(3) β¨ β the nrm2 gang, aka || x ||_2 π
okay bestie, so this page is from the Library Functions Manual and it's literally the whole nrm2 squad β four functions whose entire personality is "give me a vector, I'll give you its euclidean norm." iconic behavior honestly π
πΈ NAME πΈ
nrm2 β nrm2: || x ||_2 π
π¦ SYNOPSIS π¦
Functions
real(wp) function dnrm2 (n, x, incx)β DNRM2real(wp) function dznrm2 (n, x, incx)β DZNRM2real(wp) function scnrm2 (n, x, incx)β SCNRM2real(wp) function snrm2 (n, x, incx)β SNRM2
π Detailed Description π
no cap, this is where the actual lore lives. scroll down for the four function glow-ups π«
π Function Documentation π
π real(wp) function dnrm2 (integer n, real(wp), dimension(*) x, integer incx) π
DNRM2
Purpose:
!>
!> DNRM2 returns the euclidean norm of a vector via the function
!> name, so that
!>
!> DNRM2 := sqrt( x'*x )
!>
like, it just hands you the euclidean norm. that's the whole vibe. β¨
Parameters
N
!> 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.
!>
π«Ά lowkey important: ifINCX = 0,xisn't a vector so there's literally no need to call this subroutine. but if you call it anyway? it'll countx(1)in the vector normNtimes. not me warning you twice π
Author
Edward Anderson, Lockheed Martin π
Date
August 2016 π
Contributors:
Weslley Pereira, University of Colorado Denver, USA π
Further Details:
!>
!> 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
!>
!>
Definition at line 88 of file dnrm2.f90. π
π real(wp) function dznrm2 (integer n, complex(wp), dimension(*) x, integer incx) π
DZNRM2
Purpose:
!>
!> DZNRM2 returns the euclidean norm of a vector via the function
!> name, so that
!>
!> DZNRM2 := sqrt( x**H*x )
!>
note the x**H*x bestie β conjugate transpose energy, we love a complex girlie π¦
Parameters
N
!> 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.
!>
π same deal as before:INCX = 0meansxisn't a vector, so there's no need to call this subroutine β and if you do it anyway, it countsx(1)in the vector normNtimes.
Author
Edward Anderson, Lockheed Martin π
Date
August 2016 π
Contributors:
Weslley Pereira, University of Colorado Denver, USA π
Further Details:
!>
!> 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
!>
!>
Definition at line 89 of file dznrm2.f90. π
π real(wp) function scnrm2 (integer n, complex(wp), dimension(*) x, integer incx) π
SCNRM2
Purpose:
!>
!> SCNRM2 returns the euclidean norm of a vector via the function
!> name, so that
!>
!> SCNRM2 := sqrt( x**H*x )
!>
single-precision complex edition, and yes she also ate with that x**H*x π
Parameters
N
!> 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.
!>
π third time's the charm:INCX = 0βxisn't a vector β no need to call this subroutine. call it anyway andx(1)gets counted in the vector normNtimes. the math said what it said.
Author
Edward Anderson, Lockheed Martin π
Date
August 2016 π
Contributors:
Weslley Pereira, University of Colorado Denver, USA π
Further Details:
!>
!> 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
!>
!>
Definition at line 89 of file scnrm2.f90. π
π§ real(wp) function snrm2 (integer n, real(wp), dimension(*) x, integer incx) π§
SNRM2
Purpose:
!>
!> SNRM2 returns the euclidean norm of a vector via the function
!> name, so that
!>
!> SNRM2 := sqrt( x'*x ).
!>
the single-precision real one β tiny period at the end of the formula and everything, she's demure π
Parameters
N
!> 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.
!>
π«Ά ok literally final reminder because I care:INCX = 0meansxisn't a vector, so there is no need to call this subroutine β and if you call it anyway, it will countx(1)in the vector normNtimes.
Author
Edward Anderson, Lockheed Martin π
Date
August 2016 π
Contributors:
Weslley Pereira, University of Colorado Denver, USA π
Further Details:
!>
!> 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
!>
!>
Definition at line 88 of file snrm2.f90. π
π« Author π«
Generated automatically by Doxygen for LAPACK from the source code. π€ (yes the robots wrote this page, and honestly? they ate.)
and that's the whole page bestie π«Ά β this beauty is from LAPACK, Version 3.12.0, dated the LAPACK era of nrm2(3). go compute some norms, you're gonna slay πβ¨π
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms