Index: trunk/psLib/src/math/psStats.c
===================================================================
--- trunk/psLib/src/math/psStats.c	(revision 5115)
+++ trunk/psLib/src/math/psStats.c	(revision 5116)
@@ -17,6 +17,6 @@
 *
 *
-*  @version $Revision: 1.148 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-09-24 00:26:36 $
+*  @version $Revision: 1.149 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-09-24 00:46:45 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -81,51 +81,64 @@
 psBool p_psGetStatValue(const psStats* stats, psF64 *value)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     //    switch (stats->options & ~(PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE | PS_STAT_ROBUST_FOR_SAMPLE)) {
     switch (stats->options & ~(PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE)) {
     case PS_STAT_SAMPLE_MEAN:
         *value = stats->sampleMean;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_SAMPLE_MEDIAN:
         *value = stats->sampleMedian;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_SAMPLE_STDEV:
         *value = stats->sampleStdev;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_ROBUST_MEAN:
         *value = stats->robustMean;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_ROBUST_MEDIAN:
         *value = stats->robustMedian;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_ROBUST_MODE:
         *value = stats->robustMode;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_ROBUST_STDEV:
         *value = stats->robustStdev;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_CLIPPED_MEAN:
         *value = stats->clippedMean;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_CLIPPED_STDEV:
         *value = stats->clippedStdev;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_MAX:
         *value = stats->max;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     case PS_STAT_MIN:
         *value = stats->min;
+        psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
         return true;
 
     default:
+        psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
         return false;
     }
@@ -160,4 +173,5 @@
                            psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
 
     psS32 i = 0;                // Loop index variable
@@ -285,6 +299,8 @@
     stats->sampleMean = mean;
     if (isnan(mean)) {
+        psTrace(__func__, 4, "---- %s(-1) end ----\n", __func__);
         return(-1);
     } else {
+        psTrace(__func__, 4, "---- %s(0) end ----\n", __func__);
         return(0);
     }
@@ -304,4 +320,5 @@
                     psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     psS32 i = 0;                // Loop index variable
     psF32 max = -PS_MAX_F32;    // The calculated maximum
@@ -354,6 +371,8 @@
     } else {
         stats->max = NAN;
+        psTrace(__func__, 4, "---- %s(1) end ----\n", __func__);
         return(1);
     }
+    psTrace(__func__, 4, "---- %s(0) end ----\n", __func__);
     return(0);
 }
@@ -369,4 +388,5 @@
                     psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     psS32 i = 0;                // Loop index variable
     psF32 min = PS_MAX_F32;   // The calculated maximum
@@ -419,6 +439,8 @@
     } else {
         stats->min = NAN;
+        psTrace(__func__, 4, "---- %s(1) end ----\n", __func__);
         return(1);
     }
+    psTrace(__func__, 4, "---- %s(0) end ----\n", __func__);
     return(0);
 }
@@ -435,4 +457,5 @@
                              psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     PS_ASSERT_VECTOR_NON_NULL(myVector, -1);
     PS_ASSERT_PTR_NON_NULL(stats, -1);
@@ -445,4 +468,5 @@
                         (stats->min <= myVector->data.F32[i]) &&
                         (myVector->data.F32[i] <= stats->max)) {
+                    psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
                     return(true);
                 }
@@ -452,4 +476,5 @@
                 if ((stats->min <= myVector->data.F32[i]) &&
                         (myVector->data.F32[i] <= stats->max)) {
+                    psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
                     return(true);
                 }
@@ -460,4 +485,5 @@
             for (i = 0; i < myVector->n; i++) {
                 if (!(maskVal & maskVector->data.U8[i])) {
+                    psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
                     return(true);
                 }
@@ -465,8 +491,10 @@
         } else {
             if (myVector->n > 0) {
+                psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
                 return(true);
             }
         }
     }
+    psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
     return(false);
 }
@@ -483,4 +511,5 @@
                         psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     PS_ASSERT_VECTOR_NON_NULL(myVector, -1);
     PS_ASSERT_PTR_NON_NULL(stats, -1);
@@ -517,4 +546,5 @@
     }
 
