LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

◆ 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. !>
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Nick Higham for use with CLACON.

Definition at line 78 of file icmax1.f.

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