aboutsummaryrefslogtreecommitdiff
path: root/sys/vops/ahiv.gx
blob: ba6d487a7a8f442821d8911fb9214bdb140521eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

# AHIV -- Compute the high value (maximum) of a vector.

PIXEL procedure ahiv$t (a, npix)

PIXEL	a[ARB]
int	npix
PIXEL	high, pixval
$if (datatype == x)
real	abs_high
$endif
int	i

begin
	high = a[1]
	$if (datatype == x)
	abs_high = abs (high)
	$endif

	do i = 1, npix {
	    pixval = a[i]
	    $if (datatype == x)
	    if (abs (pixval) > abs_high) {
		high = pixval
		abs_high = abs (high)
	    }
	    $else
	    if (pixval > high)
		high = pixval
	    $endif
	}

	return (high)
end