+    psTrace(__func__, 4, "---- %s(%d) end ----\n", __func__, numData);
     return (numData);
 }
@@ -532,4 +562,5 @@
                             psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     psVector* unsortedVector = NULL;    // Temporary vector
     psVector* sortedVector = NULL;      // Temporary vector
@@ -598,4 +629,5 @@
                 false,
                 PS_ERRORTEXT_psStats_STATS_SAMPLE_MEDIAN_SORT_PROBLEM);
+        psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
         return(false);
     }
@@ -615,4 +647,5 @@
 
     // Return "true" on success.
+    psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     return(true);
 }
@@ -631,9 +664,12 @@
                                        psF32 sigma)
 {
-    psTrace(__func__, 3, "---- %s() begin ----\n", __func__);
-    psTrace(__func__, 6, "(histogram->nums->n, sigma) is (%d, %.2f\n", (int) histogram->nums->n, sigma);
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
+    psTrace(__func__, 5, "(histogram->nums->n, sigma) is (%d, %.2f\n", (int) histogram->nums->n, sigma);
     PS_ASSERT_PTR_NON_NULL(histogram, NULL);
     PS_ASSERT_PTR_NON_NULL(histogram->bounds, NULL);
     PS_ASSERT_PTR_NON_NULL(histogram->nums, NULL);
+    if (psTraceGetLevel(__func__) >= 8) {
+        PS_VECTOR_PRINT_F32(histogram->nums);
+    }
 
     psS32 numBins = histogram->nums->n;
@@ -668,5 +704,5 @@
                             false,
                             PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM);
-                    psTrace(__func__, 3, "---- %s(NULL) end ----\n", __func__);
+                    psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__);
                     return(NULL);
                 }
@@ -684,5 +720,5 @@
                             false,
                             PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM);
-                    psTrace(__func__, 3, "---- %s(NULL) end ----\n", __func__);
+                    psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__);
                     return(NULL);
                 }
@@ -745,5 +781,8 @@
     }
 
-    psTrace(__func__, 3, "---- %s(psVector) end ----\n", __func__);
+    if (psTraceGetLevel(__func__) >= 8) {
+        PS_VECTOR_PRINT_F32(smooth);
+    }
+    psTrace(__func__, 4, "---- %s(psVector) end ----\n", __func__);
     return(smooth);
 }
@@ -766,4 +805,5 @@
                                psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     psVector* unsortedVector = NULL;    // Temporary vector
     psVector* sortedVector = NULL;      // Temporary vector
@@ -820,4 +860,5 @@
                 false,
                 PS_ERRORTEXT_psStats_STATS_SAMPLE_MEDIAN_SORT_PROBLEM);
+        psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
         return(false);
     }
@@ -832,4 +873,5 @@
     psFree(unsortedVector);
     psFree(sortedVector);
+    psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     return(true);
 }
@@ -853,4 +895,5 @@
                               psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     psS32 i = 0;                  // Loop index variable
     psS32 countInt = 0;           // # of data points being used
@@ -870,4 +913,5 @@
         stats->sampleStdev = NAN;
         psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): p_psVectorSampleMean() reported a NAN mean.\n");
+        psTrace(__func__, 4, "---- %s() end ----\n", __func__);
         return;
     }
@@ -928,4 +972,5 @@
         stats->sampleStdev = sqrtf((sumSquares - (sumDiffs * sumDiffs / countFloat)) / (countFloat - 1));
     }
