Index: trunk/psLib/src/math/psStats.c
===================================================================
--- trunk/psLib/src/math/psStats.c	(revision 4101)
+++ trunk/psLib/src/math/psStats.c	(revision 4138)
@@ -9,6 +9,11 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.130 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-03 22:30:20 $
+ *  XXX: The following stats members are never used, or set in this code.
+ *      stats->robustN50
+ *      stats->clippedNvalues
+ *      stats->binsize
+ *
+ *  @version $Revision: 1.131 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-07 23:11:54 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1629,4 +1634,6 @@
             (stats->options & PS_STAT_ROBUST_STDEV)) {
         // We fit a 1-D polynomial to the data.
+        // XXX: I implement the changes requested in bug 366.  However, this
+        // code no longer produces sensible results.
         // XXX: Since we are no longer fitting a 1-D Gaussian, we can probably
         // remove some of theabove code that calculated the initial estimate
@@ -1634,4 +1641,5 @@
 
         psVector *y = psVectorAlloc(2 * dL + 1, PS_TYPE_F32);
+        psVector *x = psVectorAlloc(2 * dL + 1, PS_TYPE_F32);
         for (i = modeBinNum - dL; i <= modeBinNum + dL; i++) {
             int index = i - modeBinNum + dL;
@@ -1639,4 +1647,5 @@
             y->data.F32[index] = robustHistogramVector->data.F32[i];
             //            y->data.F32[index] = logf(robustHistogramVector->data.F32[i]);
+            x->data.F32[index] = (psF32) index;
         }
 
@@ -1659,4 +1668,17 @@
             stats->robustStdev = polyFitSigma;
         }
+        // For testing only.  This shows that the polynomial fit is successful.
+        if (0) {
+            printf("--- Results of the 1-D polynomial fit:\n");
+            for (i = modeBinNum - dL; i <= modeBinNum + dL; i++) {
+                int index = i - modeBinNum + dL;
+                printf("(x, y, poly(x)) is (%.2f, %.2f, %.2f)\n",
+                       x->data.F32[index],
+                       y->data.F32[index],
+                       psPolynomial1DEval(tmpPoly, x->data.F32[index]));
+            }
+        }
+
+        psFree(x);
         psFree(y);
         psFree(tmpPoly);
@@ -1750,13 +1772,14 @@
     newStruct->robustUQ = NAN;
     newStruct->robustLQ = NAN;
-    newStruct->robustN50 = 0;
-    newStruct->robustNfit = 0;
+    newStruct->robustN50 = -1;            // XXX: This is never used
+    newStruct->robustNfit = -1;
     newStruct->clippedMean = NAN;
     newStruct->clippedStdev = NAN;
+    newStruct->clippedNvalues = -1;     // XXX: This is never used
     newStruct->clipSigma = 3.0;
-    newStruct->clipIter = 3.0;
+    newStruct->clipIter = 3;
     newStruct->min = NAN;
     newStruct->max = NAN;
-    newStruct->binsize = NAN;
+    newStruct->binsize = NAN;          // XXX: This is never used
     newStruct->options = options;
 
