1 Integer Function IAMAX( N, IX, IncX) 2C::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 3C $Id$ 4C::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 5C NAME 6C iamax -- maximum absolute value of an integer vector 7C 8C SYNOPSIS 9 Implicit NONE 10 Integer N, IX(1), IncX 11C 12C ARGUMENTS 13C N Number of elements to check (input) 14C IX Integer vector (input) 15C IncX Skip distance between elements of IX (input) 16C 17C DESCRIPTION 18C Returns the maximum absolute value of the vector. 19C::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 20C LOCAL VARIABLES 21C IPtr Pointer to current element of IX 22C j Counter over number of "actIXe" elements 23C 24 Integer IPtr, j 25C 26C Initialize the max 27C 28 IAMax = 0 29C 30C Get out if there is no work 31C 32 If (N .le. 0) Return 33C 34C Handle increment = 1 differently 35C 36 If (IncX .eq. 1) then 37 Do 100 IPtr = 1, N 38 IAMax = Max(IAMax, Abs(IX(IPtr))) 39 100 Continue 40 Else 41 IPtr = 1 42 If (IncX .lt. 0) IPtr = (-N+1) * IncX + 1 43 Do 200 j = 1, N 44 IAMax = Max(IAMax, Abs(IX(IPtr))) 45 IPtr = IPtr + IncX 46 200 Continue 47 EndIf 48C 49 Return 50 End 51