+    psTrace(__func__, 4, "---- %s() end ----\n", __func__);
 }
 /******************************************************************************
@@ -947,4 +992,5 @@
                            psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     psS32 i = 0;                  // Loop index variable
     psS32 countInt = 0;           // # of data points being used
@@ -967,4 +1013,5 @@
         stats->sampleStdev = NAN;
         psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): p_psVectorSampleMean() reported a NAN mean.\n");
+        psTrace(__func__, 4, "---- %s() end ----\n", __func__);
         return;
     }
@@ -1047,4 +1094,5 @@
         }
     }
+    psTrace(__func__, 4, "---- %s() end ----\n", __func__);
 }
 
@@ -1075,4 +1123,5 @@
                              psStats* stats)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     psF32 clippedMean = 0.0;    // self-explanatory
     psF32 clippedStdev = 0.0;   // self-explanatory
@@ -1121,4 +1170,5 @@
         stats->clippedMean = NAN;
         stats->clippedStdev = NAN;
+        psTrace(__func__, 4, "---- %s(-2) end ----\n", __func__);
         return(-2);
     }
@@ -1130,4 +1180,5 @@
         stats->clippedMean = NAN;
         stats->clippedStdev = NAN;
+        psTrace(__func__, 4, "---- %s(-2) end ----\n", __func__);
         return(-2);
     }
@@ -1184,4 +1235,5 @@
 
     psFree(tmpMask);
+    psTrace(__func__, 4, "---- %s(%d) end ----\n", __func__, rc);
     return(rc);
 }
@@ -1257,4 +1309,5 @@
                               psF64 outHigh)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     switch (myData->type.type) {
     case PS_TYPE_U8:
@@ -1296,4 +1349,5 @@
         break;
     }
+    psTrace(__func__, 4, "---- %s() end ----\n", __func__);
 }
 
@@ -1315,4 +1369,5 @@
                        psF32 getThisValue)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     PS_ASSERT_POLY_NON_NULL(myPoly, NAN);
     PS_ASSERT_FLOAT_LARGER_THAN(rangeHigh, rangeLow, NAN);
@@ -1324,4 +1379,5 @@
     if (!((fLo <= getThisValue) && (fHi >= getThisValue))) {
         psError(PS_ERR_UNKNOWN, true, "The requested y value (%f) does not fall within the specified range (%f to %f)\n", getThisValue, fLo, fHi);
+        psTrace(__func__, 4, "---- %s(NAN) end ----\n", __func__);
         return(NAN);
     }
@@ -1351,4 +1407,5 @@
         numIterations++;
     }
+    psTrace(__func__, 4, "---- %s(%f) end ----\n", __func__, midpoint);
     return (midpoint);
 }
@@ -1377,6 +1434,6 @@
                                         psF32 yVal)
 {
-    psTrace(__func__, 3, "---- %s() begin ----\n", __func__);
-    psTrace(__func__, 6, "binNum, yVal is (%d, %f)\n", binNum, yVal);
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
+    psTrace(__func__, 5, "binNum, yVal is (%d, %f)\n", binNum, yVal);
     if (psTraceGetLevel(__func__) >= 8) {
         PS_VECTOR_PRINT_F32(xVec);
@@ -1424,5 +1481,5 @@
                 psFree(y);
                 psFree(yErr);
-                psTrace(__func__, 3, "---- %s(NAN) end ----\n", __func__);
+                psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__);
                 return(NAN);
             }
@@ -1440,5 +1497,5 @@
                 psFree(y);
                 psFree(yErr);
-                psTrace(__func__, 3, "---- %s(NAN) end ----\n", __func__);
+                psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__);
                 return(NAN);
             }
@@ -1466,5 +1523,5 @@
             psFree(y);
             psFree(yErr);
-            psTrace(__func__, 3, "---- %s(NAN) end ----\n", __func__);
+            psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__);
             return(NAN);
         }
@@ -1489,5 +1546,5 @@
             psFree(y);
             psFree(yErr);
-            psTrace(__func__, 3, "---- %s(NAN) end ----\n", __func__);
+            psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__);
             return(NAN);
         }
@@ -1517,5 +1574,5 @@
     psFree(yErr);
 
-    psTrace(__func__, 3, "---- %s(%f) end ----\n", __func__, tmpFloat);
+    psTrace(__func__, 5, "---- %s(%f) end ----\n", __func__, tmpFloat);
     return(tmpFloat);
 }
@@ -1526,4 +1583,5 @@
 psVector *PsVectorDup(psVector *in)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     PS_ASSERT_VECTOR_NON_NULL(in, NULL);
     psVector *out = psVectorAlloc(in->n, in->type.type);
@@ -1539,25 +1597,10 @@
     } else {
         psError(PS_ERR_UNKNOWN, true, "Unallowable vector type.\n");
+        psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__);
         return(NULL);
     }
+    psTrace(__func__, 4, "---- %s(psVector) end ----\n", __func__);
     return(out);
 }
-
-/******************************************************************************
-XXX: This function need to be written.  Actually, it simply needs to be
-retrieved from the CVS repository, since it was written earlier, then
-discarded.  At present, it was deleted from the CVS repository, so we might
-have to retrieve it from tape.
-*****************************************************************************/
-psVector *Fit1DGaussian(psVector *x, psVector*y)
-{
-    psError(PS_ERR_UNKNOWN, true, "This code has not been implemented yet.\n");
-    // XXX: This function was previously part of psStats.c, was removed, was
-    // purged from CVS, and now needs to be retrieved from tape.
-
-    return(NULL);
-}
-
-
 
 /******************************************************************************
@@ -1568,4 +1611,5 @@
                               const psVector *coords)
 {
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     PS_ASSERT_VECTOR_NON_NULL(params, NAN);
     PS_ASSERT_VECTOR_SIZE(params, 2, NAN);
@@ -1593,4 +1637,5 @@
     // printf("f(x, mean, stdev) = f(%.2f %.2f %.2f) is %.2f\n", x, mean, stdev, psGaussian(x, mean, stdev, false));
 
+    psTrace(__func__, 4, "---- %s() end ----\n", __func__);
     return(psGaussian(x, mean, stdev, false));
 }
@@ -1602,14 +1647,16 @@
                      psF32 y)
 {
-    // printf("HEY: LinInterpolate(%.2f %.2f %.2f %.2f %.2f)\n", x0, x1, y0, y1, y);
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
+    psTrace(__func__, 5, "LinInterpolate(%.2f %.2f %.2f %.2f %.2f)\n", x0, x1, y0, y1, y);
     if (y0 == y1) {
         psLogMsg(__func__, PS_LOG_WARN, "WARNING: y0 == y1.  Cannot interpolate.  Returning NaN.\n");
         return(NAN);
     }
-    // printf("HMMM: LinInterpolate(%.2f %.2f %.2f %.2f %.2f %.2f)\n", x0, x1, y0, y1, y, 0 + y * (x1 - x0) / (y1 - y0));
-
+
+    psTrace(__func__, 4, "---- %s() end ----\n", __func__);
     return(x0 + y * (x1 - x0) / (y1 - y0));
 }
 
+// XXX: Get rid of this, or put it in psConstants.h
 void PRINT_LEAKS()
 {
@@ -1635,30 +1682,5 @@
 
 /******************************************************************************
-p_psVectorRobustStats(myVector, maskVector, maskVal, stats): this procedure
-calculates a variety of robust stat measures:
-    PS_STAT_ROBUST_MEAN
-    PS_STAT_ROBUST_MEDIAN
-    PS_STAT_ROBUST_MODE
-    PS_STAT_ROBUST_STDEV
-    PS_STAT_ROBUST_QUARTILE
-I have included all that computation in a single function, as opposed to
-breaking it across several functions for one primary reason:  they all require
-the same basic initial processing steps (calculate the histogram, etc.).
- 
-Inputs
-    myVector
-    maskVector
-    maskVal
-    stats
-Returns
-    0 on success.
- 
-XXX: Check for errors in psLib routines that we call.
-*****************************************************************************/
-
-
-/******************************************************************************
- 
-p_psVectorRobustStatsNew(myVector, maskVector, maskVal, stats): This is the new
+p_psVectorRobustStats(myVector, maskVector, maskVal, stats): This is the new
 version of the robust stats routine.
  
@@ -1674,12 +1696,14 @@
  
 XXX: Check for errors in psLib routines that we call.
+ 
+XXX: Review and ensure that all memory is free'ed at premature exits.
 *****************************************************************************/
