LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ scnrm2()

real function scnrm2 ( integer  N,
complex, 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 )
Parameters
[in]N
          N is INTEGER
         number of elements in input vector(s)
[in]X
          X is COMPLEX array, dimension (N)
         complex vector with N elements
[in]INCX
          INCX is INTEGER
         storage spacing between elements of X
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
  -- This version written on 25-October-1982.
     Modified on 14-October-1993 to inline the call to CLASSQ.
     Sven Hammarling, Nag Ltd.

Definition at line 74 of file scnrm2.f.

75 *
76 * -- Reference BLAS level1 routine --
77 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
78 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
79 *
80 * .. Scalar Arguments ..
81  INTEGER INCX,N
82 * ..
83 * .. Array Arguments ..
84  COMPLEX X(*)
85 * ..
86 *
87 * =====================================================================
88 *
89 * .. Parameters ..
90  REAL ONE,ZERO
91  parameter(one=1.0e+0,zero=0.0e+0)
92 * ..
93 * .. Local Scalars ..
94  REAL NORM,SCALE,SSQ,TEMP
95  INTEGER IX
96 * ..
97 * .. Intrinsic Functions ..
98  INTRINSIC abs,aimag,real,sqrt
99 * ..
100  IF (n.LT.1 .OR. incx.LT.1) THEN
101  norm = zero
102  ELSE
103  scale = zero
104  ssq = one
105 * The following loop is equivalent to this call to the LAPACK
106 * auxiliary routine:
107 * CALL CLASSQ( N, X, INCX, SCALE, SSQ )
108 *
109  DO 10 ix = 1,1 + (n-1)*incx,incx
110  IF (real(x(ix)).NE.zero) THEN
111  temp = abs(real(x(ix)))
112  IF (scale.LT.temp) THEN
113  ssq = one + ssq* (scale/temp)**2
114  scale = temp
115  ELSE
116  ssq = ssq + (temp/scale)**2
117  END IF
118  END IF
119  IF (aimag(x(ix)).NE.zero) THEN
120  temp = abs(aimag(x(ix)))
121  IF (scale.LT.temp) THEN
122  ssq = one + ssq* (scale/temp)**2
123  scale = temp
124  ELSE
125  ssq = ssq + (temp/scale)**2
126  END IF
127  END IF
128  10 CONTINUE
129  norm = scale*sqrt(ssq)
130  END IF
131 *
132  scnrm2 = norm
133  RETURN
134 *
135 * End of SCNRM2.
136 *
real function scnrm2(N, X, INCX)
SCNRM2
Definition: scnrm2.f:75
Here is the caller graph for this function: