Index: /branches/eam_rel8_b1/psLib/src/math/psMinimize.c
===================================================================
--- /branches/eam_rel8_b1/psLib/src/math/psMinimize.c	(revision 5569)
+++ /branches/eam_rel8_b1/psLib/src/math/psMinimize.c	(revision 5570)
@@ -10,6 +10,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.142.6.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-11-22 18:06:10 $
+ *  @version $Revision: 1.142.6.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-22 19:54:55 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1441,19 +1441,21 @@
 }
 
-
-/******************************************************************************
-BuildSums4D(sums, x, y, z, t, nXterm, nYterm, nZterm, nTterm). equiv to 
-BuildSums2D(). The result is returned as a double ****
- *****************************************************************************/
-static psImage *BuildSums4D(
-    psF64 ****sums,
-    psF64 x,
-    psF64 y,
-    psF64 z,
-    psF64 t,
-    psS32 nXterm,
-    psS32 nYterm,
-    psS32 nZterm,
-    psS32 nTterm)
+// here is the definition for BuildSums4D.  ifdef'ed away until it is used
+// by psPolynomial4DFit..
+# if (0)
+    /******************************************************************************
+    BuildSums4D(sums, x, y, z, t, nXterm, nYterm, nZterm, nTterm). equiv to 
+    BuildSums2D(). The result is returned as a double ****
+     *****************************************************************************/
+    static double ****BuildSums4D(
+        psF64 ****sums,
+        psF64 x,
+        psF64 y,
+        psF64 z,
+        psF64 t,
+        psS32 nXterm,
+        psS32 nYterm,
+        psS32 nZterm,
+        psS32 nTterm)
 {
     psS32 nXsum = 0;
@@ -1471,11 +1473,11 @@
     nTsum = 2*nTterm;
     if (sums == NULL) {
-        sums = (psF64 ****) psAlloc (nXsum*PSELEMTYPE_SIZEOF(psF64));
+        sums = (psF64 ****) psAlloc (nXsum*sizeof(psF64));
         for (int i = 0; i < nXsum; i++) {
-            sums[i] = (psF64 ***) psAlloc (nYsum*PSELEMTYPE_SIZEOF(psF64));
+            sums[i] = (psF64 ***) psAlloc (nYsum*sizeof(psF64));
             for (int j = 0; j < nYsum; j++) {
-                sums[i][j] = (psF64 **) psAlloc (nZsum*PSELEMTYPE_SIZEOF(psF64));
+                sums[i][j] = (psF64 **) psAlloc (nZsum*sizeof(psF64));
                 for (int k = 0; k < nZsum; k++) {
-                    sums[i][j][k] = (psF64 *) psAlloc (nTsum*PSELEMTYPE_SIZEOF(psF64));
+                    sums[i][j][k] = (psF64 *) psAlloc (nTsum*sizeof(psF64));
                 }
             }
@@ -1503,4 +1505,5 @@
     return (sums);
 }
+# endif /* BuildSums4D */
 
 /******************************************************************************
@@ -1509,4 +1512,6 @@
 in the output vector.  This routine works on single-precision polynomials with
 double precision data.
+ 
+XXX EAM : this function is now deprecated: psPolynomial2DEvalVector handles F32 and F64
  *****************************************************************************/
 psVector *Polynomial2DEvalVectorD(
@@ -1899,7 +1904,7 @@
     // assign sequence vector if xIn is NULL
     if (xIn == NULL) {
-        x = psVectorCreate (NULL, 0, f->n, 1, f->type);
+        x = psVectorCreate (NULL, 0, f->n, 1, f->type.type);
     } else {
-        x = xIn;
+        x = (psVector *) xIn;
     }
 
@@ -1907,10 +1912,10 @@
     float minClipSigma;
     float maxClipSigma;
-    if (finite(stats->max)) {
+    if (isfinite(stats->max)) {
         maxClipSigma = fabs(stats->clipSigma);
     } else {
         maxClipSigma = fabs(stats->max);
     }
-    if (finite(stats->min)) {
+    if (isfinite(stats->min)) {
         minClipSigma = fabs(stats->clipSigma);
     } else {
@@ -2055,5 +2060,5 @@
         } else {
             // this filters fErr == 0 values
-            wt = (fErr->data.F64[k] == ) ? 0.0 : 1.0 / PS_SQR(fErr->data.F64[k]);
+            wt = (fErr->data.F64[k] == 0.0) ? 0.0 : 1.0 / PS_SQR(fErr->data.F64[k]);
         }
 
@@ -2097,4 +2102,6 @@
 
 
+// XXX EAM : I have implemented a single function to handle the mask/nomask cases
+//           this function can be deprecated
 psPolynomial2D* RobustFit2D_nomask(
     psPolynomial2D* poly,
@@ -2382,13 +2389,13 @@
     float minClipSigma;
     float maxClipSigma;
-    if (finite(stats->max)) {
+    if (isfinite(stats->max)) {
+        maxClipSigma = fabs(stats->max);
+    } else {
         maxClipSigma = fabs(stats->clipSigma);
+    }
+    if (isfinite(stats->min)) {
+        minClipSigma = fabs(stats->min);
     } else {
-        maxClipSigma = fabs(stats->max);
-    }
-    if (finite(stats->min)) {
         minClipSigma = fabs(stats->clipSigma);
-    } else {
-        minClipSigma = fabs(stats->min);
     }
     psVector *fit   = NULL;
Index: /branches/eam_rel8_b1/psLib/src/math/psPolynomial.c
===================================================================
--- /branches/eam_rel8_b1/psLib/src/math/psPolynomial.c	(revision 5569)
+++ /branches/eam_rel8_b1/psLib/src/math/psPolynomial.c	(revision 5570)
@@ -7,6 +7,6 @@
 *  polynomials.  It also contains a Gaussian functions.
 *
-*  @version $Revision: 1.130.4.1.2.1 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-11-22 18:04:28 $
+*  @version $Revision: 1.130.4.1.2.2 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-22 19:54:55 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -784,26 +784,4 @@
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 psF64 psPolynomial1DEval(const psPolynomial1D* poly,
                          psF64 x)
@@ -829,9 +807,9 @@
     PS_ASSERT_POLY_NON_NULL(poly, NULL);
     PS_ASSERT_VECTOR_NON_NULL(x, NULL);
-    // PS_ASSERT_VECTOR_TYPE(x, PS_TYPE_F64, NULL);
+    PS_ASSERT_VECTOR_TYPE_F32_OR_F64(x, NULL);
 
     psVector *tmp;
 
-    switch (x->type) {
+    switch (x->type.type) {
     case PS_TYPE_F64:
         tmp = psVectorAlloc(x->n, PS_TYPE_F64);
@@ -880,7 +858,7 @@
     PS_ASSERT_POLY_NON_NULL(poly, NULL);
     PS_ASSERT_VECTOR_NON_NULL(x, NULL);
-    PS_ASSERT_VECTOR_TYPE(x, PS_TYPE_F64, NULL);
+    PS_ASSERT_VECTOR_TYPE_F32_OR_F64(x, NULL);
     PS_ASSERT_VECTOR_NON_NULL(y, NULL);
-    PS_ASSERT_VECTOR_TYPE(y, PS_TYPE_F64, NULL);
+    PS_ASSERT_VECTOR_TYPE_F32_OR_F64(y, NULL);
 
     psVector *tmp;
@@ -892,7 +870,7 @@
     }
 
-    switch (x->type) {
+    switch (x->type.type) {
     case PS_TYPE_F32:
-        if (y->type != x->type) {
+        if (y->type.type != x->type.type) {
             psError(PS_ERR_UNKNOWN, true, "type mismatch in data vectors");
             return (NULL);
@@ -908,5 +886,5 @@
         break;
     case PS_TYPE_F64:
-        if (y->type != x->type) {
+        if (y->type.type != x->type.type) {
             psError(PS_ERR_UNKNOWN, true, "type mismatch in data vectors");
             return (NULL);