-psS32 p_psVectorRobustStatsNew(const psVector* myVector,
-                               const psVector* errors,
-                               const psVector* maskVector,
-                               psU32 maskVal,
-                               psStats* stats)
-{
-    psTrace(__func__, 3, "---- %s() begin ----\n", __func__);
+psS32 p_psVectorRobustStats(const psVector* myVector,
+                            const psVector* errors,
+                            const psVector* maskVector,
+                            psU32 maskVal,
+                            psStats* stats)
+{
+    psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     if (psTraceGetLevel(__func__) >= 8) {
         PS_VECTOR_PRINT_F32(myVector);
@@ -1722,5 +1746,5 @@
             psFree(tmpMaskVec);
             psFree(tmpScalar);
-            psTrace(__func__, 3, "---- %s(1) end  ----\n", __func__);
+            psTrace(__func__, 4, "---- %s(1) end  ----\n", __func__);
             return(1);
         }
@@ -1749,5 +1773,5 @@
             psFree(tmpScalar);
 
-            psTrace(__func__, 3, "---- %s(0) end  ----\n", __func__);
+            psTrace(__func__, 4, "---- %s(0) end  ----\n", __func__);
             return(0);
         }
@@ -1807,5 +1831,5 @@
                 psFree(tmpScalar);
                 psFree(tmpMaskVec);
-                psTrace(__func__, 3, "---- %s(1) end  ----\n", __func__);
+                psTrace(__func__, 4, "---- %s(1) end  ----\n", __func__);
                 return(1);
             }
