Statistiques
| Révision :

root / src / blas / dznrm2.f @ 4

Historique | Voir | Annoter | Télécharger (1,82 ko)

1 1 pfleura2
      DOUBLE PRECISION FUNCTION DZNRM2(N,X,INCX)
2 1 pfleura2
*     .. Scalar Arguments ..
3 1 pfleura2
      INTEGER INCX,N
4 1 pfleura2
*     ..
5 1 pfleura2
*     .. Array Arguments ..
6 1 pfleura2
      DOUBLE COMPLEX X(*)
7 1 pfleura2
*     ..
8 1 pfleura2
*
9 1 pfleura2
*  Purpose
10 1 pfleura2
*  =======
11 1 pfleura2
*
12 1 pfleura2
*  DZNRM2 returns the euclidean norm of a vector via the function
13 1 pfleura2
*  name, so that
14 1 pfleura2
*
15 1 pfleura2
*     DZNRM2 := sqrt( conjg( x' )*x )
16 1 pfleura2
*
17 1 pfleura2
*
18 1 pfleura2
*  -- This version written on 25-October-1982.
19 1 pfleura2
*     Modified on 14-October-1993 to inline the call to ZLASSQ.
20 1 pfleura2
*     Sven Hammarling, Nag Ltd.
21 1 pfleura2
*
22 1 pfleura2
*
23 1 pfleura2
*     .. Parameters ..
24 1 pfleura2
      DOUBLE PRECISION ONE,ZERO
25 1 pfleura2
      PARAMETER (ONE=1.0D+0,ZERO=0.0D+0)
26 1 pfleura2
*     ..
27 1 pfleura2
*     .. Local Scalars ..
28 1 pfleura2
      DOUBLE PRECISION NORM,SCALE,SSQ,TEMP
29 1 pfleura2
      INTEGER IX
30 1 pfleura2
*     ..
31 1 pfleura2
*     .. Intrinsic Functions ..
32 1 pfleura2
      INTRINSIC ABS,DBLE,DIMAG,SQRT
33 1 pfleura2
*     ..
34 1 pfleura2
      IF (N.LT.1 .OR. INCX.LT.1) THEN
35 1 pfleura2
          NORM = ZERO
36 1 pfleura2
      ELSE
37 1 pfleura2
          SCALE = ZERO
38 1 pfleura2
          SSQ = ONE
39 1 pfleura2
*        The following loop is equivalent to this call to the LAPACK
40 1 pfleura2
*        auxiliary routine:
41 1 pfleura2
*        CALL ZLASSQ( N, X, INCX, SCALE, SSQ )
42 1 pfleura2
*
43 1 pfleura2
          DO 10 IX = 1,1 + (N-1)*INCX,INCX
44 1 pfleura2
              IF (DBLE(X(IX)).NE.ZERO) THEN
45 1 pfleura2
                  TEMP = ABS(DBLE(X(IX)))
46 1 pfleura2
                  IF (SCALE.LT.TEMP) THEN
47 1 pfleura2
                      SSQ = ONE + SSQ* (SCALE/TEMP)**2
48 1 pfleura2
                      SCALE = TEMP
49 1 pfleura2
                  ELSE
50 1 pfleura2
                      SSQ = SSQ + (TEMP/SCALE)**2
51 1 pfleura2
                  END IF
52 1 pfleura2
              END IF
53 1 pfleura2
              IF (DIMAG(X(IX)).NE.ZERO) THEN
54 1 pfleura2
                  TEMP = ABS(DIMAG(X(IX)))
55 1 pfleura2
                  IF (SCALE.LT.TEMP) THEN
56 1 pfleura2
                      SSQ = ONE + SSQ* (SCALE/TEMP)**2
57 1 pfleura2
                      SCALE = TEMP
58 1 pfleura2
                  ELSE
59 1 pfleura2
                      SSQ = SSQ + (TEMP/SCALE)**2
60 1 pfleura2
                  END IF
61 1 pfleura2
              END IF
62 1 pfleura2
   10     CONTINUE
63 1 pfleura2
          NORM = SCALE*SQRT(SSQ)
64 1 pfleura2
      END IF
65 1 pfleura2
*
66 1 pfleura2
      DZNRM2 = NORM
67 1 pfleura2
      RETURN
68 1 pfleura2
*
69 1 pfleura2
*     End of DZNRM2.
70 1 pfleura2
*
71 1 pfleura2
      END