izamax Function

public pure function izamax(n, zx, incx)

NAME

izamax(3f) - [BLAS:AUX_BLAS]

SYNOPSIS

 integer function izamax(n,zx,incx)

   .. Scalar Arguments ..
   integer,intent(in)              :: incx,n
   ..
   .. Array Arguments ..
   complex(kind=real64),intent(in) :: zx(*)
   ..

DEFINITION

 IZAMAX finds the index of the first element having maximum |Re(.)|
 + |Im(.)|

OPTIONS

N number of elements in input vector(s) ZX array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) INCX storage spacing between elements of ZX

RETURNS

IZAMAX index of the first element having maximum

AUTHORS

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

date:November 2017

FURTHER DETAILS

  jack dongarra, 1/15/85.
  modified 3/93 to return if incx .le. 0.
  modified 12/3/93, array(1) declarations changed to array(*)

SEE ALSO

Online html documentation available at
http://www.netlib.org/lapack/explore-html/

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
complex(kind=real64), intent(in) :: zx(*)
integer, intent(in) :: incx

Return Value integer


Contents

Source Code


Variables

Type Visibility Attributes Name Initial
double precision, public :: dmax
integer, public :: i
integer, public :: ix

Source Code

pure integer function izamax(n,zx,incx)
implicit none
!
!  -- Reference BLAS level1 routine (version 3.8.0) --
!  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
!  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
!     November 2017
!
!     .. Scalar Arguments ..
      integer,intent(in)              :: incx,n
!     ..
!     .. Array Arguments ..
      complex(kind=real64),intent(in) :: zx(*)
!     ..
!
!  =====================================================================
!
!     .. Local Scalars ..
      double precision dmax
      integer i,ix
!     ..
!     .. External Functions ..  DOUBLE PRECISION DCABS1
!     ..
      izamax = 0
      if (n.lt.1 .or. incx.le.0) return
      izamax = 1
      if (n.eq.1) return
      if (incx.eq.1) then
!
!        code for increment equal to 1
!
         dmax = dcabs1(zx(1))
         do i = 2,n
            if (dcabs1(zx(i)).gt.dmax) then
               izamax = i
               dmax = dcabs1(zx(i))
            endif
         enddo
      else
!
!        code for increment not equal to 1
!
         ix = 1
         dmax = dcabs1(zx(1))
         ix = ix + incx
         do i = 2,n
            if (dcabs1(zx(ix)).gt.dmax) then
               izamax = i
               dmax = dcabs1(zx(ix))
            endif
            ix = ix + incx
         enddo
      endif

      end function izamax