Index: /trunk/psLib/src/dataManip/psStats.c
===================================================================
--- /trunk/psLib/src/dataManip/psStats.c	(revision 1277)
+++ /trunk/psLib/src/dataManip/psStats.c	(revision 1278)
@@ -18,27 +18,24 @@
 #include "psMinimize.h"
 #include "psFunctions.h"
-=======
-
-    /*****************************************************************************/
-    /* DEFINE STATEMENTS                                                         */
-    /*****************************************************************************/
-    #define DEFAULT_ROBUST_SIZE_THRESHOLD 30000   // Vectors that are large than this
-    // will use robust statistical methods.
-    #define GAUSS_WIDTH 20                  // The width of the Gaussian or boxcar smoothing.
-    #define CLIPPED_NUM_ITER_LB 1
-    #define CLIPPED_NUM_ITER_UB 10
-    #define CLIPPED_SIGMA_LB 1.0
-    #define CLIPPED_SIGMA_UB 10.0
-    #define true 1
-    #define false 0
-    #define MYMAXFLOAT HUGE
-    #define MAX_ITERATIONS 20
-
-    #ifndef DOXYGEN
-    void p_psVectorRobustStats(const psVector *restrict myVector,
-                               const psVector *restrict maskVector,
-                               unsigned int maskVal,
-                               psStats *stats);
-#endif
+
+/*****************************************************************************/
+/* DEFINE STATEMENTS                                                         */
+/*****************************************************************************/
+#define DEFAULT_ROBUST_SIZE_THRESHOLD 30000   // Vectors that are large than this
+// will use robust statistical methods.
+#define GAUSS_WIDTH 20                  // The width of the Gaussian or boxcar smoothing.
+#define CLIPPED_NUM_ITER_LB 1
+#define CLIPPED_NUM_ITER_UB 10
+#define CLIPPED_SIGMA_LB 1.0
+#define CLIPPED_SIGMA_UB 10.0
+#define true 1
+#define false 0
+#define MYMAXFLOAT HUGE
+#define MAX_ITERATIONS 20
+
+void p_psVectorRobustStats(const psVector *restrict myVector,
+                           const psVector *restrict maskVector,
+                           unsigned int maskVal,
+                           psStats *stats);
 
 /** Preprocessor macro to generate error on an incorrect type */
@@ -478,5 +475,5 @@
     }
     // Sort the temporary vectors.
-    psVectorSort(sortedVector, unsortedVector);
+    psSort(sortedVector, unsortedVector);
 
     // Calculate the median exactly.
@@ -647,5 +644,5 @@
 
     // Sort the temporary vectors.
-    psVectorSort(sortedVector, unsortedVector);
+    psSort(sortedVector, unsortedVector);
 
     // Calculate the quartile points exactly.
@@ -1827,6 +1824,4 @@
             (stats->options & PS_STAT_ROBUST_QUARTILE)) {
         p_psVectorRobustStats(in, mask, maskVal, stats);
-
-        printf("HMMMM stats->robustMode is %f\n", stats->robustMode);
     }
 
Index: /trunk/psLib/src/math/psMinimize.c
===================================================================
--- /trunk/psLib/src/math/psMinimize.c	(revision 1277)
+++ /trunk/psLib/src/math/psMinimize.c	(revision 1278)
@@ -9,11 +9,11 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 23:52:34 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-22 23:40:08 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 /*****************************************************************************/
-/* INCLUDE FILES            */
+/* INCLUDE FILES                                                             */
 /*****************************************************************************/
 #include <stdlib.h>
@@ -41,5 +41,5 @@
 #include "psMatrix.h"
 /*****************************************************************************/
-/* DEFINE STATEMENTS           */
+/* DEFINE STATEMENTS                                                         */
 /*****************************************************************************/
 #define MAX_LMM_ITERATIONS 100
@@ -85,5 +85,5 @@
 
 /*****************************************************************************/
-/* TYPE DEFINITIONS           */
+/* TYPE DEFINITIONS                                                          */
 /*****************************************************************************/
 typedef struct
@@ -113,5 +113,5 @@
 
 /*****************************************************************************/
