LAPACK
3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
idamax.f
Go to the documentation of this file.
1
*> \brief \b IDAMAX
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 IDAMAX(N,DX,INCX)
12
*
13
* .. Scalar Arguments ..
14
* INTEGER INCX,N
15
* ..
16
* .. Array Arguments ..
17
* DOUBLE PRECISION DX(*)
18
* ..
19
*
20
*
21
*> \par Purpose:
22
* =============
23
*>
24
*> \verbatim
25
*>
26
*> IDAMAX finds the index of the first element having maximum absolute value.
27
*> \endverbatim
28
*
29
* Arguments:
30
* ==========
31
*
32
*> \param[in] N
33
*> \verbatim
34
*> N is INTEGER
35
*> number of elements in input vector(s)
36
*> \endverbatim
37
*>
38
*> \param[in] DX
39
*> \verbatim
40
*> DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
41
*> \endverbatim
42
*>
43
*> \param[in] INCX
44
*> \verbatim
45
*> INCX is INTEGER
46
*> storage spacing between elements of DX
47
*> \endverbatim
48
*
49
* Authors:
50
* ========
51
*
52
*> \author Univ. of Tennessee
53
*> \author Univ. of California Berkeley
54
*> \author Univ. of Colorado Denver
55
*> \author NAG Ltd.
56
*
57
*> \ingroup iamax
58
*
59
*> \par Further Details:
60
* =====================
61
*>
62
*> \verbatim
63
*>
64
*> jack dongarra, linpack, 3/11/78.
65
*> modified 3/93 to return if incx .le. 0.
66
*> modified 12/3/93, array(1) declarations changed to array(*)
67
*> \endverbatim
68
*>
69
* =====================================================================
70
INTEGER
FUNCTION
idamax
(N,DX,INCX)
71
*
72
* -- Reference BLAS level1 routine --
73
* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
74
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
75
*
76
* .. Scalar Arguments ..
77
INTEGER
incx,n
78
* ..
79
* .. Array Arguments ..
80
DOUBLE PRECISION
dx(*)
81
* ..
82
*
83
* =====================================================================
84
*
85
* .. Local Scalars ..
86
DOUBLE PRECISION
dmax
87
INTEGER
i,ix
88
* ..
89
* .. Intrinsic Functions ..
90
INTRINSIC
dabs
91
* ..
92
idamax
= 0
93
IF
(n.LT.1 .OR. incx.LE.0)
RETURN
94
idamax
= 1
95
IF
(n.EQ.1)
RETURN
96
IF
(incx.EQ.1)
THEN
97
*
98
* code for increment equal to 1
99
*
100
dmax = dabs(dx(1))
101
DO
i = 2,n
102
IF
(dabs(dx(i)).GT.dmax)
THEN
103
idamax
= i
104
dmax = dabs(dx(i))
105
END IF
106
END DO
107
ELSE
108
*
109
* code for increment not equal to 1
110
*
111
ix = 1
112
dmax = dabs(dx(1))
113
ix = ix + incx
114
DO
i = 2,n
115
IF
(dabs(dx(ix)).GT.dmax)
THEN
116
idamax
= i
117
dmax = dabs(dx(ix))
118
END IF
119
ix = ix + incx
120
END DO
121
END IF
122
RETURN
123
*
124
* End of IDAMAX
125
*
126
END
idamax
integer function idamax(n, dx, incx)
IDAMAX
Definition
idamax.f:71
BLAS
SRC
idamax.f
Generated on Tue Nov 28 2023 11:55:04 for LAPACK by
1.9.7