Add some basic letsimp tests based on bug #3950
[maxima.git] / share / colnew / fortran / idamax.f
blob59d80dc41ca7fed968ead305eaccd44bbab288f7
1 integer function idamax(n,dx,incx)
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(*)
8 double precision dx(*),dmax
9 integer i,incx,ix,n
11 idamax = 0
12 if( n.lt.1 .or. incx.le.0 ) return
13 idamax = 1
14 if(n.eq.1)return
15 if(incx.eq.1)go to 20
17 c code for increment not equal to 1
19 ix = 1
20 dmax = dabs(dx(1))
21 ix = ix + incx
22 do 10 i = 2,n
23 if(dabs(dx(ix)).le.dmax) go to 5
24 idamax = i
25 dmax = dabs(dx(ix))
26 5 ix = ix + incx
27 10 continue
28 return
30 c code for increment equal to 1
32 20 dmax = dabs(dx(1))
33 do 30 i = 2,n
34 if(dabs(dx(i)).le.dmax) go to 30
35 idamax = i
36 dmax = dabs(dx(i))
37 30 continue
38 return
39 end