-/* GLOBAL VARIABLES           */
+/* GLOBAL VARIABLES                                                          */
 /*****************************************************************************/
 
@@ -119,5 +119,5 @@
 
 /*****************************************************************************/
-/* FILE STATIC VARIABLES           */
+/* FILE STATIC VARIABLES                                                     */
 /*****************************************************************************/
 
@@ -125,5 +125,5 @@
 
 /*****************************************************************************/
-/* FUNCTION IMPLEMENTATION - LOCAL          */
+/* FUNCTION IMPLEMENTATION - LOCAL                                           */
 /*****************************************************************************/
 
@@ -558,5 +558,5 @@
 
 /*****************************************************************************/
-/* FUNCTION IMPLEMENTATION - PUBLIC         */
+/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
 /*****************************************************************************/
 
@@ -567,5 +567,5 @@
  
 This routine must minimize an arbitrary function; it determines the set of
-parameters of that function such that the.
+parameters of that function such that the ...
  *****************************************************************************/
 psVector *
@@ -681,5 +681,6 @@
 
 /******************************************************************************
-    This routine must minimize an arbitrary function.
+    This routine must determine the parameters of an arbitrary function
+    such that they best fit the supplied data points.
  *****************************************************************************/
 psVector *
@@ -795,10 +796,17 @@
     do {
         iter++;
+        for (i=0;i<initialGuess->n;i++) {
+            printf("Iteration %d: parameter %d is %.3f\n", iter, i, gsl_vector_get(s->x, i));
+        }
         // Perform an iteration of the GSL solver.
         status = gsl_multifit_fdfsolver_iterate(s);
-        //        printf ("psMinimize() status = %s\n", gsl_strerror(status));
+        printf("gsl_multifit_fdfsolver_iterate() status is %s\n", gsl_strerror(status));
+        for (i=0;i<initialGuess->n;i++) {
+            printf("Iteration %d: parameter %d is %.3f\n", iter, i, gsl_vector_get(s->x, i));
+        }
+
         // If there was a problem, abort.
         if (status) {
-            psAbort(__func__, "gsl_multifit_fdfsolver_iterate()\n");
+            psAbort(__func__, "gsl_multifit_fdfsolver_iterate(%s)\n", gsl_strerror(status));
         }
 
@@ -811,4 +819,5 @@
         // as specified in the ADD.
         *chiSq = gsl_blas_dnrm2(s->f);
+        printf("psMinimize.c: chiSq is %.3f\n", *chiSq);
         if (fabs(*chiSq - chiSqOld) < 1.0) {
             status = GSL_SUCCESS;
@@ -855,5 +864,5 @@
     This routine must fit a polynomial of degree myPoly to the data points
     (x, y) and return the coefficients of that polynomial, as well as the
-    error for each data poiny (yErr).
+    error for each data point (yErr).
  
 NOTE: yErr is currently ignored.
@@ -877,4 +886,9 @@
     psVector *xSums = NULL;
 
+    //    printf("psGetArrayPolynomial()\n");
+    //    for (i=0;i<x->n;i++) {
+    //        printf("(x, y, yErr) is (%f, %f, %f)\n", x->data.F64[i], y->data.F64[i], yErr->data.F64[i]);
+    //    }
+
     PS_CHECK_NULL_1DPOLY(myPoly);
     PS_CHECK_NULL_VECTOR(x);
@@ -929,5 +943,11 @@
     for(k=0;k<(polyOrder);k++) {
         myPoly->coeff[k] = coeffs->data.F64[k];
-    }
+        //        printf("myPoly->coeff[%d] is %f\n", k, myPoly->coeff[k]);
+    }
+
+
+    //    for (i=0;i<x->n;i++) {
+    //        printf("HMMM: psEvalPolynomial1D(%f) is %f\n", x->data.F64[i], psEvalPolynomial1D(x->data.F64[i], myPoly));
+    //    }
 
     psFree(A);
@@ -939,4 +959,4 @@
     psFree(xSums);
 
-    return(NULL);
-}
+    return(myPoly);
+}
