CVM Class Library  8.1
This C++ class library encapsulates concepts of vector and different matrices including square, band, symmetric and hermitian ones in Euclidean space of real and complex numbers.
 All Classes Files Functions Variables Typedefs Friends Macros Pages
idamax.f
Go to the documentation of this file.
1 c BLAS routine missing in ACML and some other implementations
2 
3  integer function idamax(n,dx,incx)
4 c
5 c finds the index of element having max. absolute value.
6 c jack dongarra, linpack, 3/11/78.
7 c modified 3/93 to return if incx .le. 0.
8 c modified 12/3/93, array(1) declarations changed to array(*)
9 c
10  double precision dx(*),dmax
11  integer i,incx,ix,n
12 c
13  idamax = 0
14  if( n.lt.1 .or. incx.le.0 ) return
15  idamax = 1
16  if(n.eq.1)return
17  if(incx.eq.1)go to 20
18 c
19 c code for increment not equal to 1
20 c
21  ix = 1
22  dmax = dabs(dx(1))
23  ix = ix + incx
24  do 10 i = 2,n
25  if(dabs(dx(ix)).le.dmax) go to 5
26  idamax = i
27  dmax = dabs(dx(ix))
28  5 ix = ix + incx
29  10 continue
30  return
31 c
32 c code for increment equal to 1
33 c
34  20 dmax = dabs(dx(1))
35  do 30 i = 2,n
36  if(dabs(dx(i)).le.dmax) go to 30
37  idamax = i
38  dmax = dabs(dx(i))
39  30 continue
40  return
41  end