LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
icmax1.f
Go to the documentation of this file.
1*> \brief \b ICMAX1 finds the index of the first vector element of maximum absolute value.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ICMAX1 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/icmax1.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/icmax1.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/icmax1.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* INTEGER FUNCTION ICMAX1( N, CX, INCX )
20*
21* .. Scalar Arguments ..
22* INTEGER INCX, N
23* ..
24* .. Array Arguments ..
25* COMPLEX CX( * )
26* ..
27*
28*
29*> \par Purpose:
30* =============
31*>
32*> \verbatim
33*>
34*> ICMAX1 finds the index of the first vector element of maximum absolute value.
35*>
36*> Based on ICAMAX from Level 1 BLAS.
37*> The change is to use the 'genuine' absolute value.
38*> \endverbatim
39*
40* Arguments:
41* ==========
42*
43*> \param[in] N
44*> \verbatim
45*> N is INTEGER
46*> The number of elements in the vector CX.
47*> \endverbatim
48*>
49*> \param[in] CX
50*> \verbatim
51*> CX is COMPLEX array, dimension (N)
52*> The vector CX. The ICMAX1 function returns the index of its first
53*> element of maximum absolute value.
54*> \endverbatim
55*>
56*> \param[in] INCX
57*> \verbatim
58*> INCX is INTEGER
59*> The spacing between successive values of CX. INCX >= 1.
60*> \endverbatim
61*
62* Authors:
63* ========
64*
65*> \author Univ. of Tennessee
66*> \author Univ. of California Berkeley
67*> \author Univ. of Colorado Denver
68*> \author NAG Ltd.
69*
70*> \ingroup imax1
71*
72*> \par Contributors:
73* ==================
74*>
75*> Nick Higham for use with CLACON.
76*
77* =====================================================================
78 INTEGER FUNCTION icmax1( N, CX, INCX )
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*
136 END
integer function icmax1(n, cx, incx)
ICMAX1 finds the index of the first vector element of maximum absolute value.
Definition icmax1.f:79