LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ idamax()

integer function idamax ( integer  N,
double precision, dimension(*)  DX,
integer  INCX 
)

IDAMAX

Purpose:
    IDAMAX finds the index of the first element having maximum absolute value.
Parameters
[in]N
          N is INTEGER
         number of elements in input vector(s)
[in]DX
          DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
[in]INCX
          INCX is INTEGER
         storage spacing between elements of DX
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
     jack dongarra, linpack, 3/11/78.
     modified 3/93 to return if incx .le. 0.
     modified 12/3/93, array(1) declarations changed to array(*)

Definition at line 70 of file idamax.f.

71 *
72 * -- Reference BLAS level1 routine --
73 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
74 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
75 *
76 * .. Scalar Arguments ..
77  INTEGER INCX,N
78 * ..
79 * .. Array Arguments ..
80  DOUBLE PRECISION DX(*)
81 * ..
82 *
83 * =====================================================================
84 *
85 * .. Local Scalars ..
86  DOUBLE PRECISION DMAX
87  INTEGER I,IX
88 * ..
89 * .. Intrinsic Functions ..
90  INTRINSIC dabs
91 * ..
92  idamax = 0
93  IF (n.LT.1 .OR. incx.LE.0) RETURN
94  idamax = 1
95  IF (n.EQ.1) RETURN
96  IF (incx.EQ.1) THEN
97 *
98 * code for increment equal to 1
99 *
100  dmax = dabs(dx(1))
101  DO i = 2,n
102  IF (dabs(dx(i)).GT.dmax) THEN
103  idamax = i
104  dmax = dabs(dx(i))
105  END IF
106  END DO
107  ELSE
108 *
109 * code for increment not equal to 1
110 *
111  ix = 1
112  dmax = dabs(dx(1))
113  ix = ix + incx
114  DO i = 2,n
115  IF (dabs(dx(ix)).GT.dmax) THEN
116  idamax = i
117  dmax = dabs(dx(ix))
118  END IF
119  ix = ix + incx
120  END DO
121  END IF
122  RETURN
123 *
124 * End of IDAMAX
125 *
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:71
Here is the caller graph for this function: