aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/inlfit/inlimitd.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 /pkg/xtools/inlfit/inlimitd.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/xtools/inlfit/inlimitd.x')
-rw-r--r--pkg/xtools/inlfit/inlimitd.x51
1 files changed, 51 insertions, 0 deletions
diff --git a/pkg/xtools/inlfit/inlimitd.x b/pkg/xtools/inlfit/inlimitd.x
new file mode 100644
index 00000000..cc0ba12e
--- /dev/null
+++ b/pkg/xtools/inlfit/inlimitd.x
@@ -0,0 +1,51 @@
+include <pkg/inlfit.h>
+
+
+# IN_LIMIT -- Compute the independent variable limits for all variables,
+# and store them in the INLFIT structure.
+
+procedure in_limitd (in, x, npts, nvars)
+
+pointer in # INLFIT descriptor
+double x[ARB] # Independent values (npts * nvars)
+int npts # number of points
+int nvars # number of variables
+
+int i, j
+double aux, xmin, xmax
+pointer minptr, maxptr
+
+pointer in_getp()
+
+begin
+# # Debug
+# call eprintf ("in_limit: in=%d, npts=%d, nvars=%d\n")
+# call pargi (in)
+# call pargi (npts)
+# call pargi (nvars)
+
+ # Get minimum and maximum buffer pointers
+ minptr = in_getp (in, INLXMIN)
+ maxptr = in_getp (in, INLXMAX)
+
+ # Loop over variables
+ do i = 1, nvars {
+
+ # Set initial values
+ xmin = x[i]
+ xmax = x[i]
+
+ # Search for maximum and minimum values
+ do j = 1, npts {
+ aux = x[(j - 1) * nvars + i]
+ if (xmin > aux)
+ xmin = aux
+ else if (xmax < aux)
+ xmax = aux
+ }
+
+ # Enter values into the structure
+ Memd[minptr + i - 1] = xmin
+ Memd[maxptr + i - 1] = xmax
+ }
+end