Index: trunk/psLib/src/dataManip/psStats.c
===================================================================
--- trunk/psLib/src/dataManip/psStats.c	(revision 1407)
+++ trunk/psLib/src/dataManip/psStats.c	(revision 1440)
@@ -10,6 +10,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-07 00:06:06 $
+ *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-09 23:34:57 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -54,6 +54,6 @@
 #define MAX_ITERATIONS 10
 
-void p_psVectorRobustStats(const psVector * restrict myVector,
-                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats);
+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 */
@@ -116,5 +116,5 @@
 /*****************************************************************************/
 
-bool p_psGetStatValue(const psStats * stats, double *value)
+bool p_psGetStatValue(const psStats* stats, double *value)
 {
 
@@ -175,5 +175,5 @@
  *****************************************************************************/
 
-void p_psVectorPrint(psVector * myVector, psVector * maskVector, unsigned int maskVal, psStats * stats)
+void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned int maskVal, psStats* stats)
 {
     int i = 0;                  // Loop index variable.
@@ -218,6 +218,6 @@
  *****************************************************************************/
 
-void p_psVectorSampleMean(const psVector * restrict myVector,
-                          const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+void p_psVectorSampleMean(const psVector* restrict myVector,
+                          const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
 {
     int i = 0;                  // Loop index variable
@@ -282,6 +282,6 @@
     NULL
  *****************************************************************************/
-void p_psVectorMax(const psVector * restrict myVector,
-                   const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+void p_psVectorMax(const psVector* restrict myVector,
+                   const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
 {
     int i = 0;                  // Loop index variable
@@ -343,6 +343,6 @@
     NULL
  *****************************************************************************/
-void p_psVectorMin(const psVector * restrict myVector,
-                   const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+void p_psVectorMin(const psVector* restrict myVector,
+                   const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
 {
     int i = 0;                  // Loop index variable
@@ -404,6 +404,6 @@
     NULL
  *****************************************************************************/
-int p_psVectorNValues(const psVector * restrict myVector,
-                      const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+int p_psVectorNValues(const psVector* restrict myVector,
+                      const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
 {
     int i = 0;                  // Loop index variable
@@ -456,9 +456,9 @@
     NULL
  *****************************************************************************/
-void p_psVectorSampleMedian(const psVector * restrict myVector,
-                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
-{
-    psVector *unsortedVector = NULL;    // Temporary vector
-    psVector *sortedVector = NULL;      // Temporary vector
+void p_psVectorSampleMedian(const psVector* restrict myVector,
+                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
+{
+    psVector* unsortedVector = NULL;    // Temporary vector
+    psVector* sortedVector = NULL;      // Temporary vector
     int i = 0;                  // Loop index variable
     int count = 0;              // # of points in this mean?
@@ -565,5 +565,5 @@
     XXX: use a static variable for gaussianCoefs[] and compute them once.
  *****************************************************************************/
-psVector *p_psVectorsmoothHistGaussian(psHistogram * robustHistogram, float sigma)
+psVector* p_psVectorsmoothHistGaussian(psHistogram* robustHistogram, float sigma)
 {
     int i = 0;                  // Loop index variable
@@ -572,5 +572,5 @@
     float expo = 0.0;           // Temporary variable
     float gaussianCoefs[1 + (2 * GAUSS_WIDTH)]; // The Gaussian Coefficients
-    psVector *smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
+    psVector* smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
 
     for (i = 0; i < (1 + (2 * GAUSS_WIDTH)); i++) {
@@ -628,9 +628,9 @@
     NULL
  *****************************************************************************/
-void p_psVectorSampleQuartiles(const psVector * restrict myVector,
-                               const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
-{
-    psVector *unsortedVector = NULL;    // Temporary vector
-    psVector *sortedVector = NULL;      // Temporary vector
+void p_psVectorSampleQuartiles(const psVector* restrict myVector,
+                               const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
+{
+    psVector* unsortedVector = NULL;    // Temporary vector
+    psVector* sortedVector = NULL;      // Temporary vector
     int i = 0;                  // Loop index variable
     int count = 0;              // # of points in this mean?
@@ -710,6 +710,6 @@
  
  *****************************************************************************/
-void p_psVectorSampleStdev(const psVector * restrict myVector,
-                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+void p_psVectorSampleStdev(const psVector* restrict myVector,
+                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
 {
     int i = 0;                  // Loop index variable
@@ -795,6 +795,6 @@
     NULL
  *****************************************************************************/
-void p_psVectorClippedStats(const psVector * restrict myVector,
-                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+void p_psVectorClippedStats(const psVector* restrict myVector,
+                            const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
 {
     int i = 0;                  // Loop index variable
@@ -804,5 +804,5 @@
     float oldStanMean = 0.0;    // Temporary variable
     float oldStanStdev = 0.0;   // Temporary variable
-    psVector *tmpMask = NULL;   // Temporary vector
+    psVector* tmpMask = NULL;   // Temporary vector
 
     // Endure that stats->clipIter is within the proper range.
@@ -884,5 +884,5 @@
 elements of a vector to a range between 0.0 and 1.0.
  *****************************************************************************/
-void p_psNormalizeVector(psVector * myData)
+void p_psNormalizeVector(psVector* myData)
 {
     float min = (float)HUGE;
@@ -911,5 +911,5 @@
 specified data point.
  *****************************************************************************/
-float p_psGaussian(const psVector * restrict myData, const psVector * restrict myParams)
+float p_psGaussian(const psVector* restrict myData, const psVector* restrict myParams)
 {
     float x = myData->data.F32[0];
@@ -928,5 +928,5 @@
 calculates the specified partial derivative of the above Gaussian function.
  *****************************************************************************/
-float p_psGaussianDeriv(const psVector * restrict myData, const psVector * restrict myParams, int whichParam)
+float p_psGaussianDeriv(const psVector* restrict myData, const psVector* restrict myParams, int whichParam)
 {
     float x = myData->data.F32[0];
@@ -954,5 +954,5 @@
 specified data point.
  *****************************************************************************/
-float p_psQuadratic(const psVector * restrict myParams, const psVector * restrict myCoords)
+float p_psQuadratic(const psVector* restrict myParams, const psVector* restrict myCoords)
 {
     float x = myCoords->data.F32[0];
@@ -970,6 +970,6 @@
 calculates the specified partial derivative of the above quadratic function.
  *****************************************************************************/
-float p_psQuadraticDeriv(const psVector * restrict myParams,
-                         const psVector * restrict myCoords, int whichParamDeriv)
+float p_psQuadraticDeriv(const psVector* restrict myParams,
+                         const psVector* restrict myCoords, int whichParamDeriv)
 {
     float x = myCoords->data.F32[0];
@@ -996,5 +996,5 @@
 decreasing within that range.
  *****************************************************************************/
-float p_ps1DPolyMedian(psPolynomial1D * myPoly, float rangeLow, float rangeHigh, float getThisValue)
+float p_ps1DPolyMedian(psPolynomial1D* myPoly, float rangeLow, float rangeHigh, float getThisValue)
 {
     int numIterations = 0;
@@ -1036,10 +1036,10 @@
 XXX: This function is currently not being used.
  *****************************************************************************/
-float p_psFitQuadratic(psHistogram * histogram, psVector * cumulativeSums, int binNum, float fitFloat)
-{
-    psVector *x = psVectorAlloc(3, PS_TYPE_F64);
-    psVector *y = psVectorAlloc(3, PS_TYPE_F64);
-    psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
-    psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
+float p_psFitQuadratic(psHistogram* histogram, psVector* cumulativeSums, int binNum, float fitFloat)
+{
+    psVector* x = psVectorAlloc(3, PS_TYPE_F64);
+    psVector* y = psVectorAlloc(3, PS_TYPE_F64);
+    psVector* yErr = psVectorAlloc(3, PS_TYPE_F64);
+    psPolynomial1D* myPoly = psPolynomial1DAlloc(2);
 
     if ((binNum > 0) && (binNum < (histogram->nums->n + 1))) {
@@ -1100,9 +1100,9 @@
     NULL
 *****************************************************************************/
-void p_psVectorRobustStats(const psVector * restrict myVector,
-                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
-{
-    psHistogram *robustHistogram = NULL;
-    psVector *robustHistogramVector = NULL;
+void p_psVectorRobustStats(const psVector* restrict myVector,
+                           const psVector* restrict maskVector, unsigned int maskVal, psStats* stats)
+{
+    psHistogram* robustHistogram = NULL;
+    psVector* robustHistogramVector = NULL;
     float binSize = 0.0;        // Size of the histogram bins
     int LQBinNum = -1;          // Bin num for lower quartile
@@ -1113,11 +1113,11 @@
     float dL = 0.0;
     int numBins = 0;
-    psStats *tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
-
-    // psImage *domain;
-    // psVector *errors;
-    // psVector *data;
-    // psVector *initialGuess;
-    // psVector *theParams;
+    psStats* tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
+
+    // psImage* domain;
+    // psVector* errors;
+    // psVector* data;
+    // psVector* initialGuess;
+    // psVector* theParams;
     // float chiSq=0.0;
     // float max = -HUGE;
@@ -1129,10 +1129,10 @@
     float sumSquares = 0.0;
     float sumDiffs = 0.0;
-    psVector *x = psVectorAlloc(3, PS_TYPE_F64);
-    psVector *y = psVectorAlloc(3, PS_TYPE_F64);
-    psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
-    psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
-    psVector *cumulativeRobustSumsFullRange = NULL;
-    psVector *cumulativeRobustSumsDlRange = NULL;
+    psVector* x = psVectorAlloc(3, PS_TYPE_F64);
+    psVector* y = psVectorAlloc(3, PS_TYPE_F64);
+    psVector* yErr = psVectorAlloc(3, PS_TYPE_F64);
+    psPolynomial1D* myPoly = psPolynomial1DAlloc(2);
+    psVector* cumulativeRobustSumsFullRange = NULL;
+    psVector* cumulativeRobustSumsDlRange = NULL;
     float sumRobust = 0.0;
     float sumN50 = 0.0;
@@ -1500,14 +1500,14 @@
 /*****************************************************************************/
 
-static void histogramFree(psHistogram * myHist);
+static void histogramFree(psHistogram* myHist);
 
 /******************************************************************************
     psStatsAlloc(): This routine must create a new psStats data structure.
  *****************************************************************************/
-psStats *psStatsAlloc(psStatsOptions options)
-{
-    psStats *newStruct = NULL;
-
-    newStruct = (psStats *) psAlloc(sizeof(psStats));
+psStats* psStatsAlloc(psStatsOptions options)
+{
+    psStats* newStruct = NULL;
+
+    newStruct = (psStats* ) psAlloc(sizeof(psStats));
     newStruct->sampleMean = NAN;
     newStruct->sampleMedian = NAN;
@@ -1548,8 +1548,8 @@
     The histogram structure
  *****************************************************************************/
-psHistogram *psHistogramAlloc(float lower, float upper, int n)
+psHistogram* psHistogramAlloc(float lower, float upper, int n)
 {
     int i = 0;                  // Loop index variable
-    psHistogram *newHist = NULL;        // The new histogram structure
+    psHistogram* newHist = NULL;        // The new histogram structure
     float binSize = 0.0;        // The histogram bin size
 
@@ -1567,5 +1567,5 @@
     // Allocate memory for the new histogram structure.  If there are N
     // bins, then there are N+1 bounds to those bins.
-    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
+    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
     p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
     newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32);
@@ -1605,7 +1605,7 @@
     The histogram structure
  *****************************************************************************/
-psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds)
-{
-    psHistogram *newHist = NULL;        // The new histogram structure
+psHistogram* psHistogramAllocGeneric(const psVector* restrict bounds)
+{
+    psHistogram* newHist = NULL;        // The new histogram structure
     int i;                      // Loop index variable
 
@@ -1626,5 +1626,5 @@
     }
     // Allocate memory for the new histogram structure.
-    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
+    newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
     p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
     newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
@@ -1650,5 +1650,5 @@
 }
 
-static void histogramFree(psHistogram * myHist)
+static void histogramFree(psHistogram* myHist)
 {
     psFree(myHist->bounds);
@@ -1670,7 +1670,7 @@
     The histogram structure "out".
  *****************************************************************************/
-psHistogram *psVectorHistogram(psHistogram * out,
-                               const psVector * restrict in,
-                               const psVector * restrict mask, unsigned int maskVal)
+psHistogram* psVectorHistogram(psHistogram* out,
+                               const psVector* restrict in,
+                               const psVector* restrict mask, unsigned int maskVal)
 {
     int i = 0;                  // Loop index variable
@@ -1767,8 +1767,8 @@
 the various stat functions.
  *****************************************************************************/
-psVector *p_psConvertToF32(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
+psVector* p_psConvertToF32(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal)
 {
     int i = 0;
-    psVector *tmp = NULL;
+    psVector* tmp = NULL;
 
     if (in->type.type == PS_TYPE_S32) {
@@ -1812,7 +1812,7 @@
 macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64.
  *****************************************************************************/
-psStats *psVectorStats(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
-{
-    psVector *inF32;
+psStats* psVectorStats(psStats* stats, psVector* in, psVector* mask, unsigned int maskVal)
+{
+    psVector* inF32;
     int mustFreeTmp = 1;
 
