Line | |
---|
1 | INTEGER FUNCTION IZAMAX(N,ZX,INCX) |
---|
2 | * .. Scalar Arguments .. |
---|
3 | INTEGER INCX,N |
---|
4 | * .. |
---|
5 | * .. Array Arguments .. |
---|
6 | DOUBLE COMPLEX ZX(*) |
---|
7 | * .. |
---|
8 | * |
---|
9 | * Purpose |
---|
10 | * ======= |
---|
11 | * |
---|
12 | * finds the index of element having max. absolute value. |
---|
13 | * jack dongarra, 1/15/85. |
---|
14 | * modified 3/93 to return if incx .le. 0. |
---|
15 | * modified 12/3/93, array(1) declarations changed to array(*) |
---|
16 | * |
---|
17 | * |
---|
18 | * .. Local Scalars .. |
---|
19 | DOUBLE PRECISION SMAX |
---|
20 | INTEGER I,IX |
---|
21 | * .. |
---|
22 | * .. External Functions .. |
---|
23 | DOUBLE PRECISION DCABS1 |
---|
24 | EXTERNAL DCABS1 |
---|
25 | * .. |
---|
26 | IZAMAX = 0 |
---|
27 | IF (N.LT.1 .OR. INCX.LE.0) RETURN |
---|
28 | IZAMAX = 1 |
---|
29 | IF (N.EQ.1) RETURN |
---|
30 | IF (INCX.EQ.1) GO TO 20 |
---|
31 | * |
---|
32 | * code for increment not equal to 1 |
---|
33 | * |
---|
34 | IX = 1 |
---|
35 | SMAX = DCABS1(ZX(1)) |
---|
36 | IX = IX + INCX |
---|
37 | DO 10 I = 2,N |
---|
38 | IF (DCABS1(ZX(IX)).LE.SMAX) GO TO 5 |
---|
39 | IZAMAX = I |
---|
40 | SMAX = DCABS1(ZX(IX)) |
---|
41 | 5 IX = IX + INCX |
---|
42 | 10 CONTINUE |
---|
43 | RETURN |
---|
44 | * |
---|
45 | * code for increment equal to 1 |
---|
46 | * |
---|
47 | 20 SMAX = DCABS1(ZX(1)) |
---|
48 | DO 30 I = 2,N |
---|
49 | IF (DCABS1(ZX(I)).LE.SMAX) GO TO 30 |
---|
50 | IZAMAX = I |
---|
51 | SMAX = DCABS1(ZX(I)) |
---|
52 | 30 CONTINUE |
---|
53 | RETURN |
---|
54 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.