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