@@ -1862,5 +1886,5 @@
             psFree(tmpScalar);
             psFree(tmpMaskVec);
-            psTrace(__func__, 3, "---- %s(1) end  ----\n", __func__);
+            psTrace(__func__, 4, "---- %s(1) end  ----\n", __func__);
             return(1);
         }
@@ -1973,5 +1997,5 @@
         psFree(tmpScalar);
         psFree(tmpMaskVec);
-        psTrace(__func__, 3, "---- %s(1) end  ----\n", __func__);
+        psTrace(__func__, 4, "---- %s(1) end  ----\n", __func__);
         return(1);
     }
@@ -2031,5 +2055,5 @@
         psFree(tmpScalar);
         psFree(tmpMaskVec);
-        psTrace(__func__, 3, "---- %s(1) end  ----\n", __func__);
+        psTrace(__func__, 4, "---- %s(1) end  ----\n", __func__);
         return(1);
     }
@@ -2083,5 +2107,5 @@
         psFree(cumulativeRobustHistogram);
         psFree(tmpStatsMinMax);
-        psTrace(__func__, 3, "---- %s(1) end  ----\n", __func__);
+        psTrace(__func__, 4, "---- %s(1) end  ----\n", __func__);
         return(1);
     }
@@ -2179,5 +2203,5 @@
         psFree(params);
         psFree(tmpMaskVec);
-        psTrace(__func__, 3, "---- %s(1) end  ----\n", __func__);
+        psTrace(__func__, 4, "---- %s(1) end  ----\n", __func__);
         return(1);
     }
@@ -2213,5 +2237,5 @@
     psFree(robustHistogram);
 
-    psTrace(__func__, 3, "---- %s(0) end  ----\n", __func__);
+    psTrace(__func__, 4, "---- %s(0) end  ----\n", __func__);
     return(0);
 }
@@ -2243,4 +2267,5 @@
 psStats* psStatsAlloc(psStatsOptions options)
 {
+    psTrace(__func__, 3,"---- %s() begin  ----\n", __func__);
     psStats* newStruct = NULL;
 
@@ -2270,4 +2295,5 @@
     newStruct->options = options;
 
+    psTrace(__func__, 3, "---- %s(psStats) end  ----\n", __func__);
     return (newStruct);
 }
@@ -2295,4 +2321,6 @@
 psHistogram* psHistogramAlloc(float lower, float upper, int n)
 {
+    psTrace(__func__, 3, "---- %s() begin  ----\n", __func__);
+    psTrace(__func__, 5, "(lower, upper, n) is (%f, %f, %d)\n", lower, upper, n);
     PS_ASSERT_INT_POSITIVE(n, NULL);
     PS_FLOAT_COMPARE(lower, upper, NULL);
@@ -2329,4 +2357,5 @@
     newHist->uniform = true;
 
+    psTrace(__func__, 3, "---- %s(psHistogram) end  ----\n", __func__);
     return (newHist);
 }
