LAPACK  3.9.1
LAPACK: Linear Algebra PACKage
dznrm2.f
Go to the documentation of this file.
1 *> \brief \b DZNRM2
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * DOUBLE PRECISION FUNCTION DZNRM2(N,X,INCX)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX,N
15 * ..
16 * .. Array Arguments ..
17 * COMPLEX*16 X(*)
18 * ..
19 *
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 *> DZNRM2 returns the euclidean norm of a vector via the function
27 *> name, so that
28 *>
29 *> DZNRM2 := sqrt( x**H*x )
30 *> \endverbatim
31 *
32 * Arguments:
33 * ==========
34 *
35 *> \param[in] N
36 *> \verbatim
37 *> N is INTEGER
38 *> number of elements in input vector(s)
39 *> \endverbatim
40 *>
41 *> \param[in] X
42 *> \verbatim
43 *> X is COMPLEX*16 array, dimension (N)
44 *> complex vector with N elements
45 *> \endverbatim
46 *>
47 *> \param[in] INCX
48 *> \verbatim
49 *> INCX is INTEGER
50 *> storage spacing between elements of X
51 *> \endverbatim
52 *
53 * Authors:
54 * ========
55 *
56 *> \author Univ. of Tennessee
57 *> \author Univ. of California Berkeley
58 *> \author Univ. of Colorado Denver
59 *> \author NAG Ltd.
60 *
61 *> \ingroup double_blas_level1
62 *
63 *> \par Further Details:
64 * =====================
65 *>
66 *> \verbatim
67 *>
68 *> -- This version written on 25-October-1982.
69 *> Modified on 14-October-1993 to inline the call to ZLASSQ.
70 *> Sven Hammarling, Nag Ltd.
71 *> \endverbatim
72 *>
73 * =====================================================================
74  DOUBLE PRECISION FUNCTION dznrm2(N,X,INCX)
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*16 x(*)
85 * ..
86 *
87 * =====================================================================
88 *
89 * .. Parameters ..
90  DOUBLE PRECISION one,zero
91  parameter(one=1.0d+0,zero=0.0d+0)
92 * ..
93 * .. Local Scalars ..
94  DOUBLE PRECISION norm,scale,ssq,temp
95  INTEGER ix
96 * ..
97 * .. Intrinsic Functions ..
98  INTRINSIC abs,dble,dimag,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 ZLASSQ( N, X, INCX, SCALE, SSQ )
108 *
109  DO 10 ix = 1,1 + (n-1)*incx,incx
110  IF (dble(x(ix)).NE.zero) THEN
111  temp = abs(dble(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 (dimag(x(ix)).NE.zero) THEN
120  temp = abs(dimag(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  dznrm2 = norm
133  RETURN
134 *
135 * End of DZNRM2.
136 *
137  END
double precision function dznrm2(N, X, INCX)
DZNRM2
Definition: dznrm2.f:75