From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- noao/digiphot/daophot/allstar/dprectify.x | 74 +++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 noao/digiphot/daophot/allstar/dprectify.x (limited to 'noao/digiphot/daophot/allstar/dprectify.x') 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 -- cgit