Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2789_MathNetNumerics-Exploration/HeuristicLab.Algorithms.DataAnalysis.Experimental/sbart/dznrm2.f @ 17328

Last change on this file since 17328 was 15457, checked in by gkronber, 7 years ago

#2789 added Finbarr O'Sullivan smoothing spline code

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