PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
icmax1.f
Go to the documentation of this file.
1  INTEGER FUNCTION icmax1( N, CX, INCX )
2 *
3 * -- LAPACK auxiliary routine (version 3.2) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
6 *
7 * .. Scalar Arguments ..
8  INTEGER incx, n
9 * ..
10 * .. Array Arguments ..
11  COMPLEX cx( * )
12 * ..
13 *
14 * Purpose
15 * =======
16 *
17 * ICMAX1 finds the index of the element whose real part has maximum
18 * absolute value.
19 *
20 * Based on ICAMAX from Level 1 BLAS.
21 * The change is to use the 'genuine' absolute value.
22 *
23 * Contributed by Nick Higham for use with CLACON.
24 *
25 * Arguments
26 * =========
27 *
28 * N (input) INTEGER
29 * The number of elements in the vector CX.
30 *
31 * CX (input) COMPLEX array, dimension (N)
32 * The vector whose elements will be summed.
33 *
34 * INCX (input) INTEGER
35 * The spacing between successive values of CX. INCX >= 1.
36 *
37 * =====================================================================
38 *
39 * .. Local Scalars ..
40  INTEGER i, ix
41  REAL smax
42  COMPLEX zdum
43 * ..
44 * .. Intrinsic Functions ..
45  INTRINSIC abs
46 * ..
47 * .. Statement Functions ..
48  REAL cabs1
49 * ..
50 * .. Statement Function definitions ..
51 *
52 * NEXT LINE IS THE ONLY MODIFICATION.
53  cabs1( zdum ) = abs( zdum )
54 * ..
55 * .. Executable Statements ..
56 *
57  icmax1 = 0
58  IF( n.LT.1 )
59  $ return
60  icmax1 = 1
61  IF( n.EQ.1 )
62  $ return
63  IF( incx.EQ.1 )
64  $ go to 30
65 *
66 * CODE FOR INCREMENT NOT EQUAL TO 1
67 *
68  ix = 1
69  smax = cabs1( cx( 1 ) )
70  ix = ix + incx
71  DO 20 i = 2, n
72  IF( cabs1( cx( ix ) ).LE.smax )
73  $ go to 10
74  icmax1 = i
75  smax = cabs1( cx( ix ) )
76  10 continue
77  ix = ix + incx
78  20 continue
79  return
80 *
81 * CODE FOR INCREMENT EQUAL TO 1
82 *
83  30 continue
84  smax = cabs1( cx( 1 ) )
85  DO 40 i = 2, n
86  IF( cabs1( cx( i ) ).LE.smax )
87  $ go to 40
88  icmax1 = i
89  smax = cabs1( cx( i ) )
90  40 continue
91  return
92 *
93 * End of ICMAX1
94 *
95  END