aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/daophot/allstar/dprectify.x
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 /noao/digiphot/daophot/allstar/dprectify.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/digiphot/daophot/allstar/dprectify.x')
-rw-r--r--noao/digiphot/daophot/allstar/dprectify.x74
1 files changed, 74 insertions, 0 deletions
diff --git a/noao/digiphot/daophot/allstar/dprectify.x b/noao/digiphot/daophot/allstar/dprectify.x
new file mode 100644
index 00000000..5fd7c0db
--- /dev/null
+++ b/noao/digiphot/daophot/allstar/dprectify.x
@@ -0,0 +1,74 @@
+# DP_RECTIFY -- Shuffle a real vector based upon an input index vector using
+# dynamic memory.
+
+procedure dp_rectify (x, index, nitem)
+
+real x[ARB]
+int index[ARB]
+int nitem
+
+pointer sp, hold
+
+begin
+ call smark (sp)
+ call salloc (hold, nitem, TY_REAL)
+ call dp_dorect (x, Memr[hold], index, nitem)
+ call sfree (sp)
+end
+
+
+# DP_IRECTIFY -- Shuffle an integer vector based upon an input index vector
+# using dynamic memory.
+
+procedure dp_irectify (x, index, nitem)
+
+int x[ARB]
+int index[ARB]
+int nitem
+
+pointer sp, hold
+
+begin
+ call smark (sp)
+ call salloc (hold, nitem, TY_INT)
+ call dp_idorect (x, Memi[hold], index, nitem)
+ call sfree (sp)
+end
+
+
+# DP_DORECT -- Shuffle a vector based upon an input index vector using
+# a preallocated dummy array.
+
+procedure dp_dorect (x, hold, index, nitem)
+
+real x[ARB]
+real hold[ARB]
+int index[ARB]
+int nitem
+
+int i
+
+begin
+ call amovr (x, hold, nitem)
+ do i = 1, nitem
+ x[i] = hold[index[i]]
+end
+
+
+# DP_IDORECT -- Shuffle an integer vector based upon an input index vector
+# using a preallocated dummy array.
+
+procedure dp_idorect (x, hold, index, nitem)
+
+int x[ARB]
+int hold[ARB]
+int index[ARB]
+int nitem
+
+int i
+
+begin
+ call amovi (x, hold, nitem)
+ do i = 1, nitem
+ x[i] = hold[index[i]]
+end