Index: trunk/psLib/src/math/psStats.c
===================================================================
--- trunk/psLib/src/math/psStats.c	(revision 5530)
+++ trunk/psLib/src/math/psStats.c	(revision 5548)
@@ -17,6 +17,6 @@
 *
 *
-*  @version $Revision: 1.151 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-11-16 23:06:19 $
+*  @version $Revision: 1.152 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-18 20:30:35 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -661,6 +661,7 @@
 call that.  Is that possible?
  *****************************************************************************/
-psVector *p_psVectorSmoothHistGaussian(psHistogram *histogram,
-                                       psF32 sigma)
+psVector *p_psVectorSmoothHistGaussian(
+    psHistogram *histogram,
+    psF32 sigma)
 {
     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
@@ -674,10 +675,5 @@
 
     psS32 numBins = histogram->nums->n;
-    psS32 numBounds = histogram->bounds->n;
     psVector *smooth = psVectorAlloc(numBins, PS_TYPE_F32);
-    psF32 firstBound = histogram->bounds->data.F32[0];
-    psF32 lastBound = histogram->bounds->data.F32[numBounds-1];
-    psScalar x;
-    x.type.type = PS_TYPE_F32;
     psS32 jMin = 0;
     psS32 jMax = 0;
@@ -685,6 +681,8 @@
     if (histogram->uniform == false) {
         //
-        // We get here if the histogram is non-uniform.
+        // We get here if the histogram is non-uniform.  This code is not tested.
+        // However, it is also not used anywhere, yet.
         //
+        psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSmoothHistGaussian() on non-uniform histograms has not been tested or used.\n");
 
         for (psS32 i = 0; i < numBins; i++) {
@@ -696,36 +694,24 @@
             // range of data values surrounding iMid.  The range is of size:
             // 2*PS_GAUSS_WIDTH*sigma
-            //
-            x.data.F32 = iMid - (PS_GAUSS_WIDTH * sigma);
-            if ((x.data.F32 >= firstBound) && (x.data.F32 <= lastBound)) {
-                jMin = p_psVectorBinDisect( *(psVector* *)&histogram->bounds, &x);
-                if (jMin < 0) {
-                    psError(PS_ERR_UNEXPECTED_NULL,
-                            false,
-                            PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM);
-                    psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__);
-                    return(NULL);
-                }
-            } else if (x.data.F32 <= firstBound) {
-                jMin = 0;
-            } else if (x.data.F32 >= lastBound) {
-                jMin = histogram->bounds->n - 1;
-            }
-
-            x.data.F32 = iMid + (PS_GAUSS_WIDTH * sigma);
-            if ((x.data.F32 >= firstBound) && (x.data.F32 <= lastBound)) {
-                jMax = p_psVectorBinDisect( *(psVector* *)&histogram->bounds, &x);
-                if (jMax < 0) {
-                    psError(PS_ERR_UNEXPECTED_NULL,
-                            false,
-                            PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM);
-                    psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__);
-                    return(NULL);
-                }
-            } else if (x.data.F32 <= firstBound) {
-                jMax = 0;
-            } else if (x.data.F32 >= lastBound) {
-                jMax = histogram->bounds->n - 1;
-            }
+            psF32 x = iMid - (PS_GAUSS_WIDTH * sigma);
+            jMin = i;
+            while (jMin > 0) {
+                if ((histogram->bounds->data.F32[jMin] <= x) &&
+                        (histogram->bounds->data.F32[jMin+1] >= x)) {
+                    break;
+                }
+                jMin--;
+            }
+
+            x = iMid + (PS_GAUSS_WIDTH * sigma);
+            jMax = i;
+            while (jMax < (histogram->bounds->n - 1)) {
+                if ((histogram->bounds->data.F32[jMax] <= x) &&
+                        (histogram->bounds->data.F32[jMax+1] >= x)) {
+                    break;
+                }
+                jMax++;
+            }
+
 
             //
