Index: trunk/psLib/test/math/tst_psMinimize06.c
===================================================================
--- trunk/psLib/test/math/tst_psMinimize06.c	(revision 4859)
+++ trunk/psLib/test/math/tst_psMinimize06.c	(revision 5175)
@@ -7,5 +7,5 @@
 #include <math.h>
 #define NUM_ITERATIONS 100
-#define ERR_TOL 0.0
+#define ERR_TOL 0.1
 #define NUM_DATA_POINTS 20
 #define NUM_PARAMS 5
@@ -45,5 +45,4 @@
 }
 
-
 psS32 t01()
 {
@@ -63,8 +62,6 @@
         ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
         ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
-        /*
-                printf("x[%d] is vector (%f, %f)\n", i, ((psVector *) (myCoords->data[i]))->data.F32[0],
-                                                        ((psVector *) (myCoords->data[i]))->data.F32[1]);
-        */
+        psTrace(__func__, 5, "x[%d] is vector (%f, %f)\n", i, ((psVector *) (myCoords->data[i]))->data.F32[0],
+                ((psVector *) (myCoords->data[i]))->data.F32[1]);
         y->data.F32[i] = (float) i;
     }
@@ -74,21 +71,28 @@
     }
 
-    psMinimizeLMChi2(min,
-                     myCovar,
-                     myParams,
-                     NULL,
-                     myCoords,
-                     y,
-                     NULL,
-                     (psMinimizeLMChi2Func) myFunc);
+    psBool rc = psMinimizeLMChi2(min,
+                                 NULL,
+                                 myParams,
+                                 NULL,
+                                 myCoords,
+                                 y,
+                                 NULL,
+                                 (psMinimizeLMChi2Func) myFunc);
+    if (rc == false) {
+        printf("TEST ERROR: psMinimizeLMChi2() returned FALSE.\n");
+        fflush(stdout);
+        testStatus = false;
+    } else {
+        printf("\nThe value of the function at the minimum is %f\n", min->value);
+        for (psS32 i=0;i<NUM_DATA_POINTS;i++) {
+            printf("The minimum for data point %d: %f\n", i, myFunc(myDerivs, myParams, (psVector *) myCoords->data[i]));
+            fflush(stdout);
+        }
 
-    printf("\nThe value of the function at the minimum is %f\n", min->value);
-    for (psS32 i=0;i<NUM_DATA_POINTS;i++) {
-        printf("The minimum for data point %d: %f\n", i, myFunc(myDerivs, myParams, (psVector *) myCoords->data[i]));
-    }
-
-    for (psS32 i=0;i<NUM_PARAMS;i++) {
-        printf("Parameter %d at the minimum is %f (expected: %f)\n", i,
-               myParams->data.F32[i], expectedParm[i]);
+        for (psS32 i=0;i<NUM_PARAMS;i++) {
+            printf("Parameter %d at the minimum is %f (expected: %f)\n", i,
+                   myParams->data.F32[i], expectedParm[i]);
+            fflush(stdout);
+        }
     }
 
@@ -99,8 +103,10 @@
     psFree(myCoords);
     psFree(y);
-
     psMemCheckCorruption(1);
-    psS32 memLeaks = psMemCheckLeaks(currentId,NULL,NULL,false);
+    psS32 memLeaks = psMemCheckLeaks(currentId, NULL, NULL, false);
     if (0 != memLeaks) {
+        printf("TEST ERROR: Memory Leaks! (%d leaks).\n", memLeaks);
+        fflush(stdout);
+        // XXX: This is causing a seg fault
         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
     }
@@ -108,7 +114,42 @@
 }
 
+
+
 psS32 main()
 {
     psLogSetFormat("HLNM");
+    psTraceSetDestination(1);
+    psTraceSetLevel(".", 0);
+    psTraceSetLevel(__func__, 10);
+    psTraceSetLevel("t01", 10);
+    psTraceSetLevel("psMinimizeLMChi2_OLD", 10);
+    psTraceSetLevel("psMinimizeLMChi2", 10);
+    psTraceSetLevel("psMinimizeGaussNewtonDelta", 0);
+    psTraceSetLevel("psMinimizeGaussNewtonDelta_EAM", 0);
+    psTraceSetLevel("p_psMinLM_GuessABP", 0);
+    psTraceSetLevel("p_psMinLM_GuessABP_EAM", 0);
+    psTraceSetLevel("p_psMinLM_SetABX", 0);
+    psTraceSetLevel("psGaussJordan", 0);
+    psTraceSetLevel("psMinimizationAlloc", 0);
+    psTraceSetLevel("psMemCheckMinimization", 0);
+    psTraceSetLevel("p_psDetermineBracket", 0);
+    psTraceSetLevel("p_psDetermineBracket2", 0);
+    psTraceSetLevel("p_psLineMin", 0);
+    psTraceSetLevel("psMinimizePowell", 0);
+    psTraceSetLevel("myPowellChi2Func", 0);
+    psTraceSetLevel("psMinimizeChi2Powell", 0);
+    psTraceSetLevel("BuildSums1D", 0);
+    psTraceSetLevel("BuildSums2D", 0);
+    psTraceSetLevel("Polynomial2DEvalVectorD", 0);
+    psTraceSetLevel("vectorFitPolynomial1DCheby", 0);
+    psTraceSetLevel("VectorFitPolynomial1DOrd", 0);
+    psTraceSetLevel("psVectorFitPolynomial1D", 0);
+    psTraceSetLevel("psVectorClipFitPolynomial1D", 0);
+
+    psTrace(__func__, 2, "Calling new psMinimize().\n");
     t01();
+    printf("DONE\n");
+    fflush(stdout);
 }
+//is the way
+
