LAPACK  3.9.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.
Date
November 2017
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 73 of file idamax.f.

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