LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
idamax.f File Reference

Go to the source code of this file.

Functions/Subroutines

integer function idamax (N, DX, INCX)
 IDAMAX More...
 

Function/Subroutine Documentation

integer function idamax ( integer  N,
double precision, dimension(*)  DX,
integer  INCX 
)

IDAMAX

Purpose:
    IDAMAX finds the index of element having max. absolute value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
     jack dongarra, linpack, 3/11/78.
     modified 3/93 to return if incx .le. 0.
     modified 12/3/93, array(1) declarations changed to array(*)

Definition at line 53 of file idamax.f.

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  DOUBLE PRECISION dx(*)
64 * ..
65 *
66 * =====================================================================
67 *
68 * .. Local Scalars ..
69  DOUBLE PRECISION dmax
70  INTEGER i,ix
71 * ..
72 * .. Intrinsic Functions ..
73  INTRINSIC dabs
74 * ..
75  idamax = 0
76  IF (n.LT.1 .OR. incx.LE.0) RETURN
77  idamax = 1
78  IF (n.EQ.1) RETURN
79  IF (incx.EQ.1) THEN
80 *
81 * code for increment equal to 1
82 *
83  dmax = dabs(dx(1))
84  DO i = 2,n
85  IF (dabs(dx(i)).GT.dmax) THEN
86  idamax = i
87  dmax = dabs(dx(i))
88  END IF
89  END DO
90  ELSE
91 *
92 * code for increment not equal to 1
93 *
94  ix = 1
95  dmax = dabs(dx(1))
96  ix = ix + incx
97  DO i = 2,n
98  IF (dabs(dx(ix)).GT.dmax) THEN
99  idamax = i
100  dmax = dabs(dx(ix))
101  END IF
102  ix = ix + incx
103  END DO
104  END IF
105  RETURN
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:53