# i?amax

Finds the index of the element with maximum absolute value.

## Syntax

FORTRAN 77:

index = isamax(n, x, incx )

index = idamax(n, x, incx )

index = icamax(n, x, incx )

index = izamax(n, x, incx )

Fortran 95:

index = iamax(x)

## Description

Given a vector x, the i?amax functions return the position of the vector element `x(i)` that has the largest absolute value for real flavors, or the largest sum `|Re(x(i))|+|Im(x(i))|` for complex flavors.

If n is not positive, `0` is returned.

If more than one vector element is found with the same largest absolute value, the index of the first one encountered is returned.

## Input Parameters

n

  INTEGER. Specifies the order of the vector x.

x

  REAL for isamax

  DOUBLE PRECISION for idamax

  COMPLEX for icamax

  DOUBLE COMPLEX for izamax

  Array, DIMENSION at least `(1+(n-1)*abs(incx))`.

incx

  INTEGER. Specifies the increment for the elements of x.

## Output Parameters

index

  INTEGER. Contains the position of vector element x that has the largest absolute value.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or reconstructible arguments, see Fortran 95 Interface Conventions.

Specific details for the routine iamax interface are the following:

x

  Holds the vector of length (n).

Parent topic: BLAS Level 1 Routines