diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/vops/lz/apowkr.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/vops/lz/apowkr.x')
-rw-r--r-- | sys/vops/lz/apowkr.x | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/vops/lz/apowkr.x b/sys/vops/lz/apowkr.x new file mode 100644 index 00000000..b22be6b7 --- /dev/null +++ b/sys/vops/lz/apowkr.x @@ -0,0 +1,34 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# APOWK -- Compute a ** b, where b is a constant of type INT (generic). + +procedure apowkr (a, b, c, npix) + +real a[ARB], c[ARB] +int b +int npix, i + +begin + # Optimize the code for the various special cases. We assume that the + # compiler is intelligent enough to recognize the special cases if the + # power is expressed as an integer constant. + + switch (b) { + case 0: + call amovkr (1.0, c, npix) + case 1: + call amovr (a, c, npix) + case 2: + do i = 1, npix + c[i] = a[i] ** 2 + case 3: + do i = 1, npix + c[i] = a[i] ** 3 + case 4: + do i = 1, npix + c[i] = a[i] ** 4 + default: + do i = 1, npix + c[i] = a[i] ** b + } +end |