3 doublereal dnrm2_(integer *n, doublereal *x, integer *incx)
5 /* System generated locals */
7 doublereal ret_val, d__1;
9 /* Builtin functions */
10 double sqrt(doublereal);
14 doublereal ssq, norm, scale, absxi;
16 /* .. Scalar Arguments .. */
18 /* .. Array Arguments .. */
24 /* DNRM2 returns the euclidean norm of a vector via the function */
27 /* DNRM2 := sqrt( x'*x ) */
30 /* -- This version written on 25-October-1982. */
31 /* Modified on 14-October-1993 to inline the call to DLASSQ. */
32 /* Sven Hammarling, Nag Ltd. */
35 /* .. Parameters .. */
37 /* .. Local Scalars .. */
39 /* .. Intrinsic Functions .. */
41 /* Parameter adjustments */
45 if (*n < 1 || *incx < 1) {
52 /* The following loop is equivalent to this call to the LAPACK */
53 /* auxiliary routine: */
54 /* CALL DLASSQ( N, X, INCX, SCALE, SSQ ) */
56 i__1 = (*n - 1) * *incx + 1;
58 for (ix = 1; i__2 < 0 ? ix >= i__1 : ix <= i__1; ix += i__2) {
60 absxi = (d__1 = x[ix], abs(d__1));
62 /* Computing 2nd power */
64 ssq = ssq * (d__1 * d__1) + 1.;
67 /* Computing 2nd power */
74 norm = scale * sqrt(ssq);