Last change
on this file since 23 was
4,
checked in by dumas, 10 years ago
|
initial import GRISLI trunk
|
File size:
912 bytes
|
Line | |
---|
1 | integer function isamax(n,sx,incx) |
---|
2 | c |
---|
3 | c finds the index of element having max. absolute value. |
---|
4 | c jack dongarra, linpack, 3/11/78. |
---|
5 | c modified 3/93 to return if incx .le. 0. |
---|
6 | c modified 12/3/93, array(1) declarations changed to array(*) |
---|
7 | c |
---|
8 | real sx(*),smax |
---|
9 | integer i,incx,ix,n |
---|
10 | c |
---|
11 | isamax = 0 |
---|
12 | if( n.lt.1 .or. incx.le.0 ) return |
---|
13 | isamax = 1 |
---|
14 | if(n.eq.1)return |
---|
15 | if(incx.eq.1)go to 20 |
---|
16 | c |
---|
17 | c code for increment not equal to 1 |
---|
18 | c |
---|
19 | ix = 1 |
---|
20 | smax = abs(sx(1)) |
---|
21 | ix = ix + incx |
---|
22 | do 10 i = 2,n |
---|
23 | if(abs(sx(ix)).le.smax) go to 5 |
---|
24 | isamax = i |
---|
25 | smax = abs(sx(ix)) |
---|
26 | 5 ix = ix + incx |
---|
27 | 10 continue |
---|
28 | return |
---|
29 | c |
---|
30 | c code for increment equal to 1 |
---|
31 | c |
---|
32 | 20 smax = abs(sx(1)) |
---|
33 | do 30 i = 2,n |
---|
34 | if(abs(sx(i)).le.smax) go to 30 |
---|
35 | isamax = i |
---|
36 | smax = abs(sx(i)) |
---|
37 | 30 continue |
---|
38 | return |
---|
39 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.