LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
izamax.f
Go to the documentation of this file.
1 *> \brief \b IZAMAX
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * INTEGER FUNCTION IZAMAX(N,ZX,INCX)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX,N
15 * ..
16 * .. Array Arguments ..
17 * COMPLEX*16 ZX(*)
18 * ..
19 *
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 *> IZAMAX finds the index of element having max. absolute value.
27 *> \endverbatim
28 *
29 * Authors:
30 * ========
31 *
32 *> \author Univ. of Tennessee
33 *> \author Univ. of California Berkeley
34 *> \author Univ. of Colorado Denver
35 *> \author NAG Ltd.
36 *
37 *> \date November 2011
38 *
39 *> \ingroup aux_blas
40 *
41 *> \par Further Details:
42 * =====================
43 *>
44 *> \verbatim
45 *>
46 *> jack dongarra, 1/15/85.
47 *> modified 3/93 to return if incx .le. 0.
48 *> modified 12/3/93, array(1) declarations changed to array(*)
49 *> \endverbatim
50 *>
51 * =====================================================================
52  INTEGER FUNCTION izamax(N,ZX,INCX)
53 *
54 * -- Reference BLAS level1 routine (version 3.4.0) --
55 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
56 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
57 * November 2011
58 *
59 * .. Scalar Arguments ..
60  INTEGER incx,n
61 * ..
62 * .. Array Arguments ..
63  COMPLEX*16 zx(*)
64 * ..
65 *
66 * =====================================================================
67 *
68 * .. Local Scalars ..
69  DOUBLE PRECISION dmax
70  INTEGER i,ix
71 * ..
72 * .. External Functions ..
73  DOUBLE PRECISION dcabs1
74  EXTERNAL dcabs1
75 * ..
76  izamax = 0
77  IF (n.LT.1 .OR. incx.LE.0) return
78  izamax = 1
79  IF (n.EQ.1) return
80  IF (incx.EQ.1) THEN
81 *
82 * code for increment equal to 1
83 *
84  dmax = dcabs1(zx(1))
85  DO i = 2,n
86  IF (dcabs1(zx(i)).GT.dmax) THEN
87  izamax = i
88  dmax = dcabs1(zx(i))
89  END IF
90  END DO
91  ELSE
92 *
93 * code for increment not equal to 1
94 *
95  ix = 1
96  dmax = dcabs1(zx(1))
97  ix = ix + incx
98  DO i = 2,n
99  IF (dcabs1(zx(ix)).GT.dmax) THEN
100  izamax = i
101  dmax = dcabs1(zx(ix))
102  END IF
103  ix = ix + incx
104  END DO
105  END IF
106  return
107  END