Contents


NAME

     icamax - return the index of the element with largest  abso-
     lute value.

SYNOPSIS

     INTEGER FUNCTION ICAMAX(N, X, INCX)

     COMPLEX X(*)
     INTEGER N, INCX

     INTEGER*8 FUNCTION ICAMAX_64(N, X, INCX)

     COMPLEX X(*)
     INTEGER*8 N, INCX

  F95 INTERFACE
     INTEGER FUNCTION IAMAX([N], X, [INCX])

     COMPLEX, DIMENSION(:) :: X
     INTEGER :: N, INCX

     INTEGER(8) FUNCTION IAMAX_64([N], X, [INCX])

     COMPLEX, DIMENSION(:) :: X
     INTEGER(8) :: N, INCX

  C INTERFACE
     #include <sunperf.h>

     int icamax(int n, complex *x, int incx);

     long icamax_64(long n, complex *x, long incx);

PURPOSE

     icamax return the index of the element  in  x  with  largest
     absolute  value where x is an n-vector and absolute value is
     defined as the sum of the absolute value of  the  real  part
     and the absolute value of the imaginary part.

ARGUMENTS

     N (input)
               On entry, N specifies the number  of  elements  in
               the  vector.   N must be at least one for the sub-
               routine to have any visible effect.  Unchanged  on
               exit.

     X (input)
               ( 1 + ( n - 1 )*abs( INCX  )  ).   On  entry,  the
               incremented  array  X  must  contain the vector x.
               Unchanged on exit.

     INCX (input)
               On entry, INCX specifies  the  increment  for  the
               elements  of X.  INCX must be positive.  Unchanged
               on exit.

NOTES

     If the vector contains all NaNs, the function returns 1.  If
     the  vector  contains  valid complex numbers and one or more
     NaNs, the routine returns the index of the element  contain-
     ing the largest absolute value.