LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
real function snrm2 ( integer  N,
real, dimension(*)  X,
integer  INCX 
)

SNRM2

Purpose:
 SNRM2 returns the euclidean norm of a vector via the function
 name, so that

    SNRM2 := sqrt( x'*x ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
  -- This version written on 25-October-1982.
     Modified on 14-October-1993 to inline the call to SLASSQ.
     Sven Hammarling, Nag Ltd.

Definition at line 56 of file snrm2.f.

56 *
57 * -- Reference BLAS level1 routine (version 3.4.0) --
58 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
59 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
60 * November 2011
61 *
62 * .. Scalar Arguments ..
63  INTEGER incx,n
64 * ..
65 * .. Array Arguments ..
66  REAL x(*)
67 * ..
68 *
69 * =====================================================================
70 *
71 * .. Parameters ..
72  REAL one,zero
73  parameter(one=1.0e+0,zero=0.0e+0)
74 * ..
75 * .. Local Scalars ..
76  REAL absxi,norm,scale,ssq
77  INTEGER ix
78 * ..
79 * .. Intrinsic Functions ..
80  INTRINSIC abs,sqrt
81 * ..
82  IF (n.LT.1 .OR. incx.LT.1) THEN
83  norm = zero
84  ELSE IF (n.EQ.1) THEN
85  norm = abs(x(1))
86  ELSE
87  scale = zero
88  ssq = one
89 * The following loop is equivalent to this call to the LAPACK
90 * auxiliary routine:
91 * CALL SLASSQ( N, X, INCX, SCALE, SSQ )
92 *
93  DO 10 ix = 1,1 + (n-1)*incx,incx
94  IF (x(ix).NE.zero) THEN
95  absxi = abs(x(ix))
96  IF (scale.LT.absxi) THEN
97  ssq = one + ssq* (scale/absxi)**2
98  scale = absxi
99  ELSE
100  ssq = ssq + (absxi/scale)**2
101  END IF
102  END IF
103  10 CONTINUE
104  norm = scale*sqrt(ssq)
105  END IF
106 *
107  snrm2 = norm
108  RETURN
109 *
110 * End of SNRM2.
111 *
real function snrm2(N, X, INCX)
SNRM2
Definition: snrm2.f:56

Here is the caller graph for this function: