3 doublereal snrm2_(integer *n, real *x, integer *incx)
5 /* System generated locals */
9 /* Builtin functions */
10 double sqrt(doublereal);
14 real ssq, norm, scale, absxi;
16 /* .. Scalar Arguments .. */
18 /* .. Array Arguments .. */
24 /* SNRM2 returns the euclidean norm of a vector via the function */
27 /* SNRM2 := sqrt( x'*x ). */
32 /* -- This version written on 25-October-1982. */
33 /* Modified on 14-October-1993 to inline the call to SLASSQ. */
34 /* Sven Hammarling, Nag Ltd. */
37 /* .. Parameters .. */
39 /* .. Local Scalars .. */
41 /* .. Intrinsic Functions .. */
43 /* Parameter adjustments */
47 if (*n < 1 || *incx < 1) {
54 /* The following loop is equivalent to this call to the LAPACK */
55 /* auxiliary routine: */
56 /* CALL SLASSQ( N, X, INCX, SCALE, SSQ ) */
58 i__1 = (*n - 1) * *incx + 1;
60 for (ix = 1; i__2 < 0 ? ix >= i__1 : ix <= i__1; ix += i__2) {
62 absxi = (r__1 = x[ix], dabs(r__1));
64 /* Computing 2nd power */
66 ssq = ssq * (r__1 * r__1) + 1.f;
69 /* Computing 2nd power */
76 norm = scale * sqrt(ssq);