aboutsummaryrefslogtreecommitdiff
path: root/sys/vops/alui.gx
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/vops/alui.gx
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/vops/alui.gx')
-rw-r--r--sys/vops/alui.gx30
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/vops/alui.gx b/sys/vops/alui.gx
new file mode 100644
index 00000000..535dee9c
--- /dev/null
+++ b/sys/vops/alui.gx
@@ -0,0 +1,30 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+
+# ALUI -- Vector lookup and interpolate (linear). B[i] = A(X[i]).
+# No bounds checking is performed, but the case A(X[i])=NPIX (no fractional
+# part) is recognized and will not cause a reference off the right end of the
+# array. This is done in a way which will also cause execution to be faster
+# when the sample points are integral, i.e., fall exactly on data points in
+# the input array.
+
+procedure alui$t (a, b, x, npix)
+
+PIXEL a[ARB], b[ARB]
+real x[ARB], fraction, tol
+int npix, i, left_pixel
+
+begin
+ tol = EPSILONR * 5.0
+
+ do i = 1, npix {
+ left_pixel = int (x[i])
+ fraction = x[i] - real(left_pixel)
+ if (fraction < tol)
+ b[i] = a[left_pixel]
+ else
+ b[i] = a[left_pixel] * (1.0 - fraction) +
+ a[left_pixel+1] * fraction
+ }
+end