aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/dtoi/hdicfit/hdicadd.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/imred/dtoi/hdicfit/hdicadd.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/imred/dtoi/hdicfit/hdicadd.x')
-rw-r--r--noao/imred/dtoi/hdicfit/hdicadd.x47
1 files changed, 47 insertions, 0 deletions
diff --git a/noao/imred/dtoi/hdicfit/hdicadd.x b/noao/imred/dtoi/hdicfit/hdicadd.x
new file mode 100644
index 00000000..1fae152d
--- /dev/null
+++ b/noao/imred/dtoi/hdicfit/hdicadd.x
@@ -0,0 +1,47 @@
+include "hdicfit.h"
+
+# HDIC_ADDPOINT -- Add a density, exposure, weights point into the sample.
+
+procedure hdic_addpoint (ic,
+ nden, nexp, nwts, den, y, wts, userwts, x, wd, sdev, npts)
+
+pointer ic # Pointer to ic data structure
+real nden # New density value to be added
+real nexp # New exposure value to be added
+double nwts # New weight value to be added
+pointer den # Pointer to existing density array
+pointer y # Pointer to existing exposure array
+pointer wts # Pointer to existing wts array
+pointer userwts # Pointer to existing userwts array
+pointer x # Pointer to existing array of ind variables
+pointer wd # Pointer to flag array for deletion reasons
+pointer sdev # Pointer to standard deviation array
+int npts # Number of points, incremented on output
+
+begin
+ npts = npts + 1
+
+ call realloc (den, npts, TY_DOUBLE)
+ call realloc (y, npts, TY_DOUBLE)
+ call realloc (wts, npts, TY_DOUBLE)
+ call realloc (userwts, npts, TY_DOUBLE)
+ call realloc (x, npts, TY_DOUBLE)
+ call realloc (wd, npts, TY_INT)
+ call realloc (sdev, npts, TY_DOUBLE)
+
+ Memd[den+npts-1] = double (nden)
+ Memd[y +npts-1] = double (nexp)
+ Memd[wts+npts-1] = double (nwts)
+ Memd[userwts+npts-1] = double (nwts)
+ Memi[wd +npts-1] = NDELETE
+ Memd[sdev+npts-1] = ADDED_PT
+
+ # Sort the data and then update the reference vector.
+ call hdic_sort (Memd[den], Memd[y], Memd[wts], Memd[userwts],
+ Memi[wd], Memd[sdev], npts)
+ call hdic_init (Memd[den], npts, Memd[den+npts-1])
+
+ IC_NEWX(ic) = YES
+ IC_NEWY(ic) = YES
+ IC_NEWWTS(ic) = YES
+end