Index: /trunk/psLib/src/dataManip/psFunctions.c
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.c	(revision 3373)
+++ /trunk/psLib/src/dataManip/psFunctions.c	(revision 3374)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-02-17 19:26:23 $
+ *  @version $Revision: 1.90 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-03-04 20:51:20 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1206,6 +1206,6 @@
     PS_VECTOR_CHECK_TYPE(x, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
+    psVector *tmp;
+    psVector *myX;
     psS32 i;
 
@@ -1248,7 +1248,7 @@
     PS_VECTOR_CHECK_TYPE(y, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1306,8 +1306,8 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1374,9 +1374,9 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myW = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myW;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1607,6 +1607,6 @@
     PS_VECTOR_CHECK_TYPE(x, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
+    psVector *tmp;
+    psVector *myX;
     psS32 i;
 
@@ -1652,7 +1652,7 @@
     PS_VECTOR_CHECK_TYPE(y, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1714,8 +1714,8 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1786,9 +1786,9 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myW = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myW;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
Index: /trunk/psLib/src/dataManip/psStats.c
===================================================================
--- /trunk/psLib/src/dataManip/psStats.c	(revision 3373)
+++ /trunk/psLib/src/dataManip/psStats.c	(revision 3374)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.117 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-03-01 22:21:34 $
+ *  @version $Revision: 1.118 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-03-04 20:51:20 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1006,4 +1006,6 @@
  
 XXX: Use static vectors for tmpMask.
+ 
+XXX: This has not been tested.
  *****************************************************************************/
 psS32 p_psVectorClippedStats(const psVector* myVector,
@@ -1016,5 +1018,5 @@
     psF32 clippedStdev = 0.0;   // self-explanatory
     psVector* tmpMask = NULL;   // Temporary vector for masks during iterations.
-    psStats *statsTmp = NULL;   // Temporary psStats struct.
+    static psStats *statsTmp = NULL;   // Temporary psStats struct.
     psS32 rc = 0;               // Return code.
 
@@ -1040,4 +1042,5 @@
     // However, we do no want to modify the original mask vector.
     tmpMask = psVectorAlloc(myVector->n, PS_TYPE_U8);
+    PS_VECTOR_SET_U8(tmpMask, 0);
 
     // If we were called with a mask vector, then initialize the temporary
@@ -1068,5 +1071,5 @@
 
     // 3. Use the sample median as the first estimator of the mean X.
-    clippedMean = statsTmp->sampleMean;
+    clippedMean = statsTmp->sampleMedian;
 
     // 4. Use the sample stdev as the first estimator of the mean stdev.
Index: /trunk/psLib/src/math/psPolynomial.c
===================================================================
--- /trunk/psLib/src/math/psPolynomial.c	(revision 3373)
+++ /trunk/psLib/src/math/psPolynomial.c	(revision 3374)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-02-17 19:26:23 $
+ *  @version $Revision: 1.90 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-03-04 20:51:20 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1206,6 +1206,6 @@
     PS_VECTOR_CHECK_TYPE(x, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
+    psVector *tmp;
+    psVector *myX;
     psS32 i;
 
@@ -1248,7 +1248,7 @@
     PS_VECTOR_CHECK_TYPE(y, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1306,8 +1306,8 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1374,9 +1374,9 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myW = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myW;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1607,6 +1607,6 @@
     PS_VECTOR_CHECK_TYPE(x, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
+    psVector *tmp;
+    psVector *myX;
     psS32 i;
 
@@ -1652,7 +1652,7 @@
     PS_VECTOR_CHECK_TYPE(y, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1714,8 +1714,8 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1786,9 +1786,9 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myW = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myW;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 3373)
+++ /trunk/psLib/src/math/psSpline.c	(revision 3374)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-02-17 19:26:23 $
+ *  @version $Revision: 1.90 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-03-04 20:51:20 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1206,6 +1206,6 @@
     PS_VECTOR_CHECK_TYPE(x, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
+    psVector *tmp;
+    psVector *myX;
     psS32 i;
 
@@ -1248,7 +1248,7 @@
     PS_VECTOR_CHECK_TYPE(y, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1306,8 +1306,8 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1374,9 +1374,9 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F32, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myW = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myW;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1607,6 +1607,6 @@
     PS_VECTOR_CHECK_TYPE(x, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
+    psVector *tmp;
+    psVector *myX;
     psS32 i;
 
@@ -1652,7 +1652,7 @@
     PS_VECTOR_CHECK_TYPE(y, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1714,8 +1714,8 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
@@ -1786,9 +1786,9 @@
     PS_VECTOR_CHECK_TYPE(z, PS_TYPE_F64, NULL);
 
-    psVector *tmp = NULL;
-    psVector *myW = NULL;
-    psVector *myX = NULL;
-    psVector *myY = NULL;
-    psVector *myZ = NULL;
+    psVector *tmp;
+    psVector *myW;
+    psVector *myX;
+    psVector *myY;
+    psVector *myZ;
     psS32 i;
     psS32 vecLen=x->n;
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 3373)
+++ /trunk/psLib/src/math/psStats.c	(revision 3374)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.117 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-03-01 22:21:34 $
+ *  @version $Revision: 1.118 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-03-04 20:51:20 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1006,4 +1006,6 @@
  
 XXX: Use static vectors for tmpMask.
+ 
+XXX: This has not been tested.
  *****************************************************************************/
 psS32 p_psVectorClippedStats(const psVector* myVector,
@@ -1016,5 +1018,5 @@
     psF32 clippedStdev = 0.0;   // self-explanatory
     psVector* tmpMask = NULL;   // Temporary vector for masks during iterations.
-    psStats *statsTmp = NULL;   // Temporary psStats struct.
+    static psStats *statsTmp = NULL;   // Temporary psStats struct.
     psS32 rc = 0;               // Return code.
 
@@ -1040,4 +1042,5 @@
     // However, we do no want to modify the original mask vector.
     tmpMask = psVectorAlloc(myVector->n, PS_TYPE_U8);
+    PS_VECTOR_SET_U8(tmpMask, 0);
 
     // If we were called with a mask vector, then initialize the temporary
@@ -1068,5 +1071,5 @@
 
     // 3. Use the sample median as the first estimator of the mean X.
-    clippedMean = statsTmp->sampleMean;
+    clippedMean = statsTmp->sampleMedian;
 
     // 4. Use the sample stdev as the first estimator of the mean stdev.
