LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

## ◆ icmax1()

 integer function icmax1 ( integer N, complex, dimension(*) CX, integer INCX )

ICMAX1 finds the index of the first vector element of maximum absolute value.

Download ICMAX1 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
ICMAX1 finds the index of the first vector element of maximum absolute value.

Based on ICAMAX from Level 1 BLAS.
The change is to use the 'genuine' absolute value.
Parameters
 [in] N N is INTEGER The number of elements in the vector CX. [in] CX CX is COMPLEX array, dimension (N) The vector CX. The ICMAX1 function returns the index of its first element of maximum absolute value. [in] INCX INCX is INTEGER The spacing between successive values of CX. INCX >= 1.
Contributors:
Nick Higham for use with CLACON.

Definition at line 80 of file icmax1.f.

81 *
82 * -- LAPACK auxiliary routine --
83 * -- LAPACK is a software package provided by Univ. of Tennessee, --
84 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
85 *
86 * .. Scalar Arguments ..
87  INTEGER INCX, N
88 * ..
89 * .. Array Arguments ..
90  COMPLEX CX(*)
91 * ..
92 *
93 * =====================================================================
94 *
95 * .. Local Scalars ..
96  REAL SMAX
97  INTEGER I, IX
98 * ..
99 * .. Intrinsic Functions ..
100  INTRINSIC abs
101 * ..
102 * .. Executable Statements ..
103 *
104  icmax1 = 0
105  IF (n.LT.1 .OR. incx.LE.0) RETURN
106  icmax1 = 1
107  IF (n.EQ.1) RETURN
108  IF (incx.EQ.1) THEN
109 *
110 * code for increment equal to 1
111 *
112  smax = abs(cx(1))
113  DO i = 2,n
114  IF (abs(cx(i)).GT.smax) THEN
115  icmax1 = i
116  smax = abs(cx(i))
117  END IF
118  END DO
119  ELSE
120 *
121 * code for increment not equal to 1
122 *
123  ix = 1
124  smax = abs(cx(1))
125  ix = ix + incx
126  DO i = 2,n
127  IF (abs(cx(ix)).GT.smax) THEN
128  icmax1 = i
129  smax = abs(cx(ix))
130  END IF
131  ix = ix + incx
132  END DO
133  END IF
134  RETURN
135 *
136 * End of ICMAX1
137 *
integer function icmax1(N, CX, INCX)
ICMAX1 finds the index of the first vector element of maximum absolute value.
Definition: icmax1.f:81