@@ -2343,4 +2372,5 @@
 psHistogram* psHistogramAllocGeneric(const psVector* bounds)
 {
+    psTrace(__func__, 3, "---- %s() begin  ----\n", __func__);
     PS_ASSERT_VECTOR_NON_NULL(bounds, NULL);
     PS_ASSERT_VECTOR_TYPE(bounds, PS_TYPE_F32, NULL);
@@ -2371,4 +2401,5 @@
     newHist->uniform = false;
 
+    psTrace(__func__, 3, "---- %s(psHistogram) end  ----\n", __func__);
     return (newHist);
 }
@@ -2406,4 +2437,5 @@
                           psF32 error)
 {
+    psTrace(__func__, 3, "---- %s() begin  ----\n", __func__);
     PS_ASSERT_PTR_NON_NULL(out, -1);
     PS_ASSERT_PTR_NON_NULL(out->bounds, -1);
@@ -2444,4 +2476,5 @@
     if (boxcarLeftBinNum == boxcarRightBinNum) {
         out->nums->data.F32[binNum]+= 1.0;
+        psTrace(__func__, 3, "---- %s(0) end  ----\n", __func__);
         return(0);
     }
@@ -2471,4 +2504,5 @@
     // Return 0 on success.
     //
+    psTrace(__func__, 3, "---- %s(0) end  ----\n", __func__);
     return(0);
 }
@@ -2495,4 +2529,5 @@
                                psMaskType maskVal)
 {
+    psTrace(__func__, 3, "---- %s() begin  ----\n", __func__);
     PS_ASSERT_PTR_NON_NULL(out, NULL);
     PS_ASSERT_VECTOR_NON_NULL(out->bounds, NULL);
@@ -2595,4 +2630,6 @@
         psFree(errorsF32);
     }
+
+    psTrace(__func__, 3, "---- %s(psHistogram) end  ----\n", __func__);
     return (out);
 }
@@ -2610,4 +2647,5 @@
 psVector* p_psConvertToF32(psVector* in)
 {
+    psTrace(__func__, 4,"---- %s() begin  ----\n", __func__);
     if (in == NULL) {
         return(NULL);
@@ -2670,4 +2708,6 @@
                 strType);
     }
+
+    psTrace(__func__, 4,"---- %s(psVector) end  ----\n", __func__);
     return (tmp);
 }
@@ -2692,4 +2732,5 @@
                        psMaskType maskVal)
 {
+    psTrace(__func__, 3,"---- %s() begin  ----\n", __func__);
     PS_ASSERT_PTR_NON_NULL(stats, NULL);
     PS_ASSERT_VECTOR_NON_NULL(in, stats);
@@ -2754,5 +2795,5 @@
     // Since the various robust stats quantities share much computation, they
     // are grouped together in a single private function:
-    // p_psVectorRobustStatsNew()
+    // p_psVectorRobustStats()
     if ((stats->options & PS_STAT_ROBUST_MEAN) ||
             (stats->options & PS_STAT_ROBUST_MEDIAN) ||
@@ -2760,5 +2801,5 @@
             (stats->options & PS_STAT_ROBUST_STDEV) ||
             (stats->options & PS_STAT_ROBUST_QUARTILE)) {
-        if (0 != p_psVectorRobustStatsNew(inF32, errorsF32, mask, maskVal, stats)) {
+        if (0 != p_psVectorRobustStats(inF32, errorsF32, mask, maskVal, stats)) {
             psError(PS_ERR_UNKNOWN, false,
                     PS_ERRORTEXT_psStats_STATS_FAILED);
@@ -2767,4 +2808,5 @@
             // XXX: If so, do it for other funcs?
             psFree(stats);
+            psTrace(__func__, 3,"---- %s(NULL) end  ----\n", __func__);
             return(NULL);
         }
@@ -2808,4 +2850,5 @@
         psFree(errorsF32);
     }
+    psTrace(__func__, 3,"---- %s(psStats) end  ----\n", __func__);
     return (stats);
 }
