LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ isamax()

integer function isamax ( integer  N,
real, dimension(*)  SX,
integer  INCX 
)

ISAMAX

Purpose:
    ISAMAX 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]SX
          SX is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
[in]INCX
          INCX is INTEGER
         storage spacing between elements of SX
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 isamax.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  REAL SX(*)
81 * ..
82 *
83 * =====================================================================
84 *
85 * .. Local Scalars ..
86  REAL SMAX
87  INTEGER I,IX
88 * ..
89 * .. Intrinsic Functions ..
90  INTRINSIC abs
91 * ..
92  isamax = 0
93  IF (n.LT.1 .OR. incx.LE.0) RETURN
94  isamax = 1
95  IF (n.EQ.1) RETURN
96  IF (incx.EQ.1) THEN
97 *
98 * code for increment equal to 1
99 *
100  smax = abs(sx(1))
101  DO i = 2,n
102  IF (abs(sx(i)).GT.smax) THEN
103  isamax = i
104  smax = abs(sx(i))
105  END IF
106  END DO
107  ELSE
108 *
109 * code for increment not equal to 1
110 *
111  ix = 1
112  smax = abs(sx(1))
113  ix = ix + incx
114  DO i = 2,n
115  IF (abs(sx(ix)).GT.smax) THEN
116  isamax = i
117  smax = abs(sx(ix))
118  END IF
119  ix = ix + incx
120  END DO
121  END IF
122  RETURN
123 *
124 * End of ISAMAX
125 *
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:71
Here is the caller graph for this function: