Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 1384)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 00:55:17 $
+*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,14 +33,14 @@
 {
     if ( out == NULL ) {
-            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-        }
+        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
+    }
     out->x = transform->x->coeff[ 0 ][ 0 ] +
              ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) +
              ( transform->x->coeff[ 0 ][ 1 ] * coords->y );
-             
+
     out->y = transform->y->coeff[ 0 ][ 0 ] +
              ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) +
              ( transform->y->coeff[ 0 ][ 1 ] * coords->y );
-             
+
     return ( out );
 }
@@ -56,7 +56,7 @@
 {
     if ( out == NULL ) {
-            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-        }
-        
+        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
+    }
+
     out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
              ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
@@ -64,5 +64,5 @@
              ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
              ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
-             
+
     out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
              ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
@@ -70,5 +70,5 @@
              ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
              ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
-             
+
     return ( out );
 }
@@ -81,10 +81,10 @@
 {
     psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) );
-    
+
     tmp->sinPhi = sin( NPlat );
     tmp->cosPhi = cos( NPlat );
     tmp->Xo = Xo;
     tmp->xo = xo;
-    
+
     return ( tmp );
 }
@@ -114,9 +114,9 @@
     double y = 0.0;
     double dx = 0.0;
-    
+
     if ( out == NULL ) {
-            out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-        }
-        
+        out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
+    }
+
     x = coord->r;
     y = coord->d;
@@ -127,8 +127,8 @@
            cos( y );
     cosX = cos( y ) * cos( dx ) / cos( y );
-    
+
     out->r = atan2( sinX, cosX ) + transform->Xo;
     out->d = atan2( sinY, cosY );
-    
+
     return ( out );
 }
@@ -142,5 +142,5 @@
     double Xo = 0.0;
     double xo = 0.0;
-    
+
     return ( psSphereTransformAlloc( phi, Xo, xo ) );
 }
@@ -154,5 +154,5 @@
     double Xo = 0.0;
     double xo = 0.0;
-    
+
     return ( psSphereTransformAlloc( phi, Xo, xo ) );
 }
@@ -178,15 +178,19 @@
 {
     if ( x > 0 ) {
-            return ( atan( y / x ) );
-        } else if ( ( x == 0 ) && ( y == 0 ) ) {
+        return ( atan( y / x ) );
+    } else
+        if ( ( x == 0 ) && ( y == 0 ) ) {
             return ( 0.5 * M_PI );
-        } else if ( ( x == 0 ) && ( y == 0 ) ) {
-            return ( -0.5 * M_PI );
-        } else if ( ( x == 0 ) && ( y == 0 ) ) {
-            return ( M_PI + atan( y / x ) );
-        } else if ( ( x == 0 ) && ( y == 0 ) ) {
-            return ( -M_PI + atan( y / x ) );
-        }
-        
+        } else
+            if ( ( x == 0 ) && ( y == 0 ) ) {
+                return ( -0.5 * M_PI );
+            } else
+                if ( ( x == 0 ) && ( y == 0 ) ) {
+                    return ( M_PI + atan( y / x ) );
+                } else
+                    if ( ( x == 0 ) && ( y == 0 ) ) {
+                        return ( -M_PI + atan( y / x ) );
+                    }
+
     psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y );
     return ( 0.0 );
@@ -201,37 +205,43 @@
     float alpha = 0.0;
     psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-    
+
     if ( projection->type == PS_PROJ_TAN ) {
-            R = cot( coord->r ) * ( 180.0 / M_PI );
-            tmp->x = R * sin( coord->d );
-            tmp->y = R * cos( coord->d );
-            
-        } else if ( projection->type == PS_PROJ_SIN ) {
+        R = cot( coord->r ) * ( 180.0 / M_PI );
+        tmp->x = R * sin( coord->d );
+        tmp->y = R * cos( coord->d );
+
+    } else
+        if ( projection->type == PS_PROJ_SIN ) {
             R = cos( coord->r ) * ( 180.0 / M_PI );
             tmp->x = R * sin( coord->d );
             tmp->y = R * cos( coord->d );
-            
-        } else if ( projection->type == PS_PROJ_CAR ) {
-            tmp->x = coord->d;
-            tmp->y = coord->r;
-            
-        } else if ( projection->type == PS_PROJ_MER ) {
-            tmp->x = coord->d;
-            tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
-            
-        } else if ( projection->type == PS_PROJ_AIT ) {
-            alpha = 1.0 / ( ( 180.0 / M_PI ) *
-                            sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
-                            
-            tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
-            tmp->y = alpha * sin( coord->d );
-            
-        } else if ( projection->type == PS_PROJ_PAR ) {
-            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
-            
-        } else if ( projection->type == PS_PROJ_GLS ) {
-            psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
-        }
-        
+
+        } else
+            if ( projection->type == PS_PROJ_CAR ) {
+                tmp->x = coord->d;
+                tmp->y = coord->r;
+
+            } else
+                if ( projection->type == PS_PROJ_MER ) {
+                    tmp->x = coord->d;
+                    tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
+
+                } else
+                    if ( projection->type == PS_PROJ_AIT ) {
+                        alpha = 1.0 / ( ( 180.0 / M_PI ) *
+                                        sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
+
+                        tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
+                        tmp->y = alpha * sin( coord->d );
+
+                    } else
+                        if ( projection->type == PS_PROJ_PAR ) {
+                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
+
+                        } else
+                            if ( projection->type == PS_PROJ_GLS ) {
+                                psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
+                            }
+
     return ( tmp );
 }
@@ -247,40 +257,46 @@
     float chu2 = 0.0;
     psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-    
+
     if ( projection->type == PS_PROJ_TAN ) {
-            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
-            tmp->d = arg( -coord->y, coord->x );
-            tmp->r = atan( 180.0 / ( R * M_PI ) );
-            
-        } else if ( projection->type == PS_PROJ_SIN ) {
+        R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
+        tmp->d = arg( -coord->y, coord->x );
+        tmp->r = atan( 180.0 / ( R * M_PI ) );
+
+    } else
+        if ( projection->type == PS_PROJ_SIN ) {
             R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
             tmp->d = arg( -coord->y, coord->x );
             tmp->r = acos( ( R * M_PI ) / 180.0 );
-            
-        } else if ( projection->type == PS_PROJ_CAR ) {
-            tmp->d = coord->x;
-            tmp->r = coord->y;
-            
-        } else if ( projection->type == PS_PROJ_MER ) {
-            tmp->d = coord->x;
-            tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
-            
-        } else if ( projection->type == PS_PROJ_AIT ) {
-            chu1 = ( coord->x * M_PI ) / 720.0;
-            chu1 *= chu1;
-            chu2 = ( coord->y * M_PI ) / 360.0;
-            chu2 *= chu2;
-            chu = sqrt( 1.0 - chu1 - chu2 );
-            tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
-                                ( coord->x * chu * M_PI ) / 360.0 );
-            tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
-            
-        } else if ( projection->type == PS_PROJ_PAR ) {
-            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
-            
-        } else if ( projection->type == PS_PROJ_GLS ) {
-            psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
-        }
-        
+
+        } else
+            if ( projection->type == PS_PROJ_CAR ) {
+                tmp->d = coord->x;
+                tmp->r = coord->y;
+
+            } else
+                if ( projection->type == PS_PROJ_MER ) {
+                    tmp->d = coord->x;
+                    tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
+
+                } else
+                    if ( projection->type == PS_PROJ_AIT ) {
+                        chu1 = ( coord->x * M_PI ) / 720.0;
+                        chu1 *= chu1;
+                        chu2 = ( coord->y * M_PI ) / 360.0;
+                        chu2 *= chu2;
+                        chu = sqrt( 1.0 - chu1 - chu2 );
+                        tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
+                                            ( coord->x * chu * M_PI ) / 360.0 );
+                        tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
+
+                    } else
+                        if ( projection->type == PS_PROJ_PAR ) {
+                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
+
+                        } else
+                            if ( projection->type == PS_PROJ_GLS ) {
+                                psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
+                            }
+
     return ( tmp );
 }
@@ -298,41 +314,45 @@
     double tmpR = 0.0;
     double tmpD = 0.0;
-    
+
     if ( mode == PS_LINEAR ) {
-            // XXX: I have no idea how to construct this.  Maybe project both
-            // sperical positions onto the plane, set the origin at one of the
-            // points on the plane, then deproject?
-            
-            // XXX: Do I need to somehow scale this projection?
-            // project position1?  Will it project to (0.0, 0.0)?
-            proj.R = position1->r;
-            proj.D = position1->d;
-            proj.Xs = 1.0;
-            proj.Ys = 1.0;
-            proj.type = PS_PROJ_TAN;
-            
-            //        lin = psProject(position2, proj);
-            //        tmp = psDeproject(lin, proj);
-            
-            // XXX: Do we need to convert units in tmp?
-            return ( tmp );
-        } else if ( mode == PS_SPHERICAL ) {
+        // XXX: I have no idea how to construct this.  Maybe project both
+        // sperical positions onto the plane, set the origin at one of the
+        // points on the plane, then deproject?
+
+        // XXX: Do I need to somehow scale this projection?
+        // project position1?  Will it project to (0.0, 0.0)?
+        proj.R = position1->r;
+        proj.D = position1->d;
+        proj.Xs = 1.0;
+        proj.Ys = 1.0;
+        proj.type = PS_PROJ_TAN;
+
+        //        lin = psProject(position2, proj);
+        //        tmp = psDeproject(lin, proj);
+
+        // XXX: Do we need to convert units in tmp?
+        return ( tmp );
+    } else
+        if ( mode == PS_SPHERICAL ) {
             tmpR = position2->r - position1->r;
             tmpD = position2->d - position1->d;
-            
+
             if ( unit == PS_ARCSEC ) {
-                    tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
-                    tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
-                } else if ( unit == PS_ARCMIN ) {
+                tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
+                tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
+            } else
+                if ( unit == PS_ARCMIN ) {
                     tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI;
                     tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI;
-                } else if ( unit == PS_DEGREE ) {
-                    tmpR = ( tmpR * 180.0 ) / M_PI;
-                    tmpD = ( tmpR * 180.0 ) / M_PI;
-                } else if ( unit == PS_RADIAN ) {}
-            else {
-                    psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
-                }
-                
+                } else
+                    if ( unit == PS_DEGREE ) {
+                        tmpR = ( tmpR * 180.0 ) / M_PI;
+                        tmpD = ( tmpR * 180.0 ) / M_PI;
+                    } else
+                    if ( unit == PS_RADIAN ) {}
+                        else {
+                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
+                        }
+
             tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
             tmp->r = tmpR;
@@ -361,35 +381,39 @@
     double tmpR = 0.0;
     double tmpD = 0.0;
-    
+
     if ( mode == PS_LINEAR ) {
-            proj.R = position->r;
-            proj.D = position->d;
-            proj.Xs = 1.0;
-            proj.Ys = 1.0;
-            proj.type = PS_PROJ_TAN;
-            
-            lin.x = offset->r;
-            lin.y = offset->d;
-            
-            tmp = psDeproject( &lin, &proj );
-            return ( tmp );
-            
-        } else if ( mode == PS_SPHERICAL ) {
+        proj.R = position->r;
+        proj.D = position->d;
+        proj.Xs = 1.0;
+        proj.Ys = 1.0;
+        proj.type = PS_PROJ_TAN;
+
+        lin.x = offset->r;
+        lin.y = offset->d;
+
+        tmp = psDeproject( &lin, &proj );
+        return ( tmp );
+
+    } else
+        if ( mode == PS_SPHERICAL ) {
             if ( unit == PS_ARCSEC ) {
-                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
-                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
-                } else if ( unit == PS_ARCMIN ) {
+                tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
+                tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
+            } else
+                if ( unit == PS_ARCMIN ) {
                     tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 );
                     tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 );
-                } else if ( unit == PS_DEGREE ) {
-                    tmpR = ( M_PI * offset->r ) / ( 180.0 );
-                    tmpD = ( M_PI * offset->d ) / ( 180.0 );
-                } else if ( unit == PS_RADIAN ) {
-                    tmpR = offset->r;
-                    tmpD = offset->d;
-                } else {
-                    psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
-                }
-                
+                } else
+                    if ( unit == PS_DEGREE ) {
+                        tmpR = ( M_PI * offset->r ) / ( 180.0 );
+                        tmpD = ( M_PI * offset->d ) / ( 180.0 );
+                    } else
+                        if ( unit == PS_RADIAN ) {
+                            tmpR = offset->r;
+                            tmpD = offset->d;
+                        } else {
+                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
+                        }
+
             tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
             tmp->r = position->r + tmpR;
@@ -397,5 +421,5 @@
             tmp->rErr = 0.0;
             tmp->dErr = 0.0;
-            
+
             // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
             // and (0 to 2*PI).
Index: /trunk/psLib/src/astro/psCoord.h
===================================================================
--- /trunk/psLib/src/astro/psCoord.h	(revision 1384)
+++ /trunk/psLib/src/astro/psCoord.h	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 00:55:17 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -30,42 +30,42 @@
 
 typedef struct
-    {
-        double x;      ///< x position
-        double y;      ///< y position
-        double xErr;   ///< Error in x position
-        double yErr;   ///< Error in y position
-    }
+{
+    double x;      ///< x position
+    double y;      ///< y position
+    double xErr;   ///< Error in x position
+    double yErr;   ///< Error in y position
+}
 psPlane;
 
 typedef struct
-    {
-        double r;      ///< RA
-        double d;      ///< Dec
-        double rErr;   ///< Error in RA
-        double dErr;   ///< Error in Dec
-    }
+{
+    double r;      ///< RA
+    double d;      ///< Dec
+    double rErr;   ///< Error in RA
+    double dErr;   ///< Error in Dec
+}
 psSphere;
 
 typedef struct
-    {
-        psDPolynomial2D *x;
-        psDPolynomial2D *y;
-    }
+{
+    psDPolynomial2D *x;
+    psDPolynomial2D *y;
+}
 psPlaneTransform;
 
 typedef struct
-    {
-        psDPolynomial4D *x;
-        psDPolynomial4D *y;
-    }
+{
+    psDPolynomial4D *x;
+    psDPolynomial4D *y;
+}
 psPlaneDistort;
 
 typedef struct
-    {
-        double sinPhi;                    ///< sin of North Pole lattitude
-        double cosPhi;                    ///< cos of North Pole lattitude
-        double Xo;                        ///< First PT of Ares lon
-        double xo;                        ///< First PT of Ares equiv lon
-    }
+{
+    double sinPhi;                    ///< sin of North Pole lattitude
+    double cosPhi;                    ///< cos of North Pole lattitude
+    double Xo;                        ///< First PT of Ares lon
+    double xo;                        ///< First PT of Ares equiv lon
+}
 psSphereTransform;
 
@@ -82,11 +82,11 @@
 
 typedef struct
-    {
-        double R;     ///< Coordinates of projection center
-        double D;     ///< Coordinates of projection center
-        double Xs;    ///< plate-scale in X direction
-        double Ys;    ///< plate-scale in Y direction
-        psProjectionType type;  ///< Projection type
-    }
+{
+    double R;     ///< Coordinates of projection center
+    double D;     ///< Coordinates of projection center
+    double Xs;    ///< plate-scale in X direction
+    double Ys;    ///< plate-scale in Y direction
+    psProjectionType type;  ///< Projection type
+}
 psProjection;
 
@@ -106,5 +106,5 @@
                                 const psPlaneTransform *transform,
                                 const psPlane *coords );
-                                
+
 psPlane *psPlaneDistortApply( psPlane *out,
                               const psPlaneDistort *transform,
@@ -112,11 +112,11 @@
                               float term3,
                               float term4 );
-                              
-                              
+
+
 // New function prototype.
 psSphereTransform *psSphereTransformAlloc( double NPlat,
         double Xo,
         double xo );
-        
+
 void p_psSphereTransformFree( psSphereTransform *trans );
 
@@ -124,5 +124,5 @@
                                   const psSphereTransform *transform,
                                   const psSphere *coord );
-                                  
+
 psSphereTransform *psSphereTransformICRStoEcliptic( psTime time );
 psSphereTransform *psSphereTransformEcliptictoICRS( psTime time );
@@ -132,18 +132,18 @@
 psPlane *psProject( const psSphere *coord,
                     const psProjection *projection );
-                    
+
 psSphere *psDeproject( const psPlane *coord,
                        const psProjection *projection );
-                       
+
 psSphere *psSphereGetOffset( const psSphere *restrict position1,
                              const psSphere *restrict position2,
                              psSphereOffsetMode mode,
                              psSphereOffsetUnit unit );
-                             
+
 psSphere *psSphereSetOffset( const psSphere *restrict position,
                              const psSphere *restrict offset,
                              psSphereOffsetMode mode,
                              psSphereOffsetUnit unit );
-                             
+
 /// @}
 
Index: /trunk/psLib/src/astro/psTime.c
===================================================================
--- /trunk/psLib/src/astro/psTime.c	(revision 1384)
+++ /trunk/psLib/src/astro/psTime.c	(revision 1385)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 21:24:54 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -100,27 +100,73 @@
 static double leapseconds[NUM_LEAPSECOND_UPDATES][2] =
     {
-        {2441317.5, 10.0},
-        {2441499.5, 11.0},
-        {2441683.5, 12.0},
-        {2442048.5, 13.0},
-        {2442413.5, 14.0},
-        {2442778.5, 15.0},
-        {2443144.5, 16.0},
-        {2443509.5, 17.0},
-        {2443874.5, 18.0},
-        {2444239.5, 19.0},
-        {2444786.5, 20.0},
-        {2445151.5, 21.0},
-        {2445516.5, 22.0},
-        {2446247.5, 23.0},
-        {2447161.5, 24.0},
-        {2447892.5, 25.0},
-        {2448257.5, 26.0},
-        {2448804.5, 27.0},
-        {2449169.5, 28.0},
-        {2449534.5, 29.0},
-        {2450083.5, 30.0},
-        {2450630.5, 31.0},
-        {2451179.5, 32.0}
+        {
+            2441317.5, 10.0
+        },
+        {
+            2441499.5, 11.0
+        },
+        {
+            2441683.5, 12.0
+        },
+        {
+            2442048.5, 13.0
+        },
+        {
+            2442413.5, 14.0
+        },
+        {
+            2442778.5, 15.0
+        },
+        {
+            2443144.5, 16.0
+        },
+        {
+            2443509.5, 17.0
+        },
+        {
+            2443874.5, 18.0
+        },
+        {
+            2444239.5, 19.0
+        },
+        {
+            2444786.5, 20.0
+        },
+        {
+            2445151.5, 21.0
+        },
+        {
+            2445516.5, 22.0
+        },
+        {
+            2446247.5, 23.0
+        },
+        {
+            2447161.5, 24.0
+        },
+        {
+            2447892.5, 25.0
+        },
+        {
+            2448257.5, 26.0
+        },
+        {
+            2448804.5, 27.0
+        },
+        {
+            2449169.5, 28.0
+        },
+        {
+            2449534.5, 29.0
+        },
+        {
+            2450083.5, 30.0
+        },
+        {
+            2450630.5, 31.0
+        },
+        {
+            2451179.5, 32.0
+        }
     };
 
@@ -395,13 +441,15 @@
         psError(__func__,"Null value for timeval arg not allowed");
         return outTime;
-    } else if(time->tv_sec < 0)
-    {
-        psError(__func__,"Negative seconds are not allowed: %ld", time->tv_sec);
-        return outTime;
-    } else if(time->tv_usec<0)
-    {
-        psError(__func__,"Negative microseconds are not allowed: %ld", time->tv_usec);
-        return outTime;
-    }
+    } else
+        if(time->tv_sec < 0)
+        {
+            psError(__func__,"Negative seconds are not allowed: %ld", time->tv_sec);
+            return outTime;
+        } else
+            if(time->tv_usec<0)
+            {
+                psError(__func__,"Negative microseconds are not allowed: %ld", time->tv_usec);
+                return outTime;
+            }
 
     // Convert to psTime/TAI
@@ -420,5 +468,8 @@
     int n;
     int y;
-    int mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+    int mon [] =
+        {
+            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+        };
     long epoch;
     psTime outTime;
@@ -433,29 +484,35 @@
         psError(__func__,"Null value for tm arg not allowed");
         return outTime;
-    } else if(time->tm_year < 70)
-    {
-        psError(__func__,"Input times earlier than 1970 not allowed. Value: %d", time->tm_year+1900);
-        return outTime;
-    } else  if(time->tm_mon<0 || time->tm_mon>11)
-    {
-        psError(__func__,"Month must have a value from 0 to 11. Value: %d", time->tm_mon);
-        return outTime;
-    } else if(time->tm_mday<1 || time->tm_mday>31)
-    {
-        psError(__func__,"Day must have a value from 1 to 31. Value: %d", time->tm_mday);
-        return outTime;
-    } else if(time->tm_hour<0 || time->tm_hour>23)
-    {
-        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
-        return outTime;
-    } else if(time->tm_min<0 || time->tm_min>59)
-    {
-        psError(__func__,"Minute must have a value from 0 to 59. Value: %d", time->tm_min);
-        return outTime;
-    } else if(time->tm_sec<0 || time->tm_sec>59)
-    {
-        psError(__func__,"Second must have a value from 0 to 59. Value: %d", time->tm_sec);
-        return outTime;
-    }
+    } else
+        if(time->tm_year < 70)
+        {
+            psError(__func__,"Input times earlier than 1970 not allowed. Value: %d", time->tm_year+1900);
+            return outTime;
+        } else
+            if(time->tm_mon<0 || time->tm_mon>11)
+            {
+                psError(__func__,"Month must have a value from 0 to 11. Value: %d", time->tm_mon);
+                return outTime;
+            } else
+                if(time->tm_mday<1 || time->tm_mday>31)
+                {
+                    psError(__func__,"Day must have a value from 1 to 31. Value: %d", time->tm_mday);
+                    return outTime;
+                } else
+                    if(time->tm_hour<0 || time->tm_hour>23)
+                    {
+                        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
+                        return outTime;
+                    } else
+                        if(time->tm_min<0 || time->tm_min>59)
+                        {
+                            psError(__func__,"Minute must have a value from 0 to 59. Value: %d", time->tm_min);
+                            return outTime;
+                        } else
+                            if(time->tm_sec<0 || time->tm_sec>59)
+                            {
+                                psError(__func__,"Second must have a value from 0 to 59. Value: %d", time->tm_sec);
+                                return outTime;
+                            }
 
     n = time->tm_year + 1900 - 1;
Index: /trunk/psLib/src/astro/psTime.h
===================================================================
--- /trunk/psLib/src/astro/psTime.h	(revision 1384)
+++ /trunk/psLib/src/astro/psTime.h	(revision 1385)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 01:03:00 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/astronomy/psAstrometry.c
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.c	(revision 1384)
+++ /trunk/psLib/src/astronomy/psAstrometry.c	(revision 1385)
@@ -8,6 +8,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 22:11:09 $
+*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -30,5 +30,5 @@
 {
     psExposure * exp = psAlloc( sizeof( psExposure ) );
-    
+
     *( double* ) & exp->ra = ra;
     *( double* ) & exp->dec = dec;
@@ -43,7 +43,7 @@
     *( float* ) & exp->humidity = humidity;
     *( float* ) & exp->exposureTime = exposureTime;
-    
+
     return exp;
-    
+
 }
 
@@ -85,5 +85,5 @@
     *( double* ) & grommit->longitudeOffset = exp->ra;             // XXX Is this correct?
     *( double* ) & grommit->siderealTime = 0.0;
-    
+
     psFree( slaGrommit );
     return ( grommit );
@@ -101,5 +101,5 @@
     psChip * tmpChip = NULL;
     psCell *tmpCell = NULL;
-    
+
     tmpChip = psChipinFPA( tmpChip, coord, FPA );
     tmpCell = psCellinChip( tmpCell, coord, tmpChip );
@@ -120,16 +120,16 @@
     int nChips = chips->n;
     psPlane* tmpCoord = NULL;
-    
+
     for ( int i = 0; i < nChips; i++ ) {
-            psChip* tmpChip = chips->data[ i ];
-            tmpCoord = psPlaneTransformApply( tmpCoord, tmpChip->fromFPA, coord );
-            if ( checkValidChipCoords( tmpCoord->x, tmpCoord->y,
-                                       tmpChip ) ) {
-                    psFree( tmpCoord );
-                    // XXX: George, you didn't use the out parameter!
-                    return ( tmpChip );
-                }
+        psChip* tmpChip = chips->data[ i ];
+        tmpCoord = psPlaneTransformApply( tmpCoord, tmpChip->fromFPA, coord );
+        if ( checkValidChipCoords( tmpCoord->x, tmpCoord->y,
+                                   tmpChip ) ) {
             psFree( tmpCoord );
+            // XXX: George, you didn't use the out parameter!
+            return ( tmpChip );
         }
+        psFree( tmpCoord );
+    }
     psFree( tmpCoord );
     return ( NULL );
@@ -142,6 +142,6 @@
             ( y < 0.0 ) ||
             ( y > ( double ) tmpImage->numRows ) ) {
-            return ( 0 );
-        }
+        return ( 0 );
+    }
     return ( 1 );
 }
@@ -166,29 +166,29 @@
     psPlane * tmpCoord = NULL;
     psArray* cells;
-    
+
     if ( chip == NULL ) {
-            return NULL;
+        return NULL;
+    }
+
+    cells = chip->cells;
+
+    if ( cells == NULL ) {
+        return NULL;
+    }
+
+    for ( int i = 0; i < cells->n; i++ ) {
+        psCell* tmpCell = ( psCell* ) cells->data[ i ];
+        psArray* readouts = tmpCell->readouts;
+        if ( readouts != NULL ) {
+            for ( int j = 0; j < readouts->n; j++ ) {
+                psReadout* tmpReadout = readouts->data[ j ];
+                tmpCoord = psPlaneTransformApply( tmpCoord, tmpCell->fromChip, coord );
+                if ( checkValidImageCoords( tmpCoord->x, tmpCoord->y,
+                                            tmpReadout->image ) ) {
+                    return ( tmpCell );
+                }
+            }
         }
-        
-    cells = chip->cells;
-    
-    if ( cells == NULL ) {
-            return NULL;
-        }
-        
-    for ( int i = 0; i < cells->n; i++ ) {
-            psCell* tmpCell = ( psCell* ) cells->data[ i ];
-            psArray* readouts = tmpCell->readouts;
-            if ( readouts != NULL ) {
-                    for ( int j = 0; j < readouts->n; j++ ) {
-                            psReadout* tmpReadout = readouts->data[ j ];
-                            tmpCoord = psPlaneTransformApply( tmpCoord, tmpCell->fromChip, coord );
-                            if ( checkValidImageCoords( tmpCoord->x, tmpCoord->y,
-                                                        tmpReadout->image ) ) {
-                                    return ( tmpCell );
-                                }
-                        }
-                }
-        }
+    }
     return ( NULL );
 }
@@ -229,5 +229,5 @@
         sla_OAPQK(TYPE, OB1, OB2, *grommit, &RAP, &DAP);
     */
-    
+
     return ( out );
 }
@@ -253,16 +253,16 @@
     psFPA *parFPA = ( cell->parent ) ->parent;
     psGrommit *tmpGrommit = NULL;
-    
+
     tmp1 = psPlaneTransformApply( tmp1, cell->toFPA, in );
     tmp2 = psPlaneTransformApply( tmp2, parFPA->toTangentPlane, tmp1 );
     tmpGrommit = psGrommitAlloc( parFPA->exposure );
     tmp3 = psCoordTPtoSky( out, tmp2, psGrommit );
-    
+
     psFree( tmp1 );
     psFree( tmp2 );
     psFree( tmpGrommit );
-    
+
     return ( psCoordTPtoSky( out, tmp2, psGrommit ) );
-    
+
 }
 
@@ -272,12 +272,12 @@
 {
     psPlane * tmp1 = NULL;
-    
+
     tmp1 = psPlaneTransformApply( tmp1, cell->toSky, in );
-    
+
     //XXX: Do something to convert the linear coords in tmp1 to spherical
     // coords in out.
-    
+
     psFree( tmp1 );
-    
+
     return ( out );
 }
@@ -294,9 +294,9 @@
     double DOB;
     double ROB;
-    
+
     if ( out == NULL ) {
-            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-        }
-        
+        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
+    }
+
     sla_AOPQK( psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB );
     out->x = XXX;
@@ -335,5 +335,5 @@
     out = psCoordFPAtoChip( out, out, whichChip );
     out = psCoordChiptoCell( out, out, whichCell );
-    
+
     return ( out );
 }
@@ -344,11 +344,11 @@
 {
     if ( out == NULL ) {
-            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-        }
-        
-    return ( out );
-}
-
-
-
-
+        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
+    }
+
+    return ( out );
+}
+
+
+
+
Index: /trunk/psLib/src/astronomy/psAstrometry.h
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.h	(revision 1384)
+++ /trunk/psLib/src/astronomy/psAstrometry.h	(revision 1385)
@@ -8,6 +8,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 23:12:34 $
+*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -43,20 +43,20 @@
  */
 typedef struct
-    {
-        const double latitude;             ///< geodetic latitude (radians)
-        const double sinLat;               ///< sine of geodetic latitude
-        const double cosLat;               ///< cosine of geodetic latitude
-        const double abberationMag;        ///< magnitude of diurnal aberration vector
-        const double height;               ///< height (HM)
-        const double temperature;          ///< ambient temperature (TDK)
-        const double pressure;             ///< pressure (PMB)
-        const double humidity;             ///< relative humidity (RH)
-        const double wavelength;           ///< wavelength (WL)
-        const double lapseRate;            ///< lapse rate (TLR)
-        const double refractA;             ///< refraction constant A (radians)
-        const double refractB;             ///< refraction constant B (radians)
-        const double longitudeOffset;      ///< longitude + ... (radians)
-        const double siderealTime;         ///< local apparent sidereal time (radians)
-    }
+{
+    const double latitude;             ///< geodetic latitude (radians)
+    const double sinLat;               ///< sine of geodetic latitude
+    const double cosLat;               ///< cosine of geodetic latitude
+    const double abberationMag;        ///< magnitude of diurnal aberration vector
+    const double height;               ///< height (HM)
+    const double temperature;          ///< ambient temperature (TDK)
+    const double pressure;             ///< pressure (PMB)
+    const double humidity;             ///< relative humidity (RH)
+    const double wavelength;           ///< wavelength (WL)
+    const double lapseRate;            ///< lapse rate (TLR)
+    const double refractA;             ///< refraction constant A (radians)
+    const double refractB;             ///< refraction constant B (radians)
+    const double longitudeOffset;      ///< longitude + ... (radians)
+    const double siderealTime;         ///< local apparent sidereal time (radians)
+}
 psGrommit;
 
@@ -71,14 +71,14 @@
  */
 typedef struct
-    {
-        int nX;                            ///< Number of elements in x direction
-        int nY;                            ///< Number of elements in y direction
-        double x0;                         ///< X Position of 0,0 corner on focal plane
-        double y0;                         ///< Y Position of 0,0 corner on focal plane
-        double xScale;                     ///< Scale of the grid in x direction
-        double yScale;                     ///< Scale of the grid in x direction
-        double **x;                        ///< The grid of offsets in x
-        double **y;                        ///< The grid of offsets in y
-    }
+{
+    int nX;                            ///< Number of elements in x direction
+    int nY;                            ///< Number of elements in y direction
+    double x0;                         ///< X Position of 0,0 corner on focal plane
+    double y0;                         ///< Y Position of 0,0 corner on focal plane
+    double xScale;                     ///< Scale of the grid in x direction
+    double yScale;                     ///< Scale of the grid in x direction
+    double **x;                        ///< The grid of offsets in x
+    double **y;                        ///< The grid of offsets in y
+}
 psFixedPattern;
 
@@ -93,14 +93,14 @@
  */
 typedef struct
-    {
-        const unsigned int colBins;        ///< Amount of binning in x-dimension
-        const unsigned int rowBins;        ///< Amount of binning in y-dimension
-        const int col0;                    ///< Offset from the left of chip.
-        const int row0;                    ///< Offset from the bottom of chip.
-        
-        psImage* image;                    ///< imaging area of Readout
-        psList* objects;                   ///< objects derived from Readout
-        psMetadata* metadata;              ///< readout-level metadata
-    }
+{
+    const unsigned int colBins;        ///< Amount of binning in x-dimension
+    const unsigned int rowBins;        ///< Amount of binning in y-dimension
+    const int col0;                    ///< Offset from the left of chip.
+    const int row0;                    ///< Offset from the bottom of chip.
+
+    psImage* image;                    ///< imaging area of Readout
+    psList* objects;                   ///< objects derived from Readout
+    psMetadata* metadata;              ///< readout-level metadata
+}
 psReadout;
 
@@ -115,15 +115,15 @@
  */
 typedef struct psCell
-    {
-        psArray* readouts;                 ///< readouts from the cell
-        psMetadata* metadata;              ///< cell-level metadata
-        
-        psPlaneTransform* toChip;          ///< transformations from cell to chip coordinates
-        psPlaneTransform* fromChip;        ///< transformations from chip to cell coordinates
-        psPlaneTransform* toFPA;           ///< transformations from cell to FPA coordinates
-        psPlaneTransform* toSky;           ///< transformations from cell to sky coordinates
-        
-        struct psChip* parent;             ///< chip in which contains this cell
-    }
+{
+    psArray* readouts;                 ///< readouts from the cell
+    psMetadata* metadata;              ///< cell-level metadata
+
+    psPlaneTransform* toChip;          ///< transformations from cell to chip coordinates
+    psPlaneTransform* fromChip;        ///< transformations from chip to cell coordinates
+    psPlaneTransform* toFPA;           ///< transformations from cell to FPA coordinates
+    psPlaneTransform* toSky;           ///< transformations from cell to sky coordinates
+
+    struct psChip* parent;             ///< chip in which contains this cell
+}
 psCell;
 
@@ -137,13 +137,13 @@
  */
 typedef struct psChip
-    {
-        psArray* cells;                    ///< cells in the chip
-        psMetadata* metadata;              ///< chip-level metadata
-        
-        psPlaneTransform* toFPA;           ///< transformation from chip to FPA coordinates
-        psPlaneTransform* fromFPA;         ///< transformation from FPA to chip coordinates
-        
-        struct psFPA* parent;              ///< FPA which contains this chip
-    }
+{
+    psArray* cells;                    ///< cells in the chip
+    psMetadata* metadata;              ///< chip-level metadata
+
+    psPlaneTransform* toFPA;           ///< transformation from chip to FPA coordinates
+    psPlaneTransform* fromFPA;         ///< transformation from FPA to chip coordinates
+
+    struct psFPA* parent;              ///< FPA which contains this chip
+}
 psChip;
 
@@ -162,21 +162,21 @@
  */
 typedef struct psFPA
-    {
-        psArray* chips;                    ///< chips in the focal plane array
-        psMetadata* metadata;              ///< focal-plane's metadata
-        
-        psPlaneDistort* fromTangentPlane;  ///< transformation from tangent plane to focal plane
-        psPlaneDistort* toTangentPlane;    ///< transformation from focal plane to tangent plane
-        psFixedPattern* pattern;           ///< fixed pattern residual offsets
-        
-        const struct psExposure* exposure; ///< information about this exposure
-        
-        psPhotSystem* colorPlus;           ///< Color reference
-        psPhotSystem* colorMinus;          ///< Color reference
-        
-        float rmsX;                        ///< RMS for x transformation fits
-        float rmsY;                        ///< RMS for y transformation fits
-        float chi2;                        ///< chi^2 of astrometric solution
-    }
+{
+    psArray* chips;                    ///< chips in the focal plane array
+    psMetadata* metadata;              ///< focal-plane's metadata
+
+    psPlaneDistort* fromTangentPlane;  ///< transformation from tangent plane to focal plane
+    psPlaneDistort* toTangentPlane;    ///< transformation from focal plane to tangent plane
+    psFixedPattern* pattern;           ///< fixed pattern residual offsets
+
+    const struct psExposure* exposure; ///< information about this exposure
+
+    psPhotSystem* colorPlus;           ///< Color reference
+    psPhotSystem* colorMinus;          ///< Color reference
+
+    float rmsX;                        ///< RMS for x transformation fits
+    float rmsY;                        ///< RMS for y transformation fits
+    float chi2;                        ///< chi^2 of astrometric solution
+}
 psFPA;
 
@@ -189,26 +189,26 @@
  */
 typedef struct psExposure
-    {
-        const double ra;                  ///< Telescope boresight, right ascention
-        const double dec;                 ///< Telescope boresight, declination
-        const double hourAngle;           ///< Hour angle
-        const double zenith;              ///< Zenith distance
-        const double azimuth;             ///< Azimuth
-        const double localTime;           ///< Local Sidereal Time
-        const float date;                 ///< Modified Jullian Date of observation
-        const float rotAngle;             ///< Rotator position angle
-        const float temperature;          ///< Air temperature, for estimating refraction
-        const float pressure;             ///< Air pressure, for calculating refraction
-        const float humidity;             ///< Relative humidity, for refraction
-        const float exposureTime;         ///< Exposure time
-        
-        /* Derived quantities */
-        const float positionAngle;        ///< Position angle
-        const float parallacticAngle;     ///< Parallactic angle
-        const float airmass;              ///< Airmass, calculated from zenith distance
-        const float parallacticFactor;    ///< Parallactic factor
-        const char *cameraName;           ///< name of camera which provided exposure
-        const char *telescopeName;        ///< name of telescope which provided exposure
-    }
+{
+    const double ra;                  ///< Telescope boresight, right ascention
+    const double dec;                 ///< Telescope boresight, declination
+    const double hourAngle;           ///< Hour angle
+    const double zenith;              ///< Zenith distance
+    const double azimuth;             ///< Azimuth
+    const double localTime;           ///< Local Sidereal Time
+    const float date;                 ///< Modified Jullian Date of observation
+    const float rotAngle;             ///< Rotator position angle
+    const float temperature;          ///< Air temperature, for estimating refraction
+    const float pressure;             ///< Air pressure, for calculating refraction
+    const float humidity;             ///< Relative humidity, for refraction
+    const float exposureTime;         ///< Exposure time
+
+    /* Derived quantities */
+    const float positionAngle;        ///< Position angle
+    const float parallacticAngle;     ///< Parallactic angle
+    const float airmass;              ///< Airmass, calculated from zenith distance
+    const float parallacticFactor;    ///< Parallactic factor
+    const char *cameraName;           ///< name of camera which provided exposure
+    const char *telescopeName;        ///< name of telescope which provided exposure
+}
 psExposure;
 
Index: /trunk/psLib/src/astronomy/psCoord.c
===================================================================
--- /trunk/psLib/src/astronomy/psCoord.c	(revision 1384)
+++ /trunk/psLib/src/astronomy/psCoord.c	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 00:55:17 $
+*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,14 +33,14 @@
 {
     if ( out == NULL ) {
-            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-        }
+        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
+    }
     out->x = transform->x->coeff[ 0 ][ 0 ] +
              ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) +
              ( transform->x->coeff[ 0 ][ 1 ] * coords->y );
-             
+
     out->y = transform->y->coeff[ 0 ][ 0 ] +
              ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) +
              ( transform->y->coeff[ 0 ][ 1 ] * coords->y );
-             
+
     return ( out );
 }
@@ -56,7 +56,7 @@
 {
     if ( out == NULL ) {
-            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-        }
-        
+        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
+    }
+
     out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
              ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
@@ -64,5 +64,5 @@
              ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
              ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
-             
+
     out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
              ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
@@ -70,5 +70,5 @@
              ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
              ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
-             
+
     return ( out );
 }
@@ -81,10 +81,10 @@
 {
     psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) );
-    
+
     tmp->sinPhi = sin( NPlat );
     tmp->cosPhi = cos( NPlat );
     tmp->Xo = Xo;
     tmp->xo = xo;
-    
+
     return ( tmp );
 }
@@ -114,9 +114,9 @@
     double y = 0.0;
     double dx = 0.0;
-    
+
     if ( out == NULL ) {
-            out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-        }
-        
+        out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
+    }
+
     x = coord->r;
     y = coord->d;
@@ -127,8 +127,8 @@
            cos( y );
     cosX = cos( y ) * cos( dx ) / cos( y );
-    
+
     out->r = atan2( sinX, cosX ) + transform->Xo;
     out->d = atan2( sinY, cosY );
-    
+
     return ( out );
 }
@@ -142,5 +142,5 @@
     double Xo = 0.0;
     double xo = 0.0;
-    
+
     return ( psSphereTransformAlloc( phi, Xo, xo ) );
 }
@@ -154,5 +154,5 @@
     double Xo = 0.0;
     double xo = 0.0;
-    
+
     return ( psSphereTransformAlloc( phi, Xo, xo ) );
 }
@@ -178,15 +178,19 @@
 {
     if ( x > 0 ) {
-            return ( atan( y / x ) );
-        } else if ( ( x == 0 ) && ( y == 0 ) ) {
+        return ( atan( y / x ) );
+    } else
+        if ( ( x == 0 ) && ( y == 0 ) ) {
             return ( 0.5 * M_PI );
-        } else if ( ( x == 0 ) && ( y == 0 ) ) {
-            return ( -0.5 * M_PI );
-        } else if ( ( x == 0 ) && ( y == 0 ) ) {
-            return ( M_PI + atan( y / x ) );
-        } else if ( ( x == 0 ) && ( y == 0 ) ) {
-            return ( -M_PI + atan( y / x ) );
-        }
-        
+        } else
+            if ( ( x == 0 ) && ( y == 0 ) ) {
+                return ( -0.5 * M_PI );
+            } else
+                if ( ( x == 0 ) && ( y == 0 ) ) {
+                    return ( M_PI + atan( y / x ) );
+                } else
+                    if ( ( x == 0 ) && ( y == 0 ) ) {
+                        return ( -M_PI + atan( y / x ) );
+                    }
+
     psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y );
     return ( 0.0 );
@@ -201,37 +205,43 @@
     float alpha = 0.0;
     psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-    
+
     if ( projection->type == PS_PROJ_TAN ) {
-            R = cot( coord->r ) * ( 180.0 / M_PI );
-            tmp->x = R * sin( coord->d );
-            tmp->y = R * cos( coord->d );
-            
-        } else if ( projection->type == PS_PROJ_SIN ) {
+        R = cot( coord->r ) * ( 180.0 / M_PI );
+        tmp->x = R * sin( coord->d );
+        tmp->y = R * cos( coord->d );
+
+    } else
+        if ( projection->type == PS_PROJ_SIN ) {
             R = cos( coord->r ) * ( 180.0 / M_PI );
             tmp->x = R * sin( coord->d );
             tmp->y = R * cos( coord->d );
-            
-        } else if ( projection->type == PS_PROJ_CAR ) {
-            tmp->x = coord->d;
-            tmp->y = coord->r;
-            
-        } else if ( projection->type == PS_PROJ_MER ) {
-            tmp->x = coord->d;
-            tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
-            
-        } else if ( projection->type == PS_PROJ_AIT ) {
-            alpha = 1.0 / ( ( 180.0 / M_PI ) *
-                            sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
-                            
-            tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
-            tmp->y = alpha * sin( coord->d );
-            
-        } else if ( projection->type == PS_PROJ_PAR ) {
-            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
-            
-        } else if ( projection->type == PS_PROJ_GLS ) {
-            psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
-        }
-        
+
+        } else
+            if ( projection->type == PS_PROJ_CAR ) {
+                tmp->x = coord->d;
+                tmp->y = coord->r;
+
+            } else
+                if ( projection->type == PS_PROJ_MER ) {
+                    tmp->x = coord->d;
+                    tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
+
+                } else
+                    if ( projection->type == PS_PROJ_AIT ) {
+                        alpha = 1.0 / ( ( 180.0 / M_PI ) *
+                                        sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
+
+                        tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
+                        tmp->y = alpha * sin( coord->d );
+
+                    } else
+                        if ( projection->type == PS_PROJ_PAR ) {
+                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
+
+                        } else
+                            if ( projection->type == PS_PROJ_GLS ) {
+                                psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
+                            }
+
     return ( tmp );
 }
@@ -247,40 +257,46 @@
     float chu2 = 0.0;
     psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-    
+
     if ( projection->type == PS_PROJ_TAN ) {
-            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
-            tmp->d = arg( -coord->y, coord->x );
-            tmp->r = atan( 180.0 / ( R * M_PI ) );
-            
-        } else if ( projection->type == PS_PROJ_SIN ) {
+        R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
+        tmp->d = arg( -coord->y, coord->x );
+        tmp->r = atan( 180.0 / ( R * M_PI ) );
+
+    } else
+        if ( projection->type == PS_PROJ_SIN ) {
             R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
             tmp->d = arg( -coord->y, coord->x );
             tmp->r = acos( ( R * M_PI ) / 180.0 );
-            
-        } else if ( projection->type == PS_PROJ_CAR ) {
-            tmp->d = coord->x;
-            tmp->r = coord->y;
-            
-        } else if ( projection->type == PS_PROJ_MER ) {
-            tmp->d = coord->x;
-            tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
-            
-        } else if ( projection->type == PS_PROJ_AIT ) {
-            chu1 = ( coord->x * M_PI ) / 720.0;
-            chu1 *= chu1;
-            chu2 = ( coord->y * M_PI ) / 360.0;
-            chu2 *= chu2;
-            chu = sqrt( 1.0 - chu1 - chu2 );
-            tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
-                                ( coord->x * chu * M_PI ) / 360.0 );
-            tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
-            
-        } else if ( projection->type == PS_PROJ_PAR ) {
-            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
-            
-        } else if ( projection->type == PS_PROJ_GLS ) {
-            psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
-        }
-        
+
+        } else
+            if ( projection->type == PS_PROJ_CAR ) {
+                tmp->d = coord->x;
+                tmp->r = coord->y;
+
+            } else
+                if ( projection->type == PS_PROJ_MER ) {
+                    tmp->d = coord->x;
+                    tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
+
+                } else
+                    if ( projection->type == PS_PROJ_AIT ) {
+                        chu1 = ( coord->x * M_PI ) / 720.0;
+                        chu1 *= chu1;
+                        chu2 = ( coord->y * M_PI ) / 360.0;
+                        chu2 *= chu2;
+                        chu = sqrt( 1.0 - chu1 - chu2 );
+                        tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
+                                            ( coord->x * chu * M_PI ) / 360.0 );
+                        tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
+
+                    } else
+                        if ( projection->type == PS_PROJ_PAR ) {
+                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
+
+                        } else
+                            if ( projection->type == PS_PROJ_GLS ) {
+                                psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
+                            }
+
     return ( tmp );
 }
@@ -298,41 +314,45 @@
     double tmpR = 0.0;
     double tmpD = 0.0;
-    
+
     if ( mode == PS_LINEAR ) {
-            // XXX: I have no idea how to construct this.  Maybe project both
-            // sperical positions onto the plane, set the origin at one of the
-            // points on the plane, then deproject?
-            
-            // XXX: Do I need to somehow scale this projection?
-            // project position1?  Will it project to (0.0, 0.0)?
-            proj.R = position1->r;
-            proj.D = position1->d;
-            proj.Xs = 1.0;
-            proj.Ys = 1.0;
-            proj.type = PS_PROJ_TAN;
-            
-            //        lin = psProject(position2, proj);
-            //        tmp = psDeproject(lin, proj);
-            
-            // XXX: Do we need to convert units in tmp?
-            return ( tmp );
-        } else if ( mode == PS_SPHERICAL ) {
+        // XXX: I have no idea how to construct this.  Maybe project both
+        // sperical positions onto the plane, set the origin at one of the
+        // points on the plane, then deproject?
+
+        // XXX: Do I need to somehow scale this projection?
+        // project position1?  Will it project to (0.0, 0.0)?
+        proj.R = position1->r;
+        proj.D = position1->d;
+        proj.Xs = 1.0;
+        proj.Ys = 1.0;
+        proj.type = PS_PROJ_TAN;
+
+        //        lin = psProject(position2, proj);
+        //        tmp = psDeproject(lin, proj);
+
+        // XXX: Do we need to convert units in tmp?
+        return ( tmp );
+    } else
+        if ( mode == PS_SPHERICAL ) {
             tmpR = position2->r - position1->r;
             tmpD = position2->d - position1->d;
-            
+
             if ( unit == PS_ARCSEC ) {
-                    tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
-                    tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
-                } else if ( unit == PS_ARCMIN ) {
+                tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
+                tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
+            } else
+                if ( unit == PS_ARCMIN ) {
                     tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI;
                     tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI;
-                } else if ( unit == PS_DEGREE ) {
-                    tmpR = ( tmpR * 180.0 ) / M_PI;
-                    tmpD = ( tmpR * 180.0 ) / M_PI;
-                } else if ( unit == PS_RADIAN ) {}
-            else {
-                    psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
-                }
-                
+                } else
+                    if ( unit == PS_DEGREE ) {
+                        tmpR = ( tmpR * 180.0 ) / M_PI;
+                        tmpD = ( tmpR * 180.0 ) / M_PI;
+                    } else
+                    if ( unit == PS_RADIAN ) {}
+                        else {
+                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
+                        }
+
             tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
             tmp->r = tmpR;
@@ -361,35 +381,39 @@
     double tmpR = 0.0;
     double tmpD = 0.0;
-    
+
     if ( mode == PS_LINEAR ) {
-            proj.R = position->r;
-            proj.D = position->d;
-            proj.Xs = 1.0;
-            proj.Ys = 1.0;
-            proj.type = PS_PROJ_TAN;
-            
-            lin.x = offset->r;
-            lin.y = offset->d;
-            
-            tmp = psDeproject( &lin, &proj );
-            return ( tmp );
-            
-        } else if ( mode == PS_SPHERICAL ) {
+        proj.R = position->r;
+        proj.D = position->d;
+        proj.Xs = 1.0;
+        proj.Ys = 1.0;
+        proj.type = PS_PROJ_TAN;
+
+        lin.x = offset->r;
+        lin.y = offset->d;
+
+        tmp = psDeproject( &lin, &proj );
+        return ( tmp );
+
+    } else
+        if ( mode == PS_SPHERICAL ) {
             if ( unit == PS_ARCSEC ) {
-                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
-                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
-                } else if ( unit == PS_ARCMIN ) {
+                tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
+                tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
+            } else
+                if ( unit == PS_ARCMIN ) {
                     tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 );
                     tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 );
-                } else if ( unit == PS_DEGREE ) {
-                    tmpR = ( M_PI * offset->r ) / ( 180.0 );
-                    tmpD = ( M_PI * offset->d ) / ( 180.0 );
-                } else if ( unit == PS_RADIAN ) {
-                    tmpR = offset->r;
-                    tmpD = offset->d;
-                } else {
-                    psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
-                }
-                
+                } else
+                    if ( unit == PS_DEGREE ) {
+                        tmpR = ( M_PI * offset->r ) / ( 180.0 );
+                        tmpD = ( M_PI * offset->d ) / ( 180.0 );
+                    } else
+                        if ( unit == PS_RADIAN ) {
+                            tmpR = offset->r;
+                            tmpD = offset->d;
+                        } else {
+                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
+                        }
+
             tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
             tmp->r = position->r + tmpR;
@@ -397,5 +421,5 @@
             tmp->rErr = 0.0;
             tmp->dErr = 0.0;
-            
+
             // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
             // and (0 to 2*PI).
Index: /trunk/psLib/src/astronomy/psCoord.h
===================================================================
--- /trunk/psLib/src/astronomy/psCoord.h	(revision 1384)
+++ /trunk/psLib/src/astronomy/psCoord.h	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 00:55:17 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -30,42 +30,42 @@
 
 typedef struct
-    {
-        double x;      ///< x position
-        double y;      ///< y position
-        double xErr;   ///< Error in x position
-        double yErr;   ///< Error in y position
-    }
+{
+    double x;      ///< x position
+    double y;      ///< y position
+    double xErr;   ///< Error in x position
+    double yErr;   ///< Error in y position
+}
 psPlane;
 
 typedef struct
-    {
-        double r;      ///< RA
-        double d;      ///< Dec
-        double rErr;   ///< Error in RA
-        double dErr;   ///< Error in Dec
-    }
+{
+    double r;      ///< RA
+    double d;      ///< Dec
+    double rErr;   ///< Error in RA
+    double dErr;   ///< Error in Dec
+}
 psSphere;
 
 typedef struct
-    {
-        psDPolynomial2D *x;
-        psDPolynomial2D *y;
-    }
+{
+    psDPolynomial2D *x;
+    psDPolynomial2D *y;
+}
 psPlaneTransform;
 
 typedef struct
-    {
-        psDPolynomial4D *x;
-        psDPolynomial4D *y;
-    }
+{
+    psDPolynomial4D *x;
+    psDPolynomial4D *y;
+}
 psPlaneDistort;
 
 typedef struct
-    {
-        double sinPhi;                    ///< sin of North Pole lattitude
-        double cosPhi;                    ///< cos of North Pole lattitude
-        double Xo;                        ///< First PT of Ares lon
-        double xo;                        ///< First PT of Ares equiv lon
-    }
+{
+    double sinPhi;                    ///< sin of North Pole lattitude
+    double cosPhi;                    ///< cos of North Pole lattitude
+    double Xo;                        ///< First PT of Ares lon
+    double xo;                        ///< First PT of Ares equiv lon
+}
 psSphereTransform;
 
@@ -82,11 +82,11 @@
 
 typedef struct
-    {
-        double R;     ///< Coordinates of projection center
-        double D;     ///< Coordinates of projection center
-        double Xs;    ///< plate-scale in X direction
-        double Ys;    ///< plate-scale in Y direction
-        psProjectionType type;  ///< Projection type
-    }
+{
+    double R;     ///< Coordinates of projection center
+    double D;     ///< Coordinates of projection center
+    double Xs;    ///< plate-scale in X direction
+    double Ys;    ///< plate-scale in Y direction
+    psProjectionType type;  ///< Projection type
+}
 psProjection;
 
@@ -106,5 +106,5 @@
                                 const psPlaneTransform *transform,
                                 const psPlane *coords );
-                                
+
 psPlane *psPlaneDistortApply( psPlane *out,
                               const psPlaneDistort *transform,
@@ -112,11 +112,11 @@
                               float term3,
                               float term4 );
-                              
-                              
+
+
 // New function prototype.
 psSphereTransform *psSphereTransformAlloc( double NPlat,
         double Xo,
         double xo );
-        
+
 void p_psSphereTransformFree( psSphereTransform *trans );
 
@@ -124,5 +124,5 @@
                                   const psSphereTransform *transform,
                                   const psSphere *coord );
-                                  
+
 psSphereTransform *psSphereTransformICRStoEcliptic( psTime time );
 psSphereTransform *psSphereTransformEcliptictoICRS( psTime time );
@@ -132,18 +132,18 @@
 psPlane *psProject( const psSphere *coord,
                     const psProjection *projection );
-                    
+
 psSphere *psDeproject( const psPlane *coord,
                        const psProjection *projection );
-                       
+
 psSphere *psSphereGetOffset( const psSphere *restrict position1,
                              const psSphere *restrict position2,
                              psSphereOffsetMode mode,
                              psSphereOffsetUnit unit );
-                             
+
 psSphere *psSphereSetOffset( const psSphere *restrict position,
                              const psSphere *restrict offset,
                              psSphereOffsetMode mode,
                              psSphereOffsetUnit unit );
-                             
+
 /// @}
 
Index: /trunk/psLib/src/astronomy/psMetadata.c
===================================================================
--- /trunk/psLib/src/astronomy/psMetadata.c	(revision 1384)
+++ /trunk/psLib/src/astronomy/psMetadata.c	(revision 1385)
@@ -11,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 21:05:24 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -65,15 +65,15 @@
 {
     psMetadataType type;
-    
+
     type = metadataItem->type;
-    
+
     if ( metadataItem == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     psFree( metadataItem->name );
     psFree( metadataItem->comment );
     psFree( metadataItem->items );
-    
+
     if ( type == PS_META_STR ||
             type == PS_META_IMG ||
@@ -82,6 +82,6 @@
             type == PS_META_ASTROM ||
             type == PS_META_UNKNOWN ) {
-            psFree( metadataItem->data.V );
-        }
+        psFree( metadataItem->data.V );
+    }
 }
 
@@ -89,6 +89,6 @@
 {
     if ( metadata == NULL ) {
-            return ;
-        }
+        return ;
+    }
     psFree( metadata->list );
     psFree( metadata->table );
@@ -103,14 +103,14 @@
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
-    
+
     // Get the variable list parameters to pass to allocation function
     va_start( argPtr, comment );
-    
+
     // Call metadata item allocation
     metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
-    
+
     // Clean up stack after variable arguement has been used
     va_end( argPtr );
-    
+
     return metadataItem;
 }
@@ -119,67 +119,67 @@
 {
     psMetadataItem * metadataItem = NULL;
-    
+
     if ( name == NULL ) {
-            psError( __func__, "Null value for string not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null value for string not allowed" );
+        return NULL;
+    }
+
     // Allocate metadata item
     metadataItem = ( psMetadataItem * ) psAlloc( sizeof( psMetadataItem ) );
     if ( metadataItem == NULL ) {
-            psAbort( __func__, "Failed to allocate memory" );
-        }
-        
+        psAbort( __func__, "Failed to allocate memory" );
+    }
+
     // Set deallocator
     p_psMemSetDeallocator( metadataItem, ( psFreeFcn ) metadataItemFree );
-    
+
     // Allocate and set metadata item comment
     metadataItem->comment = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
     if ( comment == NULL ) {
-            // Per SDRS, null isn't allowed, must use "" instead
-            strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
-        } else {
-            strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
-        }
-        
+        // Per SDRS, null isn't allowed, must use "" instead
+        strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
+    } else {
+        strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
+    }
+
     // Set metadata item unique id
     *( int* ) ( &metadataItem->id ) = ++metadataId;
-    
+
     // Set metadata item type
     metadataItem->type = type;
-    
+
     // Set metadata item value
     switch ( type ) {
-            case PS_META_BOOL:
-            metadataItem->data.B = ( bool ) va_arg( argPtr, int );
-            break;
-            case PS_META_S32:
-            metadataItem->data.S32 = va_arg( argPtr, psS32 );
-            break;
-            case PS_META_F32:
-            metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
-            break;
-            case PS_META_F64:
-            metadataItem->data.F64 = va_arg( argPtr, psF64 );
-            break;
-            case PS_META_STR:
-            metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
-            break;
-            case PS_META_IMG:
-            case PS_META_JPEG:
-            case PS_META_PNG:
-            case PS_META_ASTROM:
-            case PS_META_UNKNOWN:
-            default:
-            psError( __func__, "Invalid psMetadataType: %d", type );
-        }
-        
+    case PS_META_BOOL:
+        metadataItem->data.B = ( bool ) va_arg( argPtr, int );
+        break;
+    case PS_META_S32:
+        metadataItem->data.S32 = va_arg( argPtr, psS32 );
+        break;
+    case PS_META_F32:
+        metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
+        break;
+    case PS_META_F64:
+        metadataItem->data.F64 = va_arg( argPtr, psF64 );
+        break;
+    case PS_META_STR:
+        metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
+        break;
+    case PS_META_IMG:
+    case PS_META_JPEG:
+    case PS_META_PNG:
+    case PS_META_ASTROM:
+    case PS_META_UNKNOWN:
+    default:
+        psError( __func__, "Invalid psMetadataType: %d", type );
+    }
+
     // Allocate and set metadata item name
     metadataItem->name = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
     vsprintf( metadataItem->name, name, argPtr );
-    
+
     // Allocate metadata items with same name.
     metadataItem->items = psListAlloc( NULL );
-    
+
     return metadataItem;
 }
@@ -190,28 +190,28 @@
     psHash *table = NULL;
     psMetadata *metadata = NULL;
-    
+
     // Allocate metadata
     metadata = ( psMetadata * ) psAlloc( sizeof( psMetadata ) );
     if ( metadata == NULL ) {
-            psAbort( __func__, "Failed to allocate metadata" );
-        }
-        
+        psAbort( __func__, "Failed to allocate metadata" );
+    }
+
     // Set deallocator
     p_psMemSetDeallocator( metadata, ( psFreeFcn ) metadataFree );
-    
+
     // Allocate metadata's internal containers
     list = ( psList * ) psListAlloc( NULL );
     if ( list == NULL ) {
-            psAbort( __func__, "Failed to allocate list" );
-        }
-        
+        psAbort( __func__, "Failed to allocate list" );
+    }
+
     table = ( psHash * ) psHashAlloc( 10 );
     if ( table == NULL ) {
-            psAbort( __func__, "Failed to allocate table" );
-        }
-        
+        psAbort( __func__, "Failed to allocate table" );
+    }
+
     metadata->list = list;
     metadata->table = table;
-    
+
     return metadata;
 }
@@ -224,48 +224,49 @@
     psMetadataItem *value = NULL;
     psMetadataType type = PS_META_ITEM_SET;
-    
+
     if ( md == NULL ) {
-            psError( __func__, "Null metadata collection not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata collection not allowed" );
+        return false;
+    }
+
     if ( metadataItem == NULL ) {
-            psError( __func__, "Null metadata item not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata item not allowed" );
+        return false;
+    }
+
     type = metadataItem->type;
-    
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return false;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return false;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     key = metadataItem->name;
     if ( key == NULL ) {
-            psError( __func__, "Null key item not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null key item not allowed" );
+        return false;
+    }
+
     // Check if key is already in table
     value = ( psMetadataItem* ) psHashLookup( mdTable, key );
     if ( value != NULL && type != PS_META_ITEM_SET ) {
-    
-            // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
-            // add the new metadata item to hash as a child of the existing metadata item folder node.
-            if ( !psListAdd( value->items, metadataItem, where ) ) {
-                    psError( __func__, "Couldn't add metadata item to items list. Name: %s",
-                             metadataItem->name );
-                    return false;
-                }
-        } else if ( value != NULL ) {
-        
+
+        // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
+        // add the new metadata item to hash as a child of the existing metadata item folder node.
+        if ( !psListAdd( value->items, metadataItem, where ) ) {
+            psError( __func__, "Couldn't add metadata item to items list. Name: %s",
+                     metadataItem->name );
+            return false;
+        }
+    } else
+        if ( value != NULL ) {
+
             // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
             // it will wipe out existing node.
@@ -274,20 +275,20 @@
             return false;
         } else {
-        
+
             // Duplicate key not found. Add new metadata item to metadata collection's hash
             if ( !psHashAdd( mdTable, key, metadataItem ) ) {
-                    psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
-                             metadataItem->name );
-                    return false;
-                }
-        }
-        
+                psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
+                         metadataItem->name );
+                return false;
+            }
+        }
+
     // Add all items to metadata collection's list, even if they have the same metadata item names
     if ( !psListAdd( md->list, metadataItem, where ) ) {
-            psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                     metadataItem->name );
-            return false;
-        }
-        
+        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                 metadataItem->name );
+        return false;
+    }
+
     return true;
 }
@@ -298,19 +299,19 @@
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
-    
+
     va_start( argPtr, comment );
     metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
     va_end( argPtr );
-    
+
     if ( !psMetadataAddItem( md, where, metadataItem ) ) {
-            psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                     metadataItem->name );
-            psFree( metadataItem );
-            return false;
-        }
-        
+        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                 metadataItem->name );
+        psFree( metadataItem );
+        return false;
+    }
+
     // Decrement reference count, since the metadata item is now in metadata collection and no longer needed here
     psMemDecrRefCounter( metadataItem );
-    
+
     return true;
 }
@@ -323,72 +324,72 @@
     psMetadataItem *entry = NULL;
     psMetadataItem *entryChild = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return false;
+    }
+
     // Select removal by key or index
     if ( key != NULL ) {
-    
-            // Remove by key name
-            entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-            if ( entry == NULL ) {
-                    psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
-                    return false;
-                }
-                
-            numChildren = entry->items->size;
-            if ( entry->type == PS_META_ITEM_SET && numChildren > 0 ) {
-            
-                    // Table entry has children. Entry and children must be removed from metadata collection's list
-                    psListSetIterator( mdList, PS_LIST_HEAD );
-                    entryChild = psListGetCurrent( mdList );
-                    while ( entryChild != NULL ) {
-                            if ( !psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN ) ) {
-                                    psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
-                                    return false;
-                                }
-                            entryChild = psListGetNext( entry->items );
-                        }
-                }
-                
-            // Remove entry from metadata collection's list
-            if ( !psListRemove( mdList, entry, PS_LIST_UNKNOWN ) ) {
+
+        // Remove by key name
+        entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
+        if ( entry == NULL ) {
+            psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
+            return false;
+        }
+
+        numChildren = entry->items->size;
+        if ( entry->type == PS_META_ITEM_SET && numChildren > 0 ) {
+
+            // Table entry has children. Entry and children must be removed from metadata collection's list
+            psListSetIterator( mdList, PS_LIST_HEAD );
+            entryChild = psListGetCurrent( mdList );
+            while ( entryChild != NULL ) {
+                if ( !psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN ) ) {
                     psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
                     return false;
                 }
-                
-            // Remove entry from metadata collection's table
-            if ( !psHashRemove( mdTable, key ) ) {
-                    psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
-                    return false;
-                }
-        } else {
-        
-            // Remove by index
-            entry = psListGet( mdList, where );
-            if ( entry == NULL ) {
-                    psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
-                    return false;
-                }
-                
-            key = entry->name;
-            if ( key == NULL ) {
-                    psError( __func__, "Null key name not allowed. Index: %d", where );
-                    return false;
-                }
-                
-            // Use recursive remove, now that key is known
-            psMetadataRemove( md, PS_LIST_UNKNOWN, key );
-        }
-        
+                entryChild = psListGetNext( entry->items );
+            }
+        }
+
+        // Remove entry from metadata collection's list
+        if ( !psListRemove( mdList, entry, PS_LIST_UNKNOWN ) ) {
+            psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+            return false;
+        }
+
+        // Remove entry from metadata collection's table
+        if ( !psHashRemove( mdTable, key ) ) {
+            psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
+            return false;
+        }
+    } else {
+
+        // Remove by index
+        entry = psListGet( mdList, where );
+        if ( entry == NULL ) {
+            psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
+            return false;
+        }
+
+        key = entry->name;
+        if ( key == NULL ) {
+            psError( __func__, "Null key name not allowed. Index: %d", where );
+            return false;
+        }
+
+        // Use recursive remove, now that key is known
+        psMetadataRemove( md, PS_LIST_UNKNOWN, key );
+    }
+
     return true;
 }
@@ -398,22 +399,22 @@
     psHash * mdTable = NULL;
     psMetadataItem *entry = NULL;
-    
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return NULL;
+    }
+
     if ( key == NULL ) {
-            psError( __func__, "Null key name not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null key name not allowed" );
+        return NULL;
+    }
+
     entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
     if ( entry == NULL ) {
-            psError( __func__, "Could not find metadata item with given key. Key: %s", key );
-            return NULL;
-        }
-        
+        psError( __func__, "Could not find metadata item with given key. Key: %s", key );
+        return NULL;
+    }
+
     return entry;
 }
@@ -423,17 +424,17 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     entry = ( psMetadataItem* ) psListGet( mdList, where );
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
-            return NULL;
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
+        return NULL;
+    }
+
     return entry;
 }
@@ -442,13 +443,13 @@
 {
     psList * mdList = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     psListSetIterator( mdList, where );
-    
+
     return true;
 }
@@ -458,33 +459,33 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     psListSetIterator( mdList, which );
     entry = psListGetCurrent( mdList );
     while ( entry != NULL ) {
-            if ( !strncmp( match, entry->name, strlen( match ) ) ) {
-            
-                    // Match found
-                    return entry;
-                }
-            entry = psListGetNext( mdList );
-        }
-        
+        if ( !strncmp( match, entry->name, strlen( match ) ) ) {
+
+            // Match found
+            return entry;
+        }
+        entry = psListGetNext( mdList );
+    }
+
     // Match not found
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    }
+
     return entry;
 }
@@ -494,33 +495,33 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     psListSetIterator( mdList, which );
     entry = psListGetCurrent( mdList );
     while ( entry != NULL ) {
-            if ( !strncmp( match, entry->name, strlen( match ) ) ) {
-            
-                    // Match found
-                    return entry;
-                }
-            entry = psListGetPrevious( mdList );
-        }
-        
+        if ( !strncmp( match, entry->name, strlen( match ) ) ) {
+
+            // Match found
+            return entry;
+        }
+        entry = psListGetPrevious( mdList );
+    }
+
     // Match not found
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    }
+
     return entry;
 }
@@ -529,47 +530,47 @@
 {
     psMetadataType type;
-    
+
     if ( fd == NULL ) {
-            psError( __func__, "Null file descriptor not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null file descriptor not allowed" );
+        return ;
+    }
+
     if ( format == NULL ) {
-            psError( __func__, "Null format not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null format not allowed" );
+        return ;
+    }
+
     if ( metadataItem == NULL ) {
-            psError( __func__, "Null metadata not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null metadata not allowed" );
+        return ;
+    }
+
     type = metadataItem->type;
-    
+
     switch ( type ) {
-            case PS_META_BOOL:
-            fprintf( fd, format, metadataItem->data.B );
-            break;
-            case PS_META_S32:
-            fprintf( fd, format, metadataItem->data.S32 );
-            break;
-            case PS_META_F32:
-            fprintf( fd, format, metadataItem->data.F32 );
-            break;
-            case PS_META_F64:
-            fprintf( fd, format, metadataItem->data.F64 );
-            break;
-            case PS_META_STR:
-            fprintf( fd, format, metadataItem->data.V );
-            break;
-            case PS_META_ITEM_SET:
-            case PS_META_IMG:
-            case PS_META_JPEG:
-            case PS_META_PNG:
-            case PS_META_ASTROM:
-            case PS_META_UNKNOWN:
-            default:
-            psError( __func__, " Invalid psMetadataType to print: %d", type );
-        }
+    case PS_META_BOOL:
+        fprintf( fd, format, metadataItem->data.B );
+        break;
+    case PS_META_S32:
+        fprintf( fd, format, metadataItem->data.S32 );
+        break;
+    case PS_META_F32:
+        fprintf( fd, format, metadataItem->data.F32 );
+        break;
+    case PS_META_F64:
+        fprintf( fd, format, metadataItem->data.F64 );
+        break;
+    case PS_META_STR:
+        fprintf( fd, format, metadataItem->data.V );
+        break;
+    case PS_META_ITEM_SET:
+    case PS_META_IMG:
+    case PS_META_JPEG:
+    case PS_META_PNG:
+    case PS_META_ASTROM:
+    case PS_META_UNKNOWN:
+    default:
+        psError( __func__, " Invalid psMetadataType to print: %d", type );
+    }
 }
 
@@ -590,100 +591,102 @@
     int keyNum = 0;
     psMetadataType metadataItemType;
-    
+
     if ( fd == NULL ) {
-            psError( __func__, "Null FITS file descriptor not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null FITS file descriptor not allowed" );
+        return NULL;
+    }
+
     if ( extname == NULL && extnum == 0 ) {
-            psError( __func__, "Null extname AND extnum = 0 not allowed" );
-            return NULL;
-        } else if ( extname && extnum ) {
+        psError( __func__, "Null extname AND extnum = 0 not allowed" );
+        return NULL;
+    } else
+        if ( extname && extnum ) {
             psError( __func__, "Both extname AND extnum arguments should not have values." );
             return NULL;
         }
-        
+
     // Allocate metadata if user didn't
     if ( output == NULL ) {
-            output = psMetadataAlloc();
-        }
-        
+        output = psMetadataAlloc();
+    }
+
     // Move to user designated HDU number or HDU name in FITS file. HDU numbers starts at one.
     if ( extname == NULL ) {
-            if ( fits_movabs_hdu( fd, extnum, &hduType, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while locating header: %s", fitsErr );
-                    status = 0;
-                    return output;
-                }
-        } else if ( extnum > 0 ) {
+        if ( fits_movabs_hdu( fd, extnum, &hduType, &status ) != 0 ) {
+            fits_get_errstatus( status, fitsErr );
+            psError( __func__, "FITS error while locating header: %s", fitsErr );
+            status = 0;
+            return output;
+        }
+    } else
+        if ( extnum > 0 ) {
             tempExtname = ( char* ) extname;
             if ( fits_movnam_hdu( fd, ANY_HDU, tempExtname, 0, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while locating header: %s", fitsErr );
-                    status = 0;
-                    return output;
-                }
-        }
-        
+                fits_get_errstatus( status, fitsErr );
+                psError( __func__, "FITS error while locating header: %s", fitsErr );
+                status = 0;
+                return output;
+            }
+        }
+
     // Get number of key names
     if ( fits_get_hdrpos( fd, &numKeys, &keyNum, &status ) != 0 ) {
+        fits_get_errstatus( status, fitsErr );
+        psError( __func__, "FITS error while reading keys: %s", fitsErr );
+        status = 0;
+        return output;
+    }
+
+    // Get each key name. Keywords start at one.
+    for ( i = 1; i <= numKeys; i++ ) {
+        if ( fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0 ) {
             fits_get_errstatus( status, fitsErr );
-            psError( __func__, "FITS error while reading keys: %s", fitsErr );
+            psError( __func__, "FITS error while reading key number %d: %s", i, fitsErr );
             status = 0;
             return output;
         }
-        
-    // Get each key name. Keywords start at one.
-    for ( i = 1; i <= numKeys; i++ ) {
-            if ( fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while reading key number %d: %s", i, fitsErr );
-                    status = 0;
-                    return output;
-                }
-            if ( fits_get_keytype( keyValue, &keyType, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    if ( status != VALUE_UNDEFINED ) {
-                            psError( __func__, "FITS error while determining key type: %s", fitsErr );
-                            status = 0;
-                            return output;
-                        } else {
-                            // Some keywords are still valid even though they don't have a type or value, like COMMENTS
-                            keyType = 'C';
-                            status = 0;
-                        }
-                }
-                
-            switch ( keyType ) {
-                    case 'I':
-                    metadataItemType = PS_META_S32;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atoi( keyValue ) );
-                    break;
-                    case 'F':
-                    metadataItemType = PS_META_F64;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atof( keyValue ) );
-                    break;
-                    case 'C':
-                    metadataItemType = PS_META_STR;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, keyValue );
-                    break;
-                    case 'L':
-                    metadataItemType = PS_META_BOOL;
-                    tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, tempBool );
-                    break;
-                    case 'U':
-                    case 'X':
-                    default:
-                    psError( __func__, "Invalid psMetadataType: %c", keyType );
-                    return output;
-                }
-                
-            if ( !success ) {
-                    psError( __func__, "Failed to add metadata item. Name: %s", keyName );
-                }
-        }
-        
+        if ( fits_get_keytype( keyValue, &keyType, &status ) != 0 ) {
+            fits_get_errstatus( status, fitsErr );
+            if ( status != VALUE_UNDEFINED ) {
+                psError( __func__, "FITS error while determining key type: %s", fitsErr );
+                status = 0;
+                return output;
+            } else {
+                // Some keywords are still valid even though they don't have a type or value, like COMMENTS
+                keyType = 'C';
+                status = 0;
+            }
+        }
+
+        switch ( keyType ) {
+        case 'I':
+            metadataItemType = PS_META_S32;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atoi( keyValue ) );
+            break;
+        case 'F':
+            metadataItemType = PS_META_F64;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atof( keyValue ) );
+            break;
+        case 'C':
+            metadataItemType = PS_META_STR;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, keyValue );
+            break;
+        case 'L':
+            metadataItemType = PS_META_BOOL;
+            tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, tempBool );
+            break;
+        case 'U':
+        case 'X':
+        default:
+            psError( __func__, "Invalid psMetadataType: %c", keyType );
+            return output;
+        }
+
+        if ( !success ) {
+            psError( __func__, "Failed to add metadata item. Name: %s", keyName );
+        }
+    }
+
     return output;
 }
Index: /trunk/psLib/src/astronomy/psMetadata.h
===================================================================
--- /trunk/psLib/src/astronomy/psMetadata.h	(revision 1384)
+++ /trunk/psLib/src/astronomy/psMetadata.h	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 22:11:09 $
+*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -59,19 +59,19 @@
  */
 typedef struct psMetadataItem
+{
+    const int id;                       ///< Unique ID for metadata item.
+    char *restrict name;                ///< Name of metadata item.
+    psMetadataType type;                ///< Type of metadata item.
+    union
     {
-        const int id;                       ///< Unique ID for metadata item.
-        char *restrict name;                ///< Name of metadata item.
-        psMetadataType type;                ///< Type of metadata item.
-        union
-            {
-                bool B;
-                psS32 S32;                  ///< Signed 32-bit integer data.
-                psF32 F32;                  ///< Single-precision float data.
-                psF64 F64;                  ///< Double-precision float data.
-                psPTR V;                    ///< Pointer to other type of data.
-            }data;                          ///< Union for data types.
-        char *comment;                      ///< Optional comment ("", not NULL).
-        psList *restrict items;             ///< List of psMetadataItems with same name.
-    }
+        bool B;
+        psS32 S32;                  ///< Signed 32-bit integer data.
+        psF32 F32;                  ///< Single-precision float data.
+        psF64 F64;                  ///< Double-precision float data.
+        psPTR V;                    ///< Pointer to other type of data.
+    }data;                          ///< Union for data types.
+    char *comment;                      ///< Optional comment ("", not NULL).
+    psList *restrict items;             ///< List of psMetadataItems with same name.
+}
 psMetadataItem;
 
@@ -83,8 +83,8 @@
  */
 typedef struct psMetadata
-    {
-        psList* restrict list;
-        psHash* restrict table;
-    }
+{
+    psList* restrict list;
+    psHash* restrict table;
+}
 psMetadata;
 
Index: /trunk/psLib/src/astronomy/psPhotometry.h
===================================================================
--- /trunk/psLib/src/astronomy/psPhotometry.h	(revision 1384)
+++ /trunk/psLib/src/astronomy/psPhotometry.h	(revision 1385)
@@ -9,6 +9,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 23:12:34 $
+*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -39,12 +39,13 @@
  *
  */
+
 typedef struct
-    {
-        const int ID;                  ///< ID number for this photometric system
-        const char *name;              ///< Name of photometric system
-        const char *camera;            ///< Camera for photometric system
-        const char *filter;            ///< Filter used for photometric system
-        const char *detector;          ///< Detector used for photometric system
-    }
+{
+    const int ID;                  ///< ID number for this photometric system
+    const char *name;              ///< Name of photometric system
+    const char *camera;            ///< Camera for photometric system
+    const char *filter;            ///< Filter used for photometric system
+    const char *detector;          ///< Detector used for photometric system
+}
 psPhotSystem;
 
@@ -54,16 +55,17 @@
  *
  */
+
 typedef struct
-    {
-        psPhotSystem src;                  ///< Source photometric system
-        psPhotSystem dst;                  ///< Destination photometric system
-        psPhotSystem pP;                   ///< Primary color reference
-        psPhotSystem pM;                   ///< Primary color reference
-        psPhotSystem sP;                   ///< Secondary color reference
-        psPhotSystem sM;                   ///< Secondary color reference
-        float pA;                          ///< Color offset for references
-        float sA;                          ///< Color offset for references
-        psPolynomial3D transform;          ///< Transformation from source to destination
-    }
+{
+    psPhotSystem src;                  ///< Source photometric system
+    psPhotSystem dst;                  ///< Destination photometric system
+    psPhotSystem pP;                   ///< Primary color reference
+    psPhotSystem pM;                   ///< Primary color reference
+    psPhotSystem sP;                   ///< Secondary color reference
+    psPhotSystem sM;                   ///< Secondary color reference
+    float pA;                          ///< Color offset for references
+    float sA;                          ///< Color offset for references
+    psPolynomial3D transform;          ///< Transformation from source to destination
+}
 psPhotTransform;
 
Index: /trunk/psLib/src/astronomy/psTime.c
===================================================================
--- /trunk/psLib/src/astronomy/psTime.c	(revision 1384)
+++ /trunk/psLib/src/astronomy/psTime.c	(revision 1385)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 21:24:54 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -100,27 +100,73 @@
 static double leapseconds[NUM_LEAPSECOND_UPDATES][2] =
     {
-        {2441317.5, 10.0},
-        {2441499.5, 11.0},
-        {2441683.5, 12.0},
-        {2442048.5, 13.0},
-        {2442413.5, 14.0},
-        {2442778.5, 15.0},
-        {2443144.5, 16.0},
-        {2443509.5, 17.0},
-        {2443874.5, 18.0},
-        {2444239.5, 19.0},
-        {2444786.5, 20.0},
-        {2445151.5, 21.0},
-        {2445516.5, 22.0},
-        {2446247.5, 23.0},
-        {2447161.5, 24.0},
-        {2447892.5, 25.0},
-        {2448257.5, 26.0},
-        {2448804.5, 27.0},
-        {2449169.5, 28.0},
-        {2449534.5, 29.0},
-        {2450083.5, 30.0},
-        {2450630.5, 31.0},
-        {2451179.5, 32.0}
+        {
+            2441317.5, 10.0
+        },
+        {
+            2441499.5, 11.0
+        },
+        {
+            2441683.5, 12.0
+        },
+        {
+            2442048.5, 13.0
+        },
+        {
+            2442413.5, 14.0
+        },
+        {
+            2442778.5, 15.0
+        },
+        {
+            2443144.5, 16.0
+        },
+        {
+            2443509.5, 17.0
+        },
+        {
+            2443874.5, 18.0
+        },
+        {
+            2444239.5, 19.0
+        },
+        {
+            2444786.5, 20.0
+        },
+        {
+            2445151.5, 21.0
+        },
+        {
+            2445516.5, 22.0
+        },
+        {
+            2446247.5, 23.0
+        },
+        {
+            2447161.5, 24.0
+        },
+        {
+            2447892.5, 25.0
+        },
+        {
+            2448257.5, 26.0
+        },
+        {
+            2448804.5, 27.0
+        },
+        {
+            2449169.5, 28.0
+        },
+        {
+            2449534.5, 29.0
+        },
+        {
+            2450083.5, 30.0
+        },
+        {
+            2450630.5, 31.0
+        },
+        {
+            2451179.5, 32.0
+        }
     };
 
@@ -395,13 +441,15 @@
         psError(__func__,"Null value for timeval arg not allowed");
         return outTime;
-    } else if(time->tv_sec < 0)
-    {
-        psError(__func__,"Negative seconds are not allowed: %ld", time->tv_sec);
-        return outTime;
-    } else if(time->tv_usec<0)
-    {
-        psError(__func__,"Negative microseconds are not allowed: %ld", time->tv_usec);
-        return outTime;
-    }
+    } else
+        if(time->tv_sec < 0)
+        {
+            psError(__func__,"Negative seconds are not allowed: %ld", time->tv_sec);
+            return outTime;
+        } else
+            if(time->tv_usec<0)
+            {
+                psError(__func__,"Negative microseconds are not allowed: %ld", time->tv_usec);
+                return outTime;
+            }
 
     // Convert to psTime/TAI
@@ -420,5 +468,8 @@
     int n;
     int y;
-    int mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+    int mon [] =
+        {
+            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+        };
     long epoch;
     psTime outTime;
@@ -433,29 +484,35 @@
         psError(__func__,"Null value for tm arg not allowed");
         return outTime;
-    } else if(time->tm_year < 70)
-    {
-        psError(__func__,"Input times earlier than 1970 not allowed. Value: %d", time->tm_year+1900);
-        return outTime;
-    } else  if(time->tm_mon<0 || time->tm_mon>11)
-    {
-        psError(__func__,"Month must have a value from 0 to 11. Value: %d", time->tm_mon);
-        return outTime;
-    } else if(time->tm_mday<1 || time->tm_mday>31)
-    {
-        psError(__func__,"Day must have a value from 1 to 31. Value: %d", time->tm_mday);
-        return outTime;
-    } else if(time->tm_hour<0 || time->tm_hour>23)
-    {
-        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
-        return outTime;
-    } else if(time->tm_min<0 || time->tm_min>59)
-    {
-        psError(__func__,"Minute must have a value from 0 to 59. Value: %d", time->tm_min);
-        return outTime;
-    } else if(time->tm_sec<0 || time->tm_sec>59)
-    {
-        psError(__func__,"Second must have a value from 0 to 59. Value: %d", time->tm_sec);
-        return outTime;
-    }
+    } else
+        if(time->tm_year < 70)
+        {
+            psError(__func__,"Input times earlier than 1970 not allowed. Value: %d", time->tm_year+1900);
+            return outTime;
+        } else
+            if(time->tm_mon<0 || time->tm_mon>11)
+            {
+                psError(__func__,"Month must have a value from 0 to 11. Value: %d", time->tm_mon);
+                return outTime;
+            } else
+                if(time->tm_mday<1 || time->tm_mday>31)
+                {
+                    psError(__func__,"Day must have a value from 1 to 31. Value: %d", time->tm_mday);
+                    return outTime;
+                } else
+                    if(time->tm_hour<0 || time->tm_hour>23)
+                    {
+                        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
+                        return outTime;
+                    } else
+                        if(time->tm_min<0 || time->tm_min>59)
+                        {
+                            psError(__func__,"Minute must have a value from 0 to 59. Value: %d", time->tm_min);
+                            return outTime;
+                        } else
+                            if(time->tm_sec<0 || time->tm_sec>59)
+                            {
+                                psError(__func__,"Second must have a value from 0 to 59. Value: %d", time->tm_sec);
+                                return outTime;
+                            }
 
     n = time->tm_year + 1900 - 1;
Index: /trunk/psLib/src/astronomy/psTime.h
===================================================================
--- /trunk/psLib/src/astronomy/psTime.h	(revision 1384)
+++ /trunk/psLib/src/astronomy/psTime.h	(revision 1385)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 01:03:00 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/collections/psArray.c
===================================================================
--- /trunk/psLib/src/collections/psArray.c	(revision 1384)
+++ /trunk/psLib/src/collections/psArray.c	(revision 1385)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -67,16 +67,17 @@
         psError(__func__, "Null input vector\n");
         return NULL;
-    } else if(in->nalloc != nalloc) {                    // No need to realloc to same size
-        if(nalloc < in->n) {
-            for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
-                psFree(in->data[i]);
+    } else
+        if(in->nalloc != nalloc) {                    // No need to realloc to same size
+            if(nalloc < in->n) {
+                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
+                    psFree(in->data[i]);
+                }
+                in->n = nalloc;
             }
-            in->n = nalloc;
+
+            // Realloc after decrementation to avoid accessing freed array elements
+            in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
+            in->nalloc = nalloc;
         }
-
-        // Realloc after decrementation to avoid accessing freed array elements
-        in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
-        in->nalloc = nalloc;
-    }
 
     return in;
Index: /trunk/psLib/src/collections/psBitSet.c
===================================================================
--- /trunk/psLib/src/collections/psBitSet.c	(revision 1384)
+++ /trunk/psLib/src/collections/psBitSet.c	(revision 1385)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-01 21:48:11 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -126,11 +126,13 @@
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return inBitSet;
-    } else if(bit < 0) {
-        psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
-        return inBitSet;
-    } else if(bit > inBitSet->n*8-1) {
-        psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
-        return inBitSet;
-    }
+    } else
+        if(bit < 0) {
+            psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
+            return inBitSet;
+        } else
+            if(bit > inBitSet->n*8-1) {
+                psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
+                return inBitSet;
+            }
 
     // Variable byte is the byte in the array that contains the bit to be set
@@ -148,11 +150,13 @@
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return 0;
-    } else if(bit < 0) {
-        psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
-        return 0;
-    } else if(bit > inBitSet->n*8-1) {
-        psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
-        return 0;
-    }
+    } else
+        if(bit < 0) {
+            psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
+            return 0;
+        } else
+            if(bit > inBitSet->n*8-1) {
+                psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
+                return 0;
+            }
 
     // Variable byte is the byte in the array that contains the bit to be tested
Index: /trunk/psLib/src/collections/psList.c
===================================================================
--- /trunk/psLib/src/collections/psList.c	(revision 1384)
+++ /trunk/psLib/src/collections/psList.c	(revision 1385)
@@ -6,6 +6,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -349,9 +349,10 @@
     if (list->iter == ITER_INIT_HEAD) {
         return list->head;
-    } else if (list->iter == ITER_INIT_TAIL) {
-        return list->tail;
-    } else {
-        return list->iter;
-    }
+    } else
+        if (list->iter == ITER_INIT_TAIL) {
+            return list->tail;
+        } else {
+            return list->iter;
+        }
 }
 
@@ -360,9 +361,10 @@
     if (list->iter == ITER_INIT_HEAD) {
         return 0;
-    } else if (list->iter == ITER_INIT_TAIL) {
-        return list->size-1;
-    } else {
-        return list->iterIndex;
-    }
+    } else
+        if (list->iter == ITER_INIT_TAIL) {
+            return list->size-1;
+        } else {
+            return list->iterIndex;
+        }
 }
 
Index: /trunk/psLib/src/collections/psMetadata.c
===================================================================
--- /trunk/psLib/src/collections/psMetadata.c	(revision 1384)
+++ /trunk/psLib/src/collections/psMetadata.c	(revision 1385)
@@ -11,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 21:05:24 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -65,15 +65,15 @@
 {
     psMetadataType type;
-    
+
     type = metadataItem->type;
-    
+
     if ( metadataItem == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     psFree( metadataItem->name );
     psFree( metadataItem->comment );
     psFree( metadataItem->items );
-    
+
     if ( type == PS_META_STR ||
             type == PS_META_IMG ||
@@ -82,6 +82,6 @@
             type == PS_META_ASTROM ||
             type == PS_META_UNKNOWN ) {
-            psFree( metadataItem->data.V );
-        }
+        psFree( metadataItem->data.V );
+    }
 }
 
@@ -89,6 +89,6 @@
 {
     if ( metadata == NULL ) {
-            return ;
-        }
+        return ;
+    }
     psFree( metadata->list );
     psFree( metadata->table );
@@ -103,14 +103,14 @@
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
-    
+
     // Get the variable list parameters to pass to allocation function
     va_start( argPtr, comment );
-    
+
     // Call metadata item allocation
     metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
-    
+
     // Clean up stack after variable arguement has been used
     va_end( argPtr );
-    
+
     return metadataItem;
 }
@@ -119,67 +119,67 @@
 {
     psMetadataItem * metadataItem = NULL;
-    
+
     if ( name == NULL ) {
-            psError( __func__, "Null value for string not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null value for string not allowed" );
+        return NULL;
+    }
+
     // Allocate metadata item
     metadataItem = ( psMetadataItem * ) psAlloc( sizeof( psMetadataItem ) );
     if ( metadataItem == NULL ) {
-            psAbort( __func__, "Failed to allocate memory" );
-        }
-        
+        psAbort( __func__, "Failed to allocate memory" );
+    }
+
     // Set deallocator
     p_psMemSetDeallocator( metadataItem, ( psFreeFcn ) metadataItemFree );
-    
+
     // Allocate and set metadata item comment
     metadataItem->comment = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
     if ( comment == NULL ) {
-            // Per SDRS, null isn't allowed, must use "" instead
-            strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
-        } else {
-            strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
-        }
-        
+        // Per SDRS, null isn't allowed, must use "" instead
+        strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
+    } else {
+        strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
+    }
+
     // Set metadata item unique id
     *( int* ) ( &metadataItem->id ) = ++metadataId;
-    
+
     // Set metadata item type
     metadataItem->type = type;
-    
+
     // Set metadata item value
     switch ( type ) {
-            case PS_META_BOOL:
-            metadataItem->data.B = ( bool ) va_arg( argPtr, int );
-            break;
-            case PS_META_S32:
-            metadataItem->data.S32 = va_arg( argPtr, psS32 );
-            break;
-            case PS_META_F32:
-            metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
-            break;
-            case PS_META_F64:
-            metadataItem->data.F64 = va_arg( argPtr, psF64 );
-            break;
-            case PS_META_STR:
-            metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
-            break;
-            case PS_META_IMG:
-            case PS_META_JPEG:
-            case PS_META_PNG:
-            case PS_META_ASTROM:
-            case PS_META_UNKNOWN:
-            default:
-            psError( __func__, "Invalid psMetadataType: %d", type );
-        }
-        
+    case PS_META_BOOL:
+        metadataItem->data.B = ( bool ) va_arg( argPtr, int );
+        break;
+    case PS_META_S32:
+        metadataItem->data.S32 = va_arg( argPtr, psS32 );
+        break;
+    case PS_META_F32:
+        metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
+        break;
+    case PS_META_F64:
+        metadataItem->data.F64 = va_arg( argPtr, psF64 );
+        break;
+    case PS_META_STR:
+        metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
+        break;
+    case PS_META_IMG:
+    case PS_META_JPEG:
+    case PS_META_PNG:
+    case PS_META_ASTROM:
+    case PS_META_UNKNOWN:
+    default:
+        psError( __func__, "Invalid psMetadataType: %d", type );
+    }
+
     // Allocate and set metadata item name
     metadataItem->name = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
     vsprintf( metadataItem->name, name, argPtr );
-    
+
     // Allocate metadata items with same name.
     metadataItem->items = psListAlloc( NULL );
-    
+
     return metadataItem;
 }
@@ -190,28 +190,28 @@
     psHash *table = NULL;
     psMetadata *metadata = NULL;
-    
+
     // Allocate metadata
     metadata = ( psMetadata * ) psAlloc( sizeof( psMetadata ) );
     if ( metadata == NULL ) {
-            psAbort( __func__, "Failed to allocate metadata" );
-        }
-        
+        psAbort( __func__, "Failed to allocate metadata" );
+    }
+
     // Set deallocator
     p_psMemSetDeallocator( metadata, ( psFreeFcn ) metadataFree );
-    
+
     // Allocate metadata's internal containers
     list = ( psList * ) psListAlloc( NULL );
     if ( list == NULL ) {
-            psAbort( __func__, "Failed to allocate list" );
-        }
-        
+        psAbort( __func__, "Failed to allocate list" );
+    }
+
     table = ( psHash * ) psHashAlloc( 10 );
     if ( table == NULL ) {
-            psAbort( __func__, "Failed to allocate table" );
-        }
-        
+        psAbort( __func__, "Failed to allocate table" );
+    }
+
     metadata->list = list;
     metadata->table = table;
-    
+
     return metadata;
 }
@@ -224,48 +224,49 @@
     psMetadataItem *value = NULL;
     psMetadataType type = PS_META_ITEM_SET;
-    
+
     if ( md == NULL ) {
-            psError( __func__, "Null metadata collection not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata collection not allowed" );
+        return false;
+    }
+
     if ( metadataItem == NULL ) {
-            psError( __func__, "Null metadata item not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata item not allowed" );
+        return false;
+    }
+
     type = metadataItem->type;
-    
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return false;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return false;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     key = metadataItem->name;
     if ( key == NULL ) {
-            psError( __func__, "Null key item not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null key item not allowed" );
+        return false;
+    }
+
     // Check if key is already in table
     value = ( psMetadataItem* ) psHashLookup( mdTable, key );
     if ( value != NULL && type != PS_META_ITEM_SET ) {
-    
-            // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
-            // add the new metadata item to hash as a child of the existing metadata item folder node.
-            if ( !psListAdd( value->items, metadataItem, where ) ) {
-                    psError( __func__, "Couldn't add metadata item to items list. Name: %s",
-                             metadataItem->name );
-                    return false;
-                }
-        } else if ( value != NULL ) {
-        
+
+        // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
+        // add the new metadata item to hash as a child of the existing metadata item folder node.
+        if ( !psListAdd( value->items, metadataItem, where ) ) {
+            psError( __func__, "Couldn't add metadata item to items list. Name: %s",
+                     metadataItem->name );
+            return false;
+        }
+    } else
+        if ( value != NULL ) {
+
             // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
             // it will wipe out existing node.
@@ -274,20 +275,20 @@
             return false;
         } else {
-        
+
             // Duplicate key not found. Add new metadata item to metadata collection's hash
             if ( !psHashAdd( mdTable, key, metadataItem ) ) {
-                    psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
-                             metadataItem->name );
-                    return false;
-                }
-        }
-        
+                psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
+                         metadataItem->name );
+                return false;
+            }
+        }
+
     // Add all items to metadata collection's list, even if they have the same metadata item names
     if ( !psListAdd( md->list, metadataItem, where ) ) {
-            psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                     metadataItem->name );
-            return false;
-        }
-        
+        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                 metadataItem->name );
+        return false;
+    }
+
     return true;
 }
@@ -298,19 +299,19 @@
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
-    
+
     va_start( argPtr, comment );
     metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
     va_end( argPtr );
-    
+
     if ( !psMetadataAddItem( md, where, metadataItem ) ) {
-            psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                     metadataItem->name );
-            psFree( metadataItem );
-            return false;
-        }
-        
+        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                 metadataItem->name );
+        psFree( metadataItem );
+        return false;
+    }
+
     // Decrement reference count, since the metadata item is now in metadata collection and no longer needed here
     psMemDecrRefCounter( metadataItem );
-    
+
     return true;
 }
@@ -323,72 +324,72 @@
     psMetadataItem *entry = NULL;
     psMetadataItem *entryChild = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return false;
+    }
+
     // Select removal by key or index
     if ( key != NULL ) {
-    
-            // Remove by key name
-            entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-            if ( entry == NULL ) {
-                    psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
-                    return false;
-                }
-                
-            numChildren = entry->items->size;
-            if ( entry->type == PS_META_ITEM_SET && numChildren > 0 ) {
-            
-                    // Table entry has children. Entry and children must be removed from metadata collection's list
-                    psListSetIterator( mdList, PS_LIST_HEAD );
-                    entryChild = psListGetCurrent( mdList );
-                    while ( entryChild != NULL ) {
-                            if ( !psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN ) ) {
-                                    psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
-                                    return false;
-                                }
-                            entryChild = psListGetNext( entry->items );
-                        }
-                }
-                
-            // Remove entry from metadata collection's list
-            if ( !psListRemove( mdList, entry, PS_LIST_UNKNOWN ) ) {
+
+        // Remove by key name
+        entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
+        if ( entry == NULL ) {
+            psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
+            return false;
+        }
+
+        numChildren = entry->items->size;
+        if ( entry->type == PS_META_ITEM_SET && numChildren > 0 ) {
+
+            // Table entry has children. Entry and children must be removed from metadata collection's list
+            psListSetIterator( mdList, PS_LIST_HEAD );
+            entryChild = psListGetCurrent( mdList );
+            while ( entryChild != NULL ) {
+                if ( !psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN ) ) {
                     psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
                     return false;
                 }
-                
-            // Remove entry from metadata collection's table
-            if ( !psHashRemove( mdTable, key ) ) {
-                    psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
-                    return false;
-                }
-        } else {
-        
-            // Remove by index
-            entry = psListGet( mdList, where );
-            if ( entry == NULL ) {
-                    psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
-                    return false;
-                }
-                
-            key = entry->name;
-            if ( key == NULL ) {
-                    psError( __func__, "Null key name not allowed. Index: %d", where );
-                    return false;
-                }
-                
-            // Use recursive remove, now that key is known
-            psMetadataRemove( md, PS_LIST_UNKNOWN, key );
-        }
-        
+                entryChild = psListGetNext( entry->items );
+            }
+        }
+
+        // Remove entry from metadata collection's list
+        if ( !psListRemove( mdList, entry, PS_LIST_UNKNOWN ) ) {
+            psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+            return false;
+        }
+
+        // Remove entry from metadata collection's table
+        if ( !psHashRemove( mdTable, key ) ) {
+            psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
+            return false;
+        }
+    } else {
+
+        // Remove by index
+        entry = psListGet( mdList, where );
+        if ( entry == NULL ) {
+            psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
+            return false;
+        }
+
+        key = entry->name;
+        if ( key == NULL ) {
+            psError( __func__, "Null key name not allowed. Index: %d", where );
+            return false;
+        }
+
+        // Use recursive remove, now that key is known
+        psMetadataRemove( md, PS_LIST_UNKNOWN, key );
+    }
+
     return true;
 }
@@ -398,22 +399,22 @@
     psHash * mdTable = NULL;
     psMetadataItem *entry = NULL;
-    
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return NULL;
+    }
+
     if ( key == NULL ) {
-            psError( __func__, "Null key name not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null key name not allowed" );
+        return NULL;
+    }
+
     entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
     if ( entry == NULL ) {
-            psError( __func__, "Could not find metadata item with given key. Key: %s", key );
-            return NULL;
-        }
-        
+        psError( __func__, "Could not find metadata item with given key. Key: %s", key );
+        return NULL;
+    }
+
     return entry;
 }
@@ -423,17 +424,17 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     entry = ( psMetadataItem* ) psListGet( mdList, where );
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
-            return NULL;
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
+        return NULL;
+    }
+
     return entry;
 }
@@ -442,13 +443,13 @@
 {
     psList * mdList = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     psListSetIterator( mdList, where );
-    
+
     return true;
 }
@@ -458,33 +459,33 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     psListSetIterator( mdList, which );
     entry = psListGetCurrent( mdList );
     while ( entry != NULL ) {
-            if ( !strncmp( match, entry->name, strlen( match ) ) ) {
-            
-                    // Match found
-                    return entry;
-                }
-            entry = psListGetNext( mdList );
-        }
-        
+        if ( !strncmp( match, entry->name, strlen( match ) ) ) {
+
+            // Match found
+            return entry;
+        }
+        entry = psListGetNext( mdList );
+    }
+
     // Match not found
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    }
+
     return entry;
 }
@@ -494,33 +495,33 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     psListSetIterator( mdList, which );
     entry = psListGetCurrent( mdList );
     while ( entry != NULL ) {
-            if ( !strncmp( match, entry->name, strlen( match ) ) ) {
-            
-                    // Match found
-                    return entry;
-                }
-            entry = psListGetPrevious( mdList );
-        }
-        
+        if ( !strncmp( match, entry->name, strlen( match ) ) ) {
+
+            // Match found
+            return entry;
+        }
+        entry = psListGetPrevious( mdList );
+    }
+
     // Match not found
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    }
+
     return entry;
 }
@@ -529,47 +530,47 @@
 {
     psMetadataType type;
-    
+
     if ( fd == NULL ) {
-            psError( __func__, "Null file descriptor not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null file descriptor not allowed" );
+        return ;
+    }
+
     if ( format == NULL ) {
-            psError( __func__, "Null format not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null format not allowed" );
+        return ;
+    }
+
     if ( metadataItem == NULL ) {
-            psError( __func__, "Null metadata not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null metadata not allowed" );
+        return ;
+    }
+
     type = metadataItem->type;
-    
+
     switch ( type ) {
-            case PS_META_BOOL:
-            fprintf( fd, format, metadataItem->data.B );
-            break;
-            case PS_META_S32:
-            fprintf( fd, format, metadataItem->data.S32 );
-            break;
-            case PS_META_F32:
-            fprintf( fd, format, metadataItem->data.F32 );
-            break;
-            case PS_META_F64:
-            fprintf( fd, format, metadataItem->data.F64 );
-            break;
-            case PS_META_STR:
-            fprintf( fd, format, metadataItem->data.V );
-            break;
-            case PS_META_ITEM_SET:
-            case PS_META_IMG:
-            case PS_META_JPEG:
-            case PS_META_PNG:
-            case PS_META_ASTROM:
-            case PS_META_UNKNOWN:
-            default:
-            psError( __func__, " Invalid psMetadataType to print: %d", type );
-        }
+    case PS_META_BOOL:
+        fprintf( fd, format, metadataItem->data.B );
+        break;
+    case PS_META_S32:
+        fprintf( fd, format, metadataItem->data.S32 );
+        break;
+    case PS_META_F32:
+        fprintf( fd, format, metadataItem->data.F32 );
+        break;
+    case PS_META_F64:
+        fprintf( fd, format, metadataItem->data.F64 );
+        break;
+    case PS_META_STR:
+        fprintf( fd, format, metadataItem->data.V );
+        break;
+    case PS_META_ITEM_SET:
+    case PS_META_IMG:
+    case PS_META_JPEG:
+    case PS_META_PNG:
+    case PS_META_ASTROM:
+    case PS_META_UNKNOWN:
+    default:
+        psError( __func__, " Invalid psMetadataType to print: %d", type );
+    }
 }
 
@@ -590,100 +591,102 @@
     int keyNum = 0;
     psMetadataType metadataItemType;
-    
+
     if ( fd == NULL ) {
-            psError( __func__, "Null FITS file descriptor not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null FITS file descriptor not allowed" );
+        return NULL;
+    }
+
     if ( extname == NULL && extnum == 0 ) {
-            psError( __func__, "Null extname AND extnum = 0 not allowed" );
-            return NULL;
-        } else if ( extname && extnum ) {
+        psError( __func__, "Null extname AND extnum = 0 not allowed" );
+        return NULL;
+    } else
+        if ( extname && extnum ) {
             psError( __func__, "Both extname AND extnum arguments should not have values." );
             return NULL;
         }
-        
+
     // Allocate metadata if user didn't
     if ( output == NULL ) {
-            output = psMetadataAlloc();
-        }
-        
+        output = psMetadataAlloc();
+    }
+
     // Move to user designated HDU number or HDU name in FITS file. HDU numbers starts at one.
     if ( extname == NULL ) {
-            if ( fits_movabs_hdu( fd, extnum, &hduType, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while locating header: %s", fitsErr );
-                    status = 0;
-                    return output;
-                }
-        } else if ( extnum > 0 ) {
+        if ( fits_movabs_hdu( fd, extnum, &hduType, &status ) != 0 ) {
+            fits_get_errstatus( status, fitsErr );
+            psError( __func__, "FITS error while locating header: %s", fitsErr );
+            status = 0;
+            return output;
+        }
+    } else
+        if ( extnum > 0 ) {
             tempExtname = ( char* ) extname;
             if ( fits_movnam_hdu( fd, ANY_HDU, tempExtname, 0, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while locating header: %s", fitsErr );
-                    status = 0;
-                    return output;
-                }
-        }
-        
+                fits_get_errstatus( status, fitsErr );
+                psError( __func__, "FITS error while locating header: %s", fitsErr );
+                status = 0;
+                return output;
+            }
+        }
+
     // Get number of key names
     if ( fits_get_hdrpos( fd, &numKeys, &keyNum, &status ) != 0 ) {
+        fits_get_errstatus( status, fitsErr );
+        psError( __func__, "FITS error while reading keys: %s", fitsErr );
+        status = 0;
+        return output;
+    }
+
+    // Get each key name. Keywords start at one.
+    for ( i = 1; i <= numKeys; i++ ) {
+        if ( fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0 ) {
             fits_get_errstatus( status, fitsErr );
-            psError( __func__, "FITS error while reading keys: %s", fitsErr );
+            psError( __func__, "FITS error while reading key number %d: %s", i, fitsErr );
             status = 0;
             return output;
         }
-        
-    // Get each key name. Keywords start at one.
-    for ( i = 1; i <= numKeys; i++ ) {
-            if ( fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while reading key number %d: %s", i, fitsErr );
-                    status = 0;
-                    return output;
-                }
-            if ( fits_get_keytype( keyValue, &keyType, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    if ( status != VALUE_UNDEFINED ) {
-                            psError( __func__, "FITS error while determining key type: %s", fitsErr );
-                            status = 0;
-                            return output;
-                        } else {
-                            // Some keywords are still valid even though they don't have a type or value, like COMMENTS
-                            keyType = 'C';
-                            status = 0;
-                        }
-                }
-                
-            switch ( keyType ) {
-                    case 'I':
-                    metadataItemType = PS_META_S32;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atoi( keyValue ) );
-                    break;
-                    case 'F':
-                    metadataItemType = PS_META_F64;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atof( keyValue ) );
-                    break;
-                    case 'C':
-                    metadataItemType = PS_META_STR;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, keyValue );
-                    break;
-                    case 'L':
-                    metadataItemType = PS_META_BOOL;
-                    tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, tempBool );
-                    break;
-                    case 'U':
-                    case 'X':
-                    default:
-                    psError( __func__, "Invalid psMetadataType: %c", keyType );
-                    return output;
-                }
-                
-            if ( !success ) {
-                    psError( __func__, "Failed to add metadata item. Name: %s", keyName );
-                }
-        }
-        
+        if ( fits_get_keytype( keyValue, &keyType, &status ) != 0 ) {
+            fits_get_errstatus( status, fitsErr );
+            if ( status != VALUE_UNDEFINED ) {
+                psError( __func__, "FITS error while determining key type: %s", fitsErr );
+                status = 0;
+                return output;
+            } else {
+                // Some keywords are still valid even though they don't have a type or value, like COMMENTS
+                keyType = 'C';
+                status = 0;
+            }
+        }
+
+        switch ( keyType ) {
+        case 'I':
+            metadataItemType = PS_META_S32;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atoi( keyValue ) );
+            break;
+        case 'F':
+            metadataItemType = PS_META_F64;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atof( keyValue ) );
+            break;
+        case 'C':
+            metadataItemType = PS_META_STR;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, keyValue );
+            break;
+        case 'L':
+            metadataItemType = PS_META_BOOL;
+            tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, tempBool );
+            break;
+        case 'U':
+        case 'X':
+        default:
+            psError( __func__, "Invalid psMetadataType: %c", keyType );
+            return output;
+        }
+
+        if ( !success ) {
+            psError( __func__, "Failed to add metadata item. Name: %s", keyName );
+        }
+    }
+
     return output;
 }
Index: /trunk/psLib/src/collections/psMetadata.h
===================================================================
--- /trunk/psLib/src/collections/psMetadata.h	(revision 1384)
+++ /trunk/psLib/src/collections/psMetadata.h	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 22:11:09 $
+*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -59,19 +59,19 @@
  */
 typedef struct psMetadataItem
+{
+    const int id;                       ///< Unique ID for metadata item.
+    char *restrict name;                ///< Name of metadata item.
+    psMetadataType type;                ///< Type of metadata item.
+    union
     {
-        const int id;                       ///< Unique ID for metadata item.
-        char *restrict name;                ///< Name of metadata item.
-        psMetadataType type;                ///< Type of metadata item.
-        union
-            {
-                bool B;
-                psS32 S32;                  ///< Signed 32-bit integer data.
-                psF32 F32;                  ///< Single-precision float data.
-                psF64 F64;                  ///< Double-precision float data.
-                psPTR V;                    ///< Pointer to other type of data.
-            }data;                          ///< Union for data types.
-        char *comment;                      ///< Optional comment ("", not NULL).
-        psList *restrict items;             ///< List of psMetadataItems with same name.
-    }
+        bool B;
+        psS32 S32;                  ///< Signed 32-bit integer data.
+        psF32 F32;                  ///< Single-precision float data.
+        psF64 F64;                  ///< Double-precision float data.
+        psPTR V;                    ///< Pointer to other type of data.
+    }data;                          ///< Union for data types.
+    char *comment;                      ///< Optional comment ("", not NULL).
+    psList *restrict items;             ///< List of psMetadataItems with same name.
+}
 psMetadataItem;
 
@@ -83,8 +83,8 @@
  */
 typedef struct psMetadata
-    {
-        psList* restrict list;
-        psHash* restrict table;
-    }
+{
+    psList* restrict list;
+    psHash* restrict table;
+}
 psMetadata;
 
Index: /trunk/psLib/src/collections/psScalar.c
===================================================================
--- /trunk/psLib/src/collections/psScalar.c	(revision 1384)
+++ /trunk/psLib/src/collections/psScalar.c	(revision 1385)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-01 00:14:40 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/collections/psScalar.h
===================================================================
--- /trunk/psLib/src/collections/psScalar.h	(revision 1384)
+++ /trunk/psLib/src/collections/psScalar.h	(revision 1385)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-18 23:36:02 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/collections/psVector.c
===================================================================
--- /trunk/psLib/src/collections/psVector.c	(revision 1384)
+++ /trunk/psLib/src/collections/psVector.c	(revision 1385)
@@ -8,6 +8,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-07-31 02:28:10 $
+*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -63,25 +63,25 @@
     psVector * psVec = NULL;
     int elementSize = 0;
-    
+
     // Invalid nalloc
     if ( nalloc < 1 ) {
-            psError( __func__, "Invalid value for nalloc. nalloc: %d\n", nalloc );
-            return NULL;
-        }
-        
+        psError( __func__, "Invalid value for nalloc. nalloc: %d\n", nalloc );
+        return NULL;
+    }
+
     elementSize = PSELEMTYPE_SIZEOF( elemType );
-    
+
     // Create vector struct
     psVec = ( psVector * ) psAlloc( sizeof( psVector ) );
     p_psMemSetDeallocator( psVec, ( psFreeFcn ) vectorFree );
-    
+
     psVec->type.dimen = PS_DIMEN_VECTOR;
     psVec->type.type = elemType;
     psVec->nalloc = nalloc;
     psVec->n = nalloc;
-    
+
     // Create vector data array
     psVec->data.V = psAlloc( nalloc * elementSize );
-    
+
     return psVec;
 }
@@ -91,26 +91,27 @@
     int elementSize = 0;
     psElemType elemType;
-    
+
     // Invalid nalloc
     if ( nalloc < 1 ) {
-            psError( __func__, "Invalid value for realloc (%d)\n", nalloc );
-            return NULL;
-        }
-        
+        psError( __func__, "Invalid value for realloc (%d)\n", nalloc );
+        return NULL;
+    }
+
     if ( in == NULL ) {
-            psError( __func__, "Null input vector\n" );
-            return NULL;
-        } else if ( in->nalloc != nalloc ) {                    // No need to realloc to same size
+        psError( __func__, "Null input vector\n" );
+        return NULL;
+    } else
+        if ( in->nalloc != nalloc ) {                    // No need to realloc to same size
             elemType = in->type.type;
             elementSize = PSELEMTYPE_SIZEOF( elemType );
             if ( nalloc < in->n ) {
-                    in->n = nalloc;
-                }
-                
+                in->n = nalloc;
+            }
+
             // Realloc after decrementation to avoid accessing freed array elements
             in->data.V = psRealloc( in->data.V, nalloc * elementSize );
             in->nalloc = nalloc;
         }
-        
+
     return in;
 }
@@ -119,30 +120,30 @@
 {
     psElemType elemType;
-    
+
     if ( in == NULL ) {
-            return psVectorAlloc( nalloc, type );
-        }
-        
+        return psVectorAlloc( nalloc, type );
+    }
+
     elemType = in->type.type;
-    
+
     if ( in->nalloc == nalloc && elemType == type ) {
-            // it is proper size/type already
-            return in;
-        }
-        
+        // it is proper size/type already
+        return in;
+    }
+
     // Invalid nalloc
     if ( nalloc < 1 ) {
-            psError( __func__, "Invalid value for nalloc (%d)\n", nalloc );
-            psFree( in );
-            return NULL;
-        }
-        
-        
+        psError( __func__, "Invalid value for nalloc (%d)\n", nalloc );
+        psFree( in );
+        return NULL;
+    }
+
+
     in->data.V = psRealloc( in->data.V, nalloc * PSELEMTYPE_SIZEOF( type ) );
-    
+
     in->type.type = type;
     in->nalloc = nalloc;
     in->n = nalloc;
-    
+
     return in;
 }
@@ -156,84 +157,84 @@
     void *outVec = NULL;
     psElemType inType = 0;
-    
+
     if ( inVector == NULL ) {
-            psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
+        return outVector;
+    }
+
     inType = inVector->type.type;
     inN = inVector->n;
     inVec = inVector->data.V;
     elSize = PSELEMTYPE_SIZEOF( inType );
-    
+
     if ( outVector == NULL ) {
-            outVector = psVectorAlloc( inN, inType );
-            outVector->n = inVector->n;
-        }
-        
+        outVector = psVectorAlloc( inN, inType );
+        outVector->n = inVector->n;
+    }
+
     outN = outVector->n;
     outVec = outVector->data.V;
-    
+
     if ( inN != outN ) {
-            psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
-                     inN, outN );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
+                 inN, outN );
+        return outVector;
+    }
+
     if ( inType != outVector->type.type ) {
-            psError( __func__, " : Line %d - Input and output vectors are not same type: in=%d out=%d\n", __LINE__,
-                     inType, outVector->type.type );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Input and output vectors are not same type: in=%d out=%d\n", __LINE__,
+                 inType, outVector->type.type );
+        return outVector;
+    }
+
     if ( inN == 0 ) {
-            psError( __func__, " : Line %d - No elements in use for input vector\n", __LINE__ );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - No elements in use for input vector\n", __LINE__ );
+        return outVector;
+    }
+
     if ( outN == 0 ) {
-            psError( __func__, " : Line %d - No elements in use for output vector\n", __LINE__ );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - No elements in use for output vector\n", __LINE__ );
+        return outVector;
+    }
+
     // Copy input vector values into output vector
     memcpy( outVec, inVec, elSize * outN );
-    
+
     // Sort output vector
     switch ( inType ) {
-            case PS_TYPE_U8:
-            qsort( outVec, inN, elSize, psCompareU8 );
-            break;
-            case PS_TYPE_U16:
-            qsort( outVec, inN, elSize, psCompareU16 );
-            break;
-            case PS_TYPE_U32:
-            qsort( outVec, inN, elSize, psCompareU32 );
-            break;
-            case PS_TYPE_U64:
-            qsort( outVec, inN, elSize, psCompareU64 );
-            break;
-            case PS_TYPE_S8:
-            qsort( outVec, inN, elSize, psCompareS8 );
-            break;
-            case PS_TYPE_S16:
-            qsort( outVec, inN, elSize, psCompareS16 );
-            break;
-            case PS_TYPE_S32:
-            qsort( outVec, inN, elSize, psCompareS32 );
-            break;
-            case PS_TYPE_S64:
-            qsort( outVec, inN, elSize, psCompareS64 );
-            break;
-            case PS_TYPE_F32:
-            qsort( outVec, inN, elSize, psCompareF32 );
-            break;
-            case PS_TYPE_F64:
-            qsort( outVec, inN, elSize, psCompareF64 );
-            break;
-            default:
-            psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
-        }
-        
+    case PS_TYPE_U8:
+        qsort( outVec, inN, elSize, psCompareU8 );
+        break;
+    case PS_TYPE_U16:
+        qsort( outVec, inN, elSize, psCompareU16 );
+        break;
+    case PS_TYPE_U32:
+        qsort( outVec, inN, elSize, psCompareU32 );
+        break;
+    case PS_TYPE_U64:
+        qsort( outVec, inN, elSize, psCompareU64 );
+        break;
+    case PS_TYPE_S8:
+        qsort( outVec, inN, elSize, psCompareS8 );
+        break;
+    case PS_TYPE_S16:
+        qsort( outVec, inN, elSize, psCompareS16 );
+        break;
+    case PS_TYPE_S32:
+        qsort( outVec, inN, elSize, psCompareS32 );
+        break;
+    case PS_TYPE_S64:
+        qsort( outVec, inN, elSize, psCompareS64 );
+        break;
+    case PS_TYPE_F32:
+        qsort( outVec, inN, elSize, psCompareF32 );
+        break;
+    case PS_TYPE_F64:
+        qsort( outVec, inN, elSize, psCompareF64 );
+        break;
+    default:
+        psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
+    }
+
     return outVector;
 }
@@ -241,13 +242,13 @@
 #define SORT_INDICES(TYPE)                                                                                   \
 for(i=0; i<inN; i++) {                                                                                       \
-        for(j=0; j<inN; j++) {                                                                                   \
-                diff = fabs((double)tmpVector->data.TYPE[i] - inVec[j]);                                             \
-                if(diff < FLT_EPSILON) {                                                                             \
-                        outVec[i] = j;                                                                                   \
-                        break;                                                                                           \
-                    }                                                                                                    \
-            }                                                                                                        \
-    }
-    
+    for(j=0; j<inN; j++) {                                                                                   \
+        diff = fabs((double)tmpVector->data.TYPE[i] - inVec[j]);                                             \
+        if(diff < FLT_EPSILON) {                                                                             \
+            outVec[i] = j;                                                                                   \
+            break;                                                                                           \
+        }                                                                                                    \
+    }                                                                                                        \
+}
+
 psVector *psVectorSortIndex( psVector *restrict outVector, const psVector *restrict inVector )
 {
@@ -261,77 +262,77 @@
     psVector *tmpVector = NULL;
     psElemType inType = 0;
-    
+
     if ( inVector == NULL ) {
-            psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
+        return outVector;
+    }
+
     inN = inVector->n;
     inVec = inVector->data.V;
     inType = inVector->type.type;
-    
+
     if ( outVector == NULL ) {
-            outVector = psVectorAlloc( inN, PS_TYPE_U32 );
-            outVector->n = inN;
-        }
-        
+        outVector = psVectorAlloc( inN, PS_TYPE_U32 );
+        outVector->n = inN;
+    }
+
     outN = outVector->n;
     outVec = outVector->data.V;
-    
+
     if ( inN != outN ) {
-            psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
-                     __LINE__, inN, outN );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
+                 __LINE__, inN, outN );
+        return outVector;
+    }
+
     if ( outVector->type.type != PS_TYPE_U32 ) {
-            psError( __func__, " : Line %d - Output vector is not of type U32: out=%d\n",
-                     __LINE__, outVector->type.type );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Output vector is not of type U32: out=%d\n",
+                 __LINE__, outVector->type.type );
+        return outVector;
+    }
+
     tmpVector = psVectorAlloc( inN, inType );
     tmpVector->n = inN;
     tmpVector = psVectorSort( tmpVector, inVector );
-    
+
     // Sort output vector
     switch ( inType ) {
-            case PS_TYPE_U8:
-            SORT_INDICES( U8 );
-            break;
-            case PS_TYPE_U16:
-            SORT_INDICES( U16 );
-            break;
-            case PS_TYPE_U32:
-            SORT_INDICES( U32 );
-            break;
-            case PS_TYPE_U64:
-            SORT_INDICES( U64 );
-            break;
-            case PS_TYPE_S8:
-            SORT_INDICES( S8 );
-            break;
-            case PS_TYPE_S16:
-            SORT_INDICES( S16 );
-            break;
-            case PS_TYPE_S32:
-            SORT_INDICES( S32 );
-            break;
-            case PS_TYPE_S64:
-            SORT_INDICES( S64 );
-            break;
-            case PS_TYPE_F32:
-            SORT_INDICES( F32 );
-            break;
-            case PS_TYPE_F64:
-            SORT_INDICES( F64 );
-            break;
-            default:
-            psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
-        }
-        
+    case PS_TYPE_U8:
+        SORT_INDICES( U8 );
+        break;
+    case PS_TYPE_U16:
+        SORT_INDICES( U16 );
+        break;
+    case PS_TYPE_U32:
+        SORT_INDICES( U32 );
+        break;
+    case PS_TYPE_U64:
+        SORT_INDICES( U64 );
+        break;
+    case PS_TYPE_S8:
+        SORT_INDICES( S8 );
+        break;
+    case PS_TYPE_S16:
+        SORT_INDICES( S16 );
+        break;
+    case PS_TYPE_S32:
+        SORT_INDICES( S32 );
+        break;
+    case PS_TYPE_S64:
+        SORT_INDICES( S64 );
+        break;
+    case PS_TYPE_F32:
+        SORT_INDICES( F32 );
+        break;
+    case PS_TYPE_F64:
+        SORT_INDICES( F64 );
+        break;
+    default:
+        psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
+    }
+
     // Free temp memory
     psFree( tmpVector );
-    
+
     return outVector;
 }
@@ -340,7 +341,7 @@
 {
     if ( psVec == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     psFree( psVec->data.V );
 }
Index: /trunk/psLib/src/collections/psVector.h
===================================================================
--- /trunk/psLib/src/collections/psVector.h	(revision 1384)
+++ /trunk/psLib/src/collections/psVector.h	(revision 1385)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 23:52:33 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/dataManip/psFFT.c
===================================================================
--- /trunk/psLib/src/dataManip/psFFT.c	(revision 1384)
+++ /trunk/psLib/src/dataManip/psFFT.c	(revision 1385)
@@ -5,6 +5,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-02 19:43:59 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,46 +33,46 @@
     psElemType type;
     fftwf_plan plan;
-    
+
     /* got good image data? */
     if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
-    type = in->type.type;
-    
+        psFree( out );
+        return NULL;
+    }
+
+    type = in->type.type;
+
     if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-            psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type != PS_TYPE_C32 && direction == PS_FFT_REVERSE ) {
-            psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-            
-        }
-        
+        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+
+    }
+
     if ( type != PS_TYPE_F32 && direction == PS_FFT_FORWARD ) {
-            psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     /* make sure the system-level wisdom information is imported. */
     if ( ! p_fftwWisdomImported ) {
-            fftwf_import_system_wisdom();
-            p_fftwWisdomImported = true;
-        }
-        
+        fftwf_import_system_wisdom();
+        p_fftwWisdomImported = true;
+    }
+
     numRows = in->numRows;
     numCols = in->numCols;
-    
+
     out = psImageCopy( out, in, PS_TYPE_C32 );
-    
+
     plan = fftwf_plan_dft_2d( numCols, numRows,
                               ( fftwf_complex* ) out->data.C32[ 0 ],
@@ -80,19 +80,19 @@
                               direction,
                               P_FFTW_PLAN_RIGOR );
-                              
+
     /* check if a plan exists now*/
     if ( plan == NULL ) {
-            psError( __func__, "Failed to create FFTW plan." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Failed to create FFTW plan." );
+        psFree( out );
+        return NULL;
+    }
+
     /* finally, call FFTW with the plan made above */
     fftwf_execute( plan );
-    
+
     fftwf_destroy_plan( plan );
-    
-    return out;
-    
+
+    return out;
+
 }
 
@@ -103,49 +103,50 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just a copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                      "Just an image copy was performed." );
-            return psImageCopy( out, in, type );
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                  "Just an image copy was performed." );
+        return psImageCopy( out, in, type );
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = crealf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = crealf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = creal( inRow[ col ] );
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = creal( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not extract real component from given image type (%d).",
@@ -154,5 +155,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -163,51 +164,52 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just zeroed image of same size */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                      "A zero image was returned." );
-            out = psImageRecycle( out, numCols, numRows, type );
-            memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                  "A zero image was returned." );
+        out = psImageRecycle( out, numCols, numRows, type );
+        memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = cimagf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = cimagf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = cimag( inRow[ col ] );
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = cimag( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not extract imaginary component from given image type (%d).",
@@ -216,5 +218,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -225,71 +227,72 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
+
+
     if ( real == NULL || imag == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+        psFree( out );
+        return NULL;
+    }
+
     type = real->type.type;
     numCols = real->numCols;
     numRows = real->numRows;
-    
+
     if ( imag->type.type != type ) {
-            psError( __func__, "The inputs to psImageComplex must be the same type." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex must be the same type." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( imag->numCols != numCols ||
             imag->numRows != numRows ) {
-            psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "The inputs to psImageComplex can not be complex." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex can not be complex." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type != PS_TYPE_F32 && type != PS_TYPE_F64 ) {
-            psError( __func__, "The input type to psImageComplex must be a floating point." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The input type to psImageComplex must be a floating point." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_F32 ) {
-            psC32 * outRow;
-            psF32* realRow;
-            psF32* imagRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-            
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C32[ row ];
-                    realRow = real->data.F32[ row ];
-                    imagRow = imag->data.F32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                        }
-                }
-        } else if ( type == PS_TYPE_F64 ) {
+        psC32 * outRow;
+        psF32* realRow;
+        psF32* imagRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
+
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.C32[ row ];
+            realRow = real->data.F32[ row ];
+            imagRow = imag->data.F32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
+            }
+        }
+    } else
+        if ( type == PS_TYPE_F64 ) {
             psC64 * outRow;
             psF64* realRow;
             psF64* imagRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C64[ row ];
-                    realRow = real->data.F64[ row ];
-                    imagRow = imag->data.F64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                        }
+                outRow = out->data.C64[ row ];
+                realRow = real->data.F64[ row ];
+                imagRow = imag->data.F64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
                 }
+            }
         } else {
             psError( __func__, "Can not merge real and imaginary portions for given image type (%d).",
@@ -298,5 +301,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -307,49 +310,50 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just a image copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                      "Image copy was performed instead." );
-            return psImageCopy( out, in, type );
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                  "Image copy was performed instead." );
+        return psImageCopy( out, in, type );
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psC32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psC32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.C32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psC64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
-                        }
+                outRow = out->data.C64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not compute complex conjugate for given image type (%d).",
@@ -358,5 +362,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -368,58 +372,59 @@
     unsigned int numRows;
     int numElementsSquared;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
     numElementsSquared = numCols * numCols * numRows * numRows;
-    
+
     /* if not a complex number, this is not implemented */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            psF32 real;
-            psF32 imag;
-            
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            real = crealf( inRow[ col ] );
-                            imag = cimagf( inRow[ col ] );
-                            outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+        psF32 real;
+        psF32 imag;
+
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                real = crealf( inRow[ col ] );
+                imag = cimagf( inRow[ col ] );
+                outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
             psF64 real;
             psF64 imag;
-            
-            
+
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            real = crealf( inRow[ col ] );
-                            imag = cimagf( inRow[ col ] );
-                            outRow[ col ] = real * real + imag * imag / numElementsSquared;
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    real = crealf( inRow[ col ] );
+                    imag = cimagf( inRow[ col ] );
+                    outRow[ col ] = real * real + imag * imag / numElementsSquared;
                 }
+            }
         } else {
             psError( __func__, "Can not power spectrum for given image type (%d).",
@@ -428,7 +433,7 @@
             return NULL;
         }
-        
-    return out;
-    
+
+    return out;
+
 }
 
@@ -440,61 +445,61 @@
     psElemType type;
     fftwf_plan plan;
-    
+
     /* got good image data? */
     if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
-    type = in->type.type;
-    
+        psFree( out );
+        return NULL;
+    }
+
+    type = in->type.type;
+
     if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-            psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     if ( ( type != PS_TYPE_C32 ) && ( direction == PS_FFT_REVERSE ) ) {
-            psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-            
-        }
-        
+        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+
+    }
+
     if ( ( type != PS_TYPE_F32 ) && ( direction == PS_FFT_FORWARD ) ) {
-            psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     /* make sure the system-level wisdom information is imported. */
     if ( ! p_fftwWisdomImported ) {
-            fftwf_import_system_wisdom();
-            p_fftwWisdomImported = true;
-        }
-        
+        fftwf_import_system_wisdom();
+        p_fftwWisdomImported = true;
+    }
+
     numElements = in->n;
-    
+
     out = psVectorRecycle( out, PS_TYPE_C32, numElements );
     out->n = numElements;
-    
+
     if ( type == PS_TYPE_F32 ) {
-            // need to convert to complex
-            psC32 * outVec = out->data.C32;
-            psF32* inVec = in->data.F32;
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = inVec[ i ];
-                }
-        } else {
-            psC32* outVec = out->data.C32;
-            psC32* inVec = in->data.C32;
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = inVec[ i ];
-                }
-        }
-        
+        // need to convert to complex
+        psC32 * outVec = out->data.C32;
+        psF32* inVec = in->data.F32;
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = inVec[ i ];
+        }
+    } else {
+        psC32* outVec = out->data.C32;
+        psC32* inVec = in->data.C32;
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = inVec[ i ];
+        }
+    }
+
     plan = fftwf_plan_dft_1d( numElements,
                               ( fftwf_complex* ) out->data.C32,
@@ -502,17 +507,17 @@
                               direction,
                               P_FFTW_PLAN_RIGOR );
-                              
+
     /* check if a plan exists now*/
     if ( plan == NULL ) {
-            psError( __func__, "Failed to create FFTW plan." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Failed to create FFTW plan." );
+        psFree( out );
+        return NULL;
+    }
+
     /* finally, call FFTW with the plan made above */
     fftwf_execute( plan );
-    
+
     fftwf_destroy_plan( plan );
-    
+
     return out;
 }
@@ -523,42 +528,42 @@
     psElemType type;
     unsigned int numElements;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just a copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                      "Just a vector copy was performed." );
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                  "Just a vector copy was performed." );
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, numElements );
-            out->n = numElements;
-            outVec = out->data.F32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = crealf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not extract real component from given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, numElements );
+        out->n = numElements;
+        outVec = out->data.F32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = crealf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not extract real component from given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -568,43 +573,43 @@
     psElemType type;
     unsigned int numElements;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just zeroed image of same size */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                      "A zeroed vector was returned." );
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                  "A zeroed vector was returned." );
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, numElements );
-            out->n = numElements;
-            outVec = out->data.F32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = cimagf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not extract imaginary component from given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, numElements );
+        out->n = numElements;
+        outVec = out->data.F32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = cimagf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not extract imaginary component from given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -614,49 +619,49 @@
     psElemType type;
     unsigned int numElements;
-    
-    
+
+
     if ( real == NULL || imag == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+        psFree( out );
+        return NULL;
+    }
+
     type = real->type.type;
     if ( real->n < imag->n ) {
-            numElements = real->n;
-        } else {
-            numElements = imag->n;
-        }
-        
+        numElements = real->n;
+    } else {
+        numElements = imag->n;
+    }
+
     if ( imag->type.type != type ) {
-            psError( __func__, "The inputs to psVectorComplex must be the same type." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psVectorComplex must be the same type." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "The inputs to psVectorComplex can not be complex." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psVectorComplex can not be complex." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_F32 ) {
-            psC32 * outVec;
-            psF32* realVec = real->data.F32;
-            psF32* imagVec = imag->data.F32;
-            
-            out = psVectorRecycle( out, PS_TYPE_C32, numElements );
-            out->n = numElements;
-            outVec = out->data.C32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
-                }
-        } else {
-            psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psC32 * outVec;
+        psF32* realVec = real->data.F32;
+        psF32* imagVec = imag->data.F32;
+
+        out = psVectorRecycle( out, PS_TYPE_C32, numElements );
+        out->n = numElements;
+        outVec = out->data.C32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
+        }
+    } else {
+        psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -666,44 +671,44 @@
     psElemType type;
     unsigned int numElements;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just a image copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                      "Vector copy was performed instead." );
-                      
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                  "Vector copy was performed instead." );
+
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psC32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_C32, numElements );
-            out->n = numElements;
-            outVec = out->data.C32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psC32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_C32, numElements );
+        out->n = numElements;
+        outVec = out->data.C32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -716,10 +721,10 @@
     unsigned int inHalfNumElements;
     unsigned int inNumElementsSquared;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     inNumElements = in->n;
@@ -727,44 +732,44 @@
     inHalfNumElements = inNumElements / 2;
     outNumElements = inHalfNumElements + 1;
-    
+
     /* if not a complex number, this is not implemented */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            psF32 inAbs1;
-            psF32 inAbs2;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, outNumElements );
-            out->n = outNumElements;
-            outVec = out->data.F32;
-            
-            // from ADD: P_0 = |C_0|^2/N^2
-            inAbs1 = cabsf( inVec[ 0 ] );
-            outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
-            
-            // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
-            for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
-                    inAbs1 = cabsf( inVec[ i ] );
-                    inAbs2 = cabsf( inVec[ inNumElements - i ] );
-                    outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
-                }
-                
-            // from ADD: P_N/2 = |C_N/2|^2/N^2
-            inAbs1 = cabsf( inVec[ inHalfNumElements ] );
-            outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
-        } else {
-            psError( __func__, "Can not power spectrum for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
-    return out;
-    
-}
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+        psF32 inAbs1;
+        psF32 inAbs2;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, outNumElements );
+        out->n = outNumElements;
+        outVec = out->data.F32;
+
+        // from ADD: P_0 = |C_0|^2/N^2
+        inAbs1 = cabsf( inVec[ 0 ] );
+        outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
+
+        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
+        for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
+            inAbs1 = cabsf( inVec[ i ] );
+            inAbs2 = cabsf( inVec[ inNumElements - i ] );
+            outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
+        }
+
+        // from ADD: P_N/2 = |C_N/2|^2/N^2
+        inAbs1 = cabsf( inVec[ inHalfNumElements ] );
+        outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
+    } else {
+        psError( __func__, "Can not power spectrum for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
+    return out;
+
+}
Index: /trunk/psLib/src/dataManip/psFFT.h
===================================================================
--- /trunk/psLib/src/dataManip/psFFT.h	(revision 1384)
+++ /trunk/psLib/src/dataManip/psFFT.h	(revision 1385)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/dataManip/psFunctions.c
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.c	(revision 1384)
+++ /trunk/psLib/src/dataManip/psFunctions.c	(revision 1385)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-29 23:34:24 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/dataManip/psFunctions.h
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.h	(revision 1384)
+++ /trunk/psLib/src/dataManip/psFunctions.h	(revision 1385)
@@ -12,6 +12,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 22:11:09 $
+*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -39,6 +39,6 @@
             bool normal      ///< Indicates whether result should be normalized
           );
-          
-          
+
+
 /** Produce a vector of random numbers from a Gaussian distribution with
     the specified mean and sigma */
@@ -46,47 +46,47 @@
                          float sigma,    ///< The sigma of the Gaussian
                          int Npts );     ///< The size of the vector
-                         
-                         
-                         
-                         
-                         
+
+
+
+
+
 /** One-dimensional polynomial */
 typedef struct
-    {
-        int n;           ///< Number of terms
-        float *coeff;    ///< Coefficients
-        float *coeffErr; ///< Error in coefficients
-        char *mask;      ///< Coefficient mask
-    }
+{
+    int n;           ///< Number of terms
+    float *coeff;    ///< Coefficients
+    float *coeffErr; ///< Error in coefficients
+    char *mask;      ///< Coefficient mask
+}
 psPolynomial1D;
 
 /** Two-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY;    ///< Number of terms in x and y
-        float **coeff;   ///< Coefficients
-        float **coeffErr;   ///< Error in coefficients
-        char **mask;   ///< Coefficients mask
-    }
+{
+    int nX, nY;    ///< Number of terms in x and y
+    float **coeff;   ///< Coefficients
+    float **coeffErr;   ///< Error in coefficients
+    char **mask;   ///< Coefficients mask
+}
 psPolynomial2D;
 
 /** Three-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY, nZ;   ///< Number of terms in x, y and z
-        float ***coeff;    ///< Coefficients
-        float ***coeffErr;    ///< Error in coefficients
-        char ***mask;    ///< Coefficients mask
-    }
+{
+    int nX, nY, nZ;   ///< Number of terms in x, y and z
+    float ***coeff;    ///< Coefficients
+    float ***coeffErr;    ///< Error in coefficients
+    char ***mask;    ///< Coefficients mask
+}
 psPolynomial3D;
 
 /** Four-dimensional polynomial */
 typedef struct
-    {
-        int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-        float ****coeff;    ///< Coefficients
-        float ****coeffErr;   ///< Error in coefficients
-        char ****mask;    ///< Coefficients mask
-    }
+{
+    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
+    float ****coeff;    ///< Coefficients
+    float ****coeffErr;   ///< Error in coefficients
+    char ****mask;    ///< Coefficients mask
+}
 psPolynomial4D;
 
@@ -106,5 +106,5 @@
 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
                                    );
-                                   
+
 /** Evaluate 1D polynomial */
 float
@@ -112,5 +112,5 @@
                     const psPolynomial1D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 2D polynomial */
 float
@@ -119,5 +119,5 @@
                     const psPolynomial2D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 3D polynomial */
 float
@@ -127,5 +127,5 @@
                     const psPolynomial3D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 4D polynomial */
 float
@@ -136,5 +136,5 @@
                     const psPolynomial4D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /*****************************************************************************/
 
@@ -143,40 +143,40 @@
 /** Double-precision one-dimensional polynomial */
 typedef struct
-    {
-        int n;    ///< Number of terms
-        double *coeff;   ///< Coefficients
-        double *coeffErr;   ///< Error in coefficients
-        char *mask;    ///< Coefficient mask
-    }
+{
+    int n;    ///< Number of terms
+    double *coeff;   ///< Coefficients
+    double *coeffErr;   ///< Error in coefficients
+    char *mask;    ///< Coefficient mask
+}
 psDPolynomial1D;
 
 /** Double-precision two-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY;    ///< Number of terms in x and y
-        double **coeff;   ///< Coefficients
-        double **coeffErr;    ///< Error in coefficients
-        char **mask;   ///< Coefficients mask
-    }
+{
+    int nX, nY;    ///< Number of terms in x and y
+    double **coeff;   ///< Coefficients
+    double **coeffErr;    ///< Error in coefficients
+    char **mask;   ///< Coefficients mask
+}
 psDPolynomial2D;
 
 /** Double-precision three-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY, nZ;   ///< Number of terms in x, y and z
-        double ***coeff;   ///< Coefficients
-        double ***coeffErr;   ///< Error in coefficients
-        char ***mask;    ///< Coefficient mask
-    }
+{
+    int nX, nY, nZ;   ///< Number of terms in x, y and z
+    double ***coeff;   ///< Coefficients
+    double ***coeffErr;   ///< Error in coefficients
+    char ***mask;    ///< Coefficient mask
+}
 psDPolynomial3D;
 
 /** Double-precision four-dimensional polynomial */
 typedef struct
-    {
-        int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-        double ****coeff;    ///< Coefficients
-        double ****coeffErr;   ///< Error in coefficients
-        char ****mask;    ///< Coefficients mask
-    }
+{
+    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
+    double ****coeff;    ///< Coefficients
+    double ****coeffErr;   ///< Error in coefficients
+    char ****mask;    ///< Coefficients mask
+}
 psDPolynomial4D;
 
@@ -193,5 +193,5 @@
 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
                                      );
-                                     
+
 /** Evaluate 1D polynomial (double precision) */
 double
@@ -199,5 +199,5 @@
                      const psDPolynomial1D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 2D polynomial (double precision) */
 double
@@ -206,5 +206,5 @@
                      const psDPolynomial2D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 3D polynomial (double precision) */
 double
@@ -214,5 +214,5 @@
                      const psDPolynomial3D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 4D polynomial (double precision) */
 double
@@ -223,5 +223,5 @@
                      const psDPolynomial4D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /* \} */ // End of MathGroup Functions
 
Index: /trunk/psLib/src/dataManip/psMatrix.c
===================================================================
--- /trunk/psLib/src/dataManip/psMatrix.c	(revision 1384)
+++ /trunk/psLib/src/dataManip/psMatrix.c	(revision 1385)
@@ -20,6 +20,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-08 01:57:52 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -475,12 +475,13 @@
         PS_CHECK_ALLOC_VECTOR(outVector, inImage->numCols, inImage->type.type);
         outVector->type.dimen = PS_DIMEN_TRANSV;
-    } else if(inImage->numCols == 1) {
-        // Create non-transposed column vector
-        PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
-    } else {
-        psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
-                inImage->numCols);
-        return outVector;
-    }
+    } else
+        if(inImage->numCols == 1) {
+            // Create non-transposed column vector
+            PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
+        } else {
+            psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
+                    inImage->numCols);
+            return outVector;
+        }
 
     PS_CHECK_NULL_VECTOR(outVector, outVector);
@@ -502,18 +503,19 @@
         size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
 
-    } else if(outVector->type.dimen == PS_DIMEN_TRANSV) {
-        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
-
-        if(outVector->n == 0) {
-            outVector->n = inImage->numCols;
+    } else
+        if(outVector->type.dimen == PS_DIMEN_TRANSV) {
+            PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
+
+            if(outVector->n == 0) {
+                outVector->n = inImage->numCols;
+            }
+
+            if(outVector->n != inImage->numCols) {
+                psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
+                return outVector;
+            }
+
+            size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numCols;
         }
-
-        if(outVector->n != inImage->numCols) {
-            psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
-            return outVector;
-        }
-
-        size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numCols;
-    }
 
     memcpy(outVector->data.V, inImage->data.V[0], size);
@@ -538,27 +540,30 @@
             psError(__func__, "Image has more than 1 column: numCols = %d.", outImage->numCols);
             return outImage;
-        } else if(outImage->numRows != inVector->n) {
-            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
-            return outImage;
+        } else
+            if(outImage->numRows != inVector->n) {
+                psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
+                return outImage;
+            }
+
+        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
+
+    } else
+        if(inVector->type.dimen == PS_DIMEN_TRANSV) {
+            PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
+            PS_CHECK_SIZE_VECTOR(inVector, outImage);
+            PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
+
+            // More checks for PS_DIMEN_TRANSV
+            if(outImage->numRows > 1) {
+                psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
+                return outImage;
+            } else
+                if(outImage->numCols != inVector->n) {
+                    psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
+                    return outImage;
+                }
+
+            size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numCols;
         }
-
-        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
-
-    } else if(inVector->type.dimen == PS_DIMEN_TRANSV) {
-        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
-        PS_CHECK_SIZE_VECTOR(inVector, outImage);
-        PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
-
-        // More checks for PS_DIMEN_TRANSV
-        if(outImage->numRows > 1) {
-            psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
-            return outImage;
-        } else if(outImage->numCols != inVector->n) {
-            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
-            return outImage;
-        }
-
-        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numCols;
-    }
 
     PS_CHECK_NULL_IMAGE(outImage, outImage);
Index: /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c
===================================================================
--- /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c	(revision 1384)
+++ /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c	(revision 1385)
@@ -29,6 +29,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-21 00:09:11 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -445,9 +445,10 @@
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else if(dim1 == PS_DIMEN_IMAGE) {
-        if(((psImage*)in1)->numCols==0 || ((psImage*)in1)->numRows==0) {
-            psError(__func__, ": Line %d - Image contains zero length row or cols");
+    } else
+        if(dim1 == PS_DIMEN_IMAGE) {
+            if(((psImage*)in1)->numCols==0 || ((psImage*)in1)->numRows==0) {
+                psError(__func__, ": Line %d - Image contains zero length row or cols");
+            }
         }
-    }
 
     if(dim2 == PS_DIMEN_VECTOR) {
@@ -455,43 +456,52 @@
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else if(dim2 == PS_DIMEN_IMAGE) {
-        if(((psImage*)in2)->numCols==0 || ((psImage*)in2)->numRows==0) {
-            psError(__func__, ": Line %d - Image contains zero length row or cols");
+    } else
+        if(dim2 == PS_DIMEN_IMAGE) {
+            if(((psImage*)in2)->numCols==0 || ((psImage*)in2)->numRows==0) {
+                psError(__func__, ": Line %d - Image contains zero length row or cols");
+            }
         }
-    }
 
     if(dim1 == PS_DIMEN_SCALAR) {
         if(dim2 == PS_DIMEN_SCALAR) {
             BINARY_OP(SCALAR,SCALAR,out,psType1,op,psType2);               // scalar op scalar
-        } else if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-            BINARY_OP(SCALAR,VECTOR,out,psType1,op,psType2);               // scalar op vector
-        } else if(dim2 == PS_DIMEN_IMAGE) {
-            BINARY_OP(SCALAR,IMAGE,out,psType1,op,psType2);                // scalar op image
-        } else {
-            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-        }
-    } else if(dim1==PS_DIMEN_VECTOR || dim1==PS_DIMEN_TRANSV) {
-        if(dim2 == PS_DIMEN_SCALAR) {
-            BINARY_OP(VECTOR,SCALAR,out,psType1,op,psType2);               // vector op scalar
-        } else if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-            BINARY_OP(VECTOR,VECTOR,out,psType1,op,psType2);               // vector op vector
-        } else if(dim2 == PS_DIMEN_IMAGE) {
-            BINARY_OP(VECTOR,IMAGE,out,psType1,op,psType2);                // vector op image
-        } else {
-            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-        }
-    } else if(dim1 == PS_DIMEN_IMAGE) {
-        if(dim2 == PS_DIMEN_SCALAR) {
-            BINARY_OP(IMAGE,SCALAR,out,psType1,op,psType2);                // image op scalar
-        } else if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-            BINARY_OP(IMAGE,VECTOR,out,psType1,op,psType2);                // image op vector
-        } else if(dim2 == PS_DIMEN_IMAGE) {
-            BINARY_OP(IMAGE,IMAGE,out,psType1,op,psType2);                 // image op image
-        } else {
-            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-        }
-    } else {
-        psError(__func__, ": Line %d - Invalid dimensionality for in1 arg: %d", __LINE__, dim1);
-    }
+        } else
+            if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
+                BINARY_OP(SCALAR,VECTOR,out,psType1,op,psType2);               // scalar op vector
+            } else
+                if(dim2 == PS_DIMEN_IMAGE) {
+                    BINARY_OP(SCALAR,IMAGE,out,psType1,op,psType2);                // scalar op image
+                } else {
+                    psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+                }
+    } else
+        if(dim1==PS_DIMEN_VECTOR || dim1==PS_DIMEN_TRANSV) {
+            if(dim2 == PS_DIMEN_SCALAR) {
+                BINARY_OP(VECTOR,SCALAR,out,psType1,op,psType2);               // vector op scalar
+            } else
+                if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
+                    BINARY_OP(VECTOR,VECTOR,out,psType1,op,psType2);               // vector op vector
+                } else
+                    if(dim2 == PS_DIMEN_IMAGE) {
+                        BINARY_OP(VECTOR,IMAGE,out,psType1,op,psType2);                // vector op image
+                    } else {
+                        psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+                    }
+        } else
+            if(dim1 == PS_DIMEN_IMAGE) {
+                if(dim2 == PS_DIMEN_SCALAR) {
+                    BINARY_OP(IMAGE,SCALAR,out,psType1,op,psType2);                // image op scalar
+                } else
+                    if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
+                        BINARY_OP(IMAGE,VECTOR,out,psType1,op,psType2);                // image op vector
+                    } else
+                        if(dim2 == PS_DIMEN_IMAGE) {
+                            BINARY_OP(IMAGE,IMAGE,out,psType1,op,psType2);                 // image op image
+                        } else {
+                            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+                        }
+            } else {
+                psError(__func__, ": Line %d - Invalid dimensionality for in1 arg: %d", __LINE__, dim1);
+            }
 
     return out;
@@ -748,9 +758,10 @@
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else if(dimIn == PS_DIMEN_IMAGE) {
-        if(((psImage*)in)->numCols==0 || ((psImage*)in)->numRows==0) {
-            psError(__func__, ": Line %d - Image contains zero length row or cols");
+    } else
+        if(dimIn == PS_DIMEN_IMAGE) {
+            if(((psImage*)in)->numCols==0 || ((psImage*)in)->numRows==0) {
+                psError(__func__, ": Line %d - Image contains zero length row or cols");
+            }
         }
-    }
 
     if(dimOut == PS_DIMEN_VECTOR) {
@@ -758,19 +769,22 @@
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else if(dimOut == PS_DIMEN_IMAGE) {
-        if(((psImage*)out)->numCols==0 || ((psImage*)out)->numRows==0) {
-            psError(__func__, ": Line %d - Image contains zero length row or cols");
+    } else
+        if(dimOut == PS_DIMEN_IMAGE) {
+            if(((psImage*)out)->numCols==0 || ((psImage*)out)->numRows==0) {
+                psError(__func__, ": Line %d - Image contains zero length row or cols");
+            }
         }
-    }
 
     if(dimIn == PS_DIMEN_SCALAR) {
         UNARY_OP(SCALAR,out,psTypeIn,op);                                 // scalar
-    } else if(dimIn==PS_DIMEN_VECTOR || dimIn==PS_DIMEN_TRANSV) {
-        UNARY_OP(VECTOR,out,psTypeIn,op);                                 // vector
-    } else if(dimIn == PS_DIMEN_IMAGE) {
-        UNARY_OP(IMAGE,out,psTypeIn,op);                                  // image
-    } else {
-        psError(__func__, ": Line %d - Invalid dimensionality for in arg: %d", __LINE__, dimIn);
-    }
+    } else
+        if(dimIn==PS_DIMEN_VECTOR || dimIn==PS_DIMEN_TRANSV) {
+            UNARY_OP(VECTOR,out,psTypeIn,op);                                 // vector
+        } else
+            if(dimIn == PS_DIMEN_IMAGE) {
+                UNARY_OP(IMAGE,out,psTypeIn,op);                                  // image
+            } else {
+                psError(__func__, ": Line %d - Invalid dimensionality for in arg: %d", __LINE__, dimIn);
+            }
 
     return out;
Index: /trunk/psLib/src/dataManip/psMinimize.c
===================================================================
--- /trunk/psLib/src/dataManip/psMinimize.c	(revision 1384)
+++ /trunk/psLib/src/dataManip/psMinimize.c	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-30 00:39:14 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/dataManip/psStats.c
===================================================================
--- /trunk/psLib/src/dataManip/psStats.c	(revision 1384)
+++ /trunk/psLib/src/dataManip/psStats.c	(revision 1385)
@@ -36,33 +36,33 @@
                             unsigned int maskVal,
                             psStats *stats );
-                            
+
 /** Preprocessor macro to generate error on an incorrect type */
 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \
 if (NAME->type.type != TYPE) { \
-        psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \
-    }
-    
+    psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \
+}
+
 /** Preprocessor macro to generate error on a NULL vector */
 #define PS_CHECK_NULL_VECTOR(NAME) \
 if (NAME == NULL || NAME->data.V == NULL) { \
-        psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \
-    }
-    
+    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \
+}
+
 /** Preprocessor macro to generate error for zero length vector */
 #define PS_CHECK_EMPTY_VECTOR(NAME) \
 if (NAME->n < 1) { \
-        psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \
-    }
-    
+    psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \
+}
+
 /** Preprocessor macro to generate error on differing size vectors */
 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \
 if (VEC1->n != VEC2->n) { \
-        psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
-    }
-    
+    psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
+}
+
 #define PS_PRINT_VECTOR(NAME) \
 for (int my_i=0;my_i<NAME->n;my_i++) { \
-        printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
-    } \
+    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
+} \
 printf("\n"); \
 
@@ -92,51 +92,51 @@
     switch ( stats->options &
              ~ ( PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE | PS_STAT_ROBUST_FOR_SAMPLE ) ) {
-            case PS_STAT_SAMPLE_MEAN:
-            *value = stats->sampleMean;
-            return true;
-            
-            case PS_STAT_SAMPLE_MEDIAN:
-            *value = stats->sampleMedian;
-            return true;
-            
-            case PS_STAT_SAMPLE_STDEV:
-            *value = stats->sampleStdev;
-            return true;
-            
-            case PS_STAT_ROBUST_MEAN:
-            *value = stats->robustMean;
-            return true;
-            
-            case PS_STAT_ROBUST_MEDIAN:
-            *value = stats->robustMedian;
-            return true;
-            
-            case PS_STAT_ROBUST_MODE:
-            *value = stats->robustMode;
-            return true;
-            
-            case PS_STAT_ROBUST_STDEV:
-            *value = stats->robustStdev;
-            return true;
-            
-            case PS_STAT_CLIPPED_MEAN:
-            *value = stats->clippedMean;
-            return true;
-            
-            case PS_STAT_CLIPPED_STDEV:
-            *value = stats->clippedStdev;
-            return true;
-            
-            case PS_STAT_MAX:
-            *value = stats->max;
-            return true;
-            
-            case PS_STAT_MIN:
-            *value = stats->min;
-            return true;
-            
-            default:
-            return false;
-        }
+    case PS_STAT_SAMPLE_MEAN:
+        *value = stats->sampleMean;
+        return true;
+
+    case PS_STAT_SAMPLE_MEDIAN:
+        *value = stats->sampleMedian;
+        return true;
+
+    case PS_STAT_SAMPLE_STDEV:
+        *value = stats->sampleStdev;
+        return true;
+
+    case PS_STAT_ROBUST_MEAN:
+        *value = stats->robustMean;
+        return true;
+
+    case PS_STAT_ROBUST_MEDIAN:
+        *value = stats->robustMedian;
+        return true;
+
+    case PS_STAT_ROBUST_MODE:
+        *value = stats->robustMode;
+        return true;
+
+    case PS_STAT_ROBUST_STDEV:
+        *value = stats->robustStdev;
+        return true;
+
+    case PS_STAT_CLIPPED_MEAN:
+        *value = stats->clippedMean;
+        return true;
+
+    case PS_STAT_CLIPPED_STDEV:
+        *value = stats->clippedStdev;
+        return true;
+
+    case PS_STAT_MAX:
+        *value = stats->max;
+        return true;
+
+    case PS_STAT_MIN:
+        *value = stats->min;
+        return true;
+
+    default:
+        return false;
+    }
 }
 
@@ -153,11 +153,11 @@
 {
     int i = 0;                                  // Loop index variable.
-    
+
     for ( i = 0;i < myVector->n;i++ ) {
-            if ( maskVector != NULL )
-                printf( "Element %d is %f (mask is %d)\n", i, myVector->data.F32[ i ], maskVector->data.U8[ i ] );
-            else
-                printf( "Element %d is %f\n", i, myVector->data.F32[ i ] );
-        }
+        if ( maskVector != NULL )
+            printf( "Element %d is %f (mask is %d)\n", i, myVector->data.F32[ i ], maskVector->data.U8[ i ] );
+        else
+            printf( "Element %d is %f\n", i, myVector->data.F32[ i ] );
+    }
 }
 
@@ -204,48 +204,48 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     // If PS_STAT_USE_RANGE is requested, then we enter a slightly different
     // loop.
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            // Check if the data is with the specified range
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    mean += myVector->data.F32[ i ];
-                                    count++;
-                                }
-                        }
-                    mean /= ( float ) count;
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    mean += myVector->data.F32[ i ];
-                                    count++;
-                                }
-                        }
-                    mean /= ( float ) count;
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                // Check if the data is with the specified range
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    mean += myVector->data.F32[ i ];
+                    count++;
+                }
+            }
+            mean /= ( float ) count;
         } else {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    mean += myVector->data.F32[ i ];
-                                    count++;
-                                }
-                        }
-                    mean /= ( float ) count;
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            mean += myVector->data.F32[ i ];
-                        }
-                    mean /= ( float ) myVector->n;
-                }
-        }
-        
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    mean += myVector->data.F32[ i ];
+                    count++;
+                }
+            }
+            mean /= ( float ) count;
+        }
+    } else {
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    mean += myVector->data.F32[ i ];
+                    count++;
+                }
+            }
+            mean /= ( float ) count;
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                mean += myVector->data.F32[ i ];
+            }
+            mean /= ( float ) myVector->n;
+        }
+    }
+
     stats->sampleMean = mean;
 }
@@ -271,46 +271,46 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     // If PS_STAT_USE_RANGE is requested, then we enter a different loop.
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    if ( ( myVector->data.F32[ i ] > max ) &&
-                                            ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                            max = myVector->data.F32[ i ];
-                                        }
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( myVector->data.F32[ i ] > max ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    max = myVector->data.F32[ i ];
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    if ( ( myVector->data.F32[ i ] > max ) &&
+                            ( rangeMin <= myVector->data.F32[ i ] ) &&
+                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                        max = myVector->data.F32[ i ];
+                    }
+                }
+            }
         } else {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    if ( myVector->data.F32[ i ] > max ) {
-                                            max = myVector->data.F32[ i ];
-                                        }
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( myVector->data.F32[ i ] > max ) {
-                                    max = myVector->data.F32[ i ];
-                                }
-                        }
-                }
-        }
-        
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( myVector->data.F32[ i ] > max ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    max = myVector->data.F32[ i ];
+                }
+            }
+        }
+    } else {
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    if ( myVector->data.F32[ i ] > max ) {
+                        max = myVector->data.F32[ i ];
+                    }
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( myVector->data.F32[ i ] > max ) {
+                    max = myVector->data.F32[ i ];
+                }
+            }
+        }
+    }
+
     stats->max = max;
 }
@@ -336,45 +336,45 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    if ( ( myVector->data.F32[ i ] < min ) &&
-                                            ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                            min = myVector->data.F32[ i ];
-                                        }
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( myVector->data.F32[ i ] < min ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    min = myVector->data.F32[ i ];
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    if ( ( myVector->data.F32[ i ] < min ) &&
+                            ( rangeMin <= myVector->data.F32[ i ] ) &&
+                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                        min = myVector->data.F32[ i ];
+                    }
+                }
+            }
         } else {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    if ( myVector->data.F32[ i ] < min ) {
-                                            min = myVector->data.F32[ i ];
-                                        }
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( myVector->data.F32[ i ] < min ) {
-                                    min = myVector->data.F32[ i ];
-                                }
-                        }
-                }
-        }
-        
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( myVector->data.F32[ i ] < min ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    min = myVector->data.F32[ i ];
+                }
+            }
+        }
+    } else {
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    if ( myVector->data.F32[ i ] < min ) {
+                        min = myVector->data.F32[ i ];
+                    }
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( myVector->data.F32[ i ] < min ) {
+                    min = myVector->data.F32[ i ];
+                }
+            }
+        }
+    }
+
     stats->min = min;
 }
@@ -401,37 +401,37 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    numData++;
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    numData++;
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    numData++;
+                }
+            }
         } else {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    numData++;
-                                }
-                        }
-                } else {
-                    numData = myVector->n;
-                }
-        }
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    numData++;
+                }
+            }
+        }
+    } else {
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    numData++;
+                }
+            }
+        } else {
+            numData = myVector->n;
+        }
+    }
     return ( numData );
 }
@@ -462,6 +462,6 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
-    
+
+
     // Determine if the number of data points exceed a threshold which will
     // cause to generate robust stats, as opposed to exact stats.
@@ -488,67 +488,67 @@
         }
     */
-    
+
     // Determine how many data points fit inside this min/max range
     // and are not masked, IF the maskVector is not NULL>
     nValues = p_psVectorNValues( myVector, maskVector, maskVal, stats );
-    
+
     // Allocate temporary vectors for the data.
     unsortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
     unsortedVector->n = unsortedVector->nalloc;
-    
+
     sortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
     sortedVector->n = sortedVector->nalloc;
-    
+
     // Determine if we must only use data points within a min/max range.
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            
-            // Store all non-masked data points within the min/max range
-            // into the temporary vectors.
-            count = 0;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    unsortedVector->data.F32[ count++ ] = maskVector->data.F32[ i ];
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+
+        // Store all non-masked data points within the min/max range
+        // into the temporary vectors.
+        count = 0;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    unsortedVector->data.F32[ count++ ] = maskVector->data.F32[ i ];
+                }
+            }
         } else {
-            // Store all non-masked data points into the temporary vectors.
-            count = 0;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
-                        }
-                }
-        }
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
+        }
+    } else {
+        // Store all non-masked data points into the temporary vectors.
+        count = 0;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
+            }
+        }
+    }
     // Sort the temporary vectors.
     psVectorSort( sortedVector, unsortedVector );
-    
+
     // Calculate the median exactly.
     // XXX: Is this the correct action?
     if ( 0 == ( nValues % 2 ) ) {
-            stats->sampleMedian = 0.5 * ( sortedVector->data.F32[ ( nValues / 2 ) - 1 ] +
-                                          sortedVector->data.F32[ nValues / 2 ] );
-        } else {
-            stats->sampleMedian = sortedVector->data.F32[ nValues / 2 ];
-        }
-        
+        stats->sampleMedian = 0.5 * ( sortedVector->data.F32[ ( nValues / 2 ) - 1 ] +
+                                      sortedVector->data.F32[ nValues / 2 ] );
+    } else {
+        stats->sampleMedian = sortedVector->data.F32[ nValues / 2 ];
+    }
+
     // Free the temporary data structures.
     psFree( unsortedVector );
@@ -577,47 +577,47 @@
     float gaussianCoefs[ 1 + ( 2 * GAUSS_WIDTH ) ]; // The Gaussian Coefficients
     psVector *smooth = psVectorAlloc( robustHistogram->nums->n, PS_TYPE_F32 );
-    
+
     for ( i = 0;i < ( 1 + ( 2 * GAUSS_WIDTH ) );i++ ) {
-            if ( fabs( sigma ) >= FLT_EPSILON ) {
-                    // If sigma does not equal zero, then we use Gaussian smoothing.
-                    #ifdef  DARWIN
-                    denom = ( float ) sqrt( 2.0 * M_PI * sigma * sigma );
-                    #else
-                    
-                    denom = sqrtf( 2.0 * M_PI * sigma * sigma );
-                    #endif
-                    
-                    expo = - ( float ) ( ( i - GAUSS_WIDTH ) * ( i - GAUSS_WIDTH ) );
-                    expo /= ( 2.0 * sigma * sigma );
-                    gaussianCoefs[ i ] = exp( expo / denom );
-                    
-                    // NOTE: Gaussian smoothing just isn't working with low sigma
-                    // values.  The problem is that the Gaussian coefficients are
-                    // all zero, except for the middle coefficient, which is exactly
-                    // one.  Therefore, I'm using boxcar smoothing.
-                    gaussianCoefs[ i ] = 1.0 / ( 1.0 + ( 2.0 * ( float ) GAUSS_WIDTH ) );
-                    //            printf("gaussianCoefs[%d] is %f\n", i, gaussianCoefs[i]);
-                } else {
-                    /* If sigma equals zero (all pixels have the same value)
-                     * the above code will divide by zero.  Therefore, we don't need
-                     * to smooth the data.
-                     */
-                    for ( i = 0;i < robustHistogram->nums->n;i++ ) {
-                            smooth->data.F32[ i ] = ( float ) robustHistogram->nums->data.S32[ i ];
-                        }
-                    return ( smooth );
-                }
-        }
-        
+        if ( fabs( sigma ) >= FLT_EPSILON ) {
+            // If sigma does not equal zero, then we use Gaussian smoothing.
+            #ifdef  DARWIN
+            denom = ( float ) sqrt( 2.0 * M_PI * sigma * sigma );
+            #else
+
+            denom = sqrtf( 2.0 * M_PI * sigma * sigma );
+            #endif
+
+            expo = - ( float ) ( ( i - GAUSS_WIDTH ) * ( i - GAUSS_WIDTH ) );
+            expo /= ( 2.0 * sigma * sigma );
+            gaussianCoefs[ i ] = exp( expo / denom );
+
+            // NOTE: Gaussian smoothing just isn't working with low sigma
+            // values.  The problem is that the Gaussian coefficients are
+            // all zero, except for the middle coefficient, which is exactly
+            // one.  Therefore, I'm using boxcar smoothing.
+            gaussianCoefs[ i ] = 1.0 / ( 1.0 + ( 2.0 * ( float ) GAUSS_WIDTH ) );
+            //            printf("gaussianCoefs[%d] is %f\n", i, gaussianCoefs[i]);
+        } else {
+            /* If sigma equals zero (all pixels have the same value)
+             * the above code will divide by zero.  Therefore, we don't need
+             * to smooth the data.
+             */
+            for ( i = 0;i < robustHistogram->nums->n;i++ ) {
+                smooth->data.F32[ i ] = ( float ) robustHistogram->nums->data.S32[ i ];
+            }
+            return ( smooth );
+        }
+    }
+
     // Perform the actual smoothing.
     for ( i = 0;i < robustHistogram->nums->n;i++ ) {
-            smooth->data.F32[ i ] = 0.0;
-            for ( j = -GAUSS_WIDTH;j <= + GAUSS_WIDTH;j++ ) {
-                    if ( ( ( j + i ) >= 0 ) && ( ( j + i ) < smooth->n ) ) {
-                            smooth->data.F32[ i ] += ( gaussianCoefs[ j + GAUSS_WIDTH ] *
-                                                       ( float ) robustHistogram->nums->data.S32[ j + i ] );
-                        }
-                }
-        }
+        smooth->data.F32[ i ] = 0.0;
+        for ( j = -GAUSS_WIDTH;j <= + GAUSS_WIDTH;j++ ) {
+            if ( ( ( j + i ) >= 0 ) && ( ( j + i ) < smooth->n ) ) {
+                smooth->data.F32[ i ] += ( gaussianCoefs[ j + GAUSS_WIDTH ] *
+                                           ( float ) robustHistogram->nums->data.S32[ j + i ] );
+            }
+        }
+    }
     return ( smooth );
 }
@@ -646,9 +646,9 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     // Determine how many data points fit inside this min/max range
     // and are not maxed, IF the maskVector is not NULL>
     nValues = p_psVectorNValues( myVector, maskVector, maskVal, stats );
-    
+
     // Allocate temporary vectors for the data.
     unsortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
@@ -656,51 +656,51 @@
     sortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
     sortedVector->n = sortedVector->nalloc;
-    
+
     // Determine if we must only use data points within a min/max range.
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            // Store all non-masked data points within the min/max range
-            // into the temporary vectors.
-            count = 0;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        // Store all non-masked data points within the min/max range
+        // into the temporary vectors.
+        count = 0;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
         } else {
-            // Store all non-masked data points into the temporary vectors.
-            count = 0;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
-                        }
-                }
-        }
-        
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
+        }
+    } else {
+        // Store all non-masked data points into the temporary vectors.
+        count = 0;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
+            }
+        }
+    }
+
     // Sort the temporary vectors.
     psVectorSort( sortedVector, unsortedVector );
-    
+
     // Calculate the quartile points exactly.
     stats->sampleUQ = sortedVector->data.F32[ 3 * ( nValues / 4 ) ];
     stats->sampleLQ = sortedVector->data.F32[ nValues / 4 ];
-    
+
     // Free the temporary data structures.
     psFree( unsortedVector );
@@ -735,64 +735,64 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     // This procedure requires the mean.  If it has not been already
     // calculated, then call p_psVectorSampleMean()
     if ( 0 != isnan( stats->sampleMean ) ) {
-            p_psVectorSampleMean( myVector, maskVector, maskVal, stats );
-        }
+        p_psVectorSampleMean( myVector, maskVector, maskVal, stats );
+    }
     mean = stats->sampleMean;
-    
+
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    diff = myVector->data.F32[ i ] - mean;
-                                    sumSquares += ( diff * diff );
-                                    sumDiffs += diff;
-                                    countInt++;
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    diff = myVector->data.F32[ i ] - mean;
-                                    sumSquares += ( diff * diff );
-                                    sumDiffs += diff;
-                                    countInt++;
-                                }
-                        }
-                    countInt = myVector->n;
-                }
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    diff = myVector->data.F32[ i ] - mean;
+                    sumSquares += ( diff * diff );
+                    sumDiffs += diff;
+                    countInt++;
+                }
+            }
         } else {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    diff = myVector->data.F32[ i ] - mean;
-                                    sumSquares += ( diff * diff );
-                                    sumDiffs += diff;
-                                    countInt++;
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            diff = myVector->data.F32[ i ] - mean;
-                            sumSquares += ( diff * diff );
-                            sumDiffs += diff;
-                            countInt++;
-                        }
-                    countInt = myVector->n;
-                }
-        }
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    diff = myVector->data.F32[ i ] - mean;
+                    sumSquares += ( diff * diff );
+                    sumDiffs += diff;
+                    countInt++;
+                }
+            }
+            countInt = myVector->n;
+        }
+    } else {
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    diff = myVector->data.F32[ i ] - mean;
+                    sumSquares += ( diff * diff );
+                    sumDiffs += diff;
+                    countInt++;
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                diff = myVector->data.F32[ i ] - mean;
+                sumSquares += ( diff * diff );
+                sumDiffs += diff;
+                countInt++;
+            }
+            countInt = myVector->n;
+        }
+    }
     countFloat = ( float ) countInt;
-    
+
     #ifdef DARWIN
-    
+
     stats->sampleStdev = ( float ) sqrt( ( sumSquares - ( sumDiffs *
                                            sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
     #else
-    
+
     stats->sampleStdev = sqrtf( ( sumSquares - ( sumDiffs *
                                   sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
@@ -824,19 +824,19 @@
     float oldStanStdev = 0.0;                   // Temporary variable
     psVector *tmpMask = NULL;                   // Temporary vector
-    
+
     // Endure that stats->clipIter is within the proper range.
     if ( !( ( CLIPPED_NUM_ITER_LB <= stats->clipIter ) &&
             ( stats->clipIter <= CLIPPED_NUM_ITER_UB ) ) ) {
-            psAbort( __func__, "Unallowed value for clipIter (%d).\n",
-                     stats->clipIter );
-        }
-        
+        psAbort( __func__, "Unallowed value for clipIter (%d).\n",
+                 stats->clipIter );
+    }
+
     // Endure that stats->clipSigma is within the proper range.
     if ( !( ( CLIPPED_SIGMA_LB <= stats->clipSigma ) &&
             ( stats->clipSigma <= CLIPPED_SIGMA_UB ) ) ) {
-            psAbort( __func__, "Unallowed value for clipSigma (%f).\n",
-                     stats->clipSigma );
-        }
-        
+        psAbort( __func__, "Unallowed value for clipSigma (%f).\n",
+                 stats->clipSigma );
+    }
+
     // We allocate a temporary mask vector since during the iterative
     // steps that follow, we will be masking off additional data points.
@@ -844,65 +844,65 @@
     tmpMask = psVectorAlloc( myVector->n, PS_TYPE_U8 );
     tmpMask->n = myVector->n;
-    
+
     // If we were called with a mask vector, then initialize the temporary
     // mask vector with those values.
     if ( maskVector != NULL ) {
-            for ( i = 0;i < tmpMask->n;i++ ) {
-                    tmpMask->data.U8[ i ] = maskVector->data.U8[ i ];
-                }
-        }
-        
+        for ( i = 0;i < tmpMask->n;i++ ) {
+            tmpMask->data.U8[ i ] = maskVector->data.U8[ i ];
+        }
+    }
+
     // 1. Compute the sample median.
     // NOTE: This seems odd.  Verify with IfA that we want to calculate the
     // median here, not the mean.
     p_psVectorSampleMedian( myVector, maskVector, maskVal, stats );
-    
+
     // 2. Compute the sample standard deviation.
     p_psVectorSampleStdev( myVector, maskVector, maskVal, stats );
-    
+
     // 3. Use the sample median as the first estimator of the mean X.
     clippedMean = stats->sampleMean;
-    
+
     // 4. Use the sample stdev as the first estimator of the mean stdev.
     clippedStdev = stats->sampleStdev;
-    
+
     // Must save the old sampleMean and sampleStdev since the following code
     // block overwrites them.
     oldStanMean = stats->sampleMean;
     oldStanStdev = stats->sampleStdev;
-    
+
     // 5. Repeat N times:
     for ( i = 0;i < stats->clipIter;i++ ) {
-            for ( j = 0;j < myVector->n;j++ ) {
-                    // a) Exclude all values x_i for which |x_i - x| > K * stdev
-                    if ( fabs( myVector->data.F32[ j ] - clippedMean ) >
-                            ( stats->clipSigma * clippedStdev ) ) {
-                            tmpMask->data.U8[ i ] = 0xff;
-                        }
-                    // b) compute new mean and stdev
-                    p_psVectorSampleMedian( myVector, tmpMask, maskVal, stats );
-                    p_psVectorSampleStdev( myVector, tmpMask, maskVal, stats );
-                    
-                    // c) Use the new mean for x
-                    clippedMean = stats->sampleMean;
-                    
-                    // d) Use the new stdev for stdev
-                    clippedStdev = stats->sampleStdev;
-                }
-                
-        }
+        for ( j = 0;j < myVector->n;j++ ) {
+            // a) Exclude all values x_i for which |x_i - x| > K * stdev
+            if ( fabs( myVector->data.F32[ j ] - clippedMean ) >
+                    ( stats->clipSigma * clippedStdev ) ) {
+                tmpMask->data.U8[ i ] = 0xff;
+            }
+            // b) compute new mean and stdev
+            p_psVectorSampleMedian( myVector, tmpMask, maskVal, stats );
+            p_psVectorSampleStdev( myVector, tmpMask, maskVal, stats );
+
+            // c) Use the new mean for x
+            clippedMean = stats->sampleMean;
+
+            // d) Use the new stdev for stdev
+            clippedStdev = stats->sampleStdev;
+        }
+
+    }
     stats->sampleMean = oldStanMean;
     stats->sampleStdev = oldStanStdev;
-    
+
     // 7. The last calcuated value of x is the cliped mean.
     if ( stats->options & PS_STAT_CLIPPED_MEAN ) {
-            stats->clippedMean = clippedMean;
-        }
-        
+        stats->clippedMean = clippedMean;
+    }
+
     // 8. The last calcuated value of stdev is the cliped stdev.
     if ( stats->options & PS_STAT_CLIPPED_STDEV ) {
-            stats->clippedStdev = clippedStdev;
-        }
-        
+        stats->clippedStdev = clippedStdev;
+    }
+
     psFree( tmpMask );
 }
@@ -918,18 +918,18 @@
     float range = 0.0;
     int i = 0;
-    
+
     for ( i = 0;i < myData->n;i++ ) {
-            if ( myData->data.F32[ i ] < min ) {
-                    min = myData->data.F32[ i ];
-                }
-            if ( myData->data.F32[ i ] > max ) {
-                    max = myData->data.F32[ i ];
-                }
-        }
-        
+        if ( myData->data.F32[ i ] < min ) {
+            min = myData->data.F32[ i ];
+        }
+        if ( myData->data.F32[ i ] > max ) {
+            max = myData->data.F32[ i ];
+        }
+    }
+
     range = max - min;
     for ( i = 0;i < myData->n;i++ ) {
-            myData->data.F32[ i ] = ( myData->data.F32[ i ] - min ) / range;
-        }
+        myData->data.F32[ i ] = ( myData->data.F32[ i ] - min ) / range;
+    }
 }
 
@@ -948,5 +948,5 @@
     float tmp = exp( -( ( x - mean ) * ( x - mean ) ) / ( 2.0 * stdev * stdev ) );
     tmp /= ( ( float ) sqrt( 2.0 * M_PI * ( stdev * stdev ) ) );
-    
+
     //    printf("p_psGaussian((%.2f), %.2f, %.2f) is %.2f\n", x, mean, stdev, tmp);
     return ( tmp );
@@ -965,10 +965,11 @@
     float stdev = myParams->data.F32[ 1 ];
     float tmp = 0.0;
-    
+
     if ( whichParam == 0 ) {
-            // Return the derivative w.r.t. the mean.
-            tmp = ( x - mean ) * p_psGaussian( myData, myParams );
-            tmp /= ( stdev * stdev );
-        } else if ( whichParam == 1 ) {
+        // Return the derivative w.r.t. the mean.
+        tmp = ( x - mean ) * p_psGaussian( myData, myParams );
+        tmp /= ( stdev * stdev );
+    } else
+        if ( whichParam == 1 ) {
             // Return the derivative w.r.t. the stdev.
             tmp = ( x - mean ) * ( x - mean ) * p_psGaussian( myData, myParams );
@@ -976,5 +977,5 @@
         }
     printf( "p_psGaussianDeriv((%.2f), %.2f, %.2f, (%d)) is %.2f\n", x, mean, stdev, whichParam, tmp );
-    
+
     return ( tmp );
 }
@@ -994,5 +995,5 @@
     float C = myParams->data.F32[ 2 ];
     float tmp = 0.0;
-    
+
     tmp = ( A * x * x ) + ( B * x ) + C;
     return ( tmp );
@@ -1009,13 +1010,15 @@
     float x = myCoords->data.F32[ 0 ];
     float tmp = 0.0;
-    
+
     if ( whichParamDeriv == 0 ) {
-            tmp = x * x;
-        } else if ( whichParamDeriv == 1 ) {
+        tmp = x * x;
+    } else
+        if ( whichParamDeriv == 1 ) {
             tmp = x;
-        } else if ( whichParamDeriv == 2 ) {
-            tmp = 1.0;
-        }
-        
+        } else
+            if ( whichParamDeriv == 2 ) {
+                tmp = 1.0;
+            }
+
     return ( tmp );
 }
@@ -1039,27 +1042,27 @@
     float oldMidpoint = 1.0;
     float f = 0.0;
-    
+
     //  printf("p_ps1DPolyMedian(%f, %f, %f) \n", rangeLow, rangeHigh, getThisValue);
-    
+
     while ( numIterations < MAX_ITERATIONS ) {
-            midpoint = ( rangeHigh + rangeLow ) / 2.0;
-            if ( fabs( midpoint - oldMidpoint ) <= FLT_EPSILON ) {
-                    return ( midpoint );
-                }
-            oldMidpoint = midpoint;
-            
-            f = psPolynomial1DEval( midpoint, myPoly );
-            //        printf("p_ps1DPolyMedian() iteration %d.  f(%f) is %f\n", numIterations, midpoint, f);
-            if ( fabs( f - getThisValue ) <= FLT_EPSILON ) {
-                    return ( midpoint );
-                }
-                
-            if ( f > getThisValue ) {
-                    rangeHigh = midpoint;
-                } else {
-                    rangeLow = midpoint;
-                }
-            numIterations++;
-        }
+        midpoint = ( rangeHigh + rangeLow ) / 2.0;
+        if ( fabs( midpoint - oldMidpoint ) <= FLT_EPSILON ) {
+            return ( midpoint );
+        }
+        oldMidpoint = midpoint;
+
+        f = psPolynomial1DEval( midpoint, myPoly );
+        //        printf("p_ps1DPolyMedian() iteration %d.  f(%f) is %f\n", numIterations, midpoint, f);
+        if ( fabs( f - getThisValue ) <= FLT_EPSILON ) {
+            return ( midpoint );
+        }
+
+        if ( f > getThisValue ) {
+            rangeHigh = midpoint;
+        } else {
+            rangeLow = midpoint;
+        }
+        numIterations++;
+    }
     return ( midpoint );
 }
@@ -1082,38 +1085,38 @@
     psVector *yErr = psVectorAlloc( 3, PS_TYPE_F64 );
     psPolynomial1D *myPoly = psPolynomial1DAlloc( 2 );
-    
+
     if ( ( binNum > 0 ) &&
             ( binNum < ( histogram->nums->n + 1 ) ) ) {
-            x->data.F64[ 0 ] = ( double ) 0.5 *
-                               ( histogram->bounds->data.F32[ binNum - 1 ] +
-                                 histogram->bounds->data.F32[ binNum ] );
-            x->data.F64[ 1 ] = ( double ) 0.5 *
-                               ( histogram->bounds->data.F32[ binNum ] +
-                                 histogram->bounds->data.F32[ binNum + 1 ] );
-            x->data.F64[ 2 ] = ( double ) 0.5 *
-                               ( histogram->bounds->data.F32[ binNum + 1 ] +
-                                 histogram->bounds->data.F32[ binNum + 2 ] );
-                                 
-            y->data.F64[ 0 ] = cumulativeSums->data.F32[ binNum - 1 ];
-            y->data.F64[ 1 ] = cumulativeSums->data.F32[ binNum ];
-            y->data.F64[ 2 ] = cumulativeSums->data.F32[ binNum + 1 ];
-            
-            if ( !( ( y->data.F64[ 0 ] <= fitFloat ) &&
-                    ( fitFloat <= y->data.F64[ 2 ] ) ) ) {
-                    psAbort( __func__, "p_psVectorRobustStats(0): midpoint not within y-range\n" );
-                }
-                
-            yErr->data.F64[ 0 ] = 1.0;
-            yErr->data.F64[ 1 ] = 1.0;
-            yErr->data.F64[ 2 ] = 1.0;
-            
-            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-            return ( p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ], x->data.F64[ 2 ],
-                                       fitFloat ) );
-        } else {
-            return ( 0.5 * ( histogram->bounds->data.F32[ binNum + 1 ] +
-                             histogram->bounds->data.F32[ binNum ] ) );
-        }
-        
+        x->data.F64[ 0 ] = ( double ) 0.5 *
+                           ( histogram->bounds->data.F32[ binNum - 1 ] +
+                             histogram->bounds->data.F32[ binNum ] );
+        x->data.F64[ 1 ] = ( double ) 0.5 *
+                           ( histogram->bounds->data.F32[ binNum ] +
+                             histogram->bounds->data.F32[ binNum + 1 ] );
+        x->data.F64[ 2 ] = ( double ) 0.5 *
+                           ( histogram->bounds->data.F32[ binNum + 1 ] +
+                             histogram->bounds->data.F32[ binNum + 2 ] );
+
+        y->data.F64[ 0 ] = cumulativeSums->data.F32[ binNum - 1 ];
+        y->data.F64[ 1 ] = cumulativeSums->data.F32[ binNum ];
+        y->data.F64[ 2 ] = cumulativeSums->data.F32[ binNum + 1 ];
+
+        if ( !( ( y->data.F64[ 0 ] <= fitFloat ) &&
+                ( fitFloat <= y->data.F64[ 2 ] ) ) ) {
+            psAbort( __func__, "p_psVectorRobustStats(0): midpoint not within y-range\n" );
+        }
+
+        yErr->data.F64[ 0 ] = 1.0;
+        yErr->data.F64[ 1 ] = 1.0;
+        yErr->data.F64[ 2 ] = 1.0;
+
+        myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+        return ( p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ], x->data.F64[ 2 ],
+                                   fitFloat ) );
+    } else {
+        return ( 0.5 * ( histogram->bounds->data.F32[ binNum + 1 ] +
+                         histogram->bounds->data.F32[ binNum ] ) );
+    }
+
     psFree( x );
     psFree( y );
@@ -1187,5 +1190,5 @@
     float sumNfit = 0.0;
     float cumulativeMedian = 0.0;
-    
+
     // Compute the initial bin size of the robust histogram.  This is done
     // by computing the clipped standard deviation of the vector, and dividing
@@ -1193,39 +1196,39 @@
     p_psVectorClippedStats( myVector, maskVector, maskVal, tmpStats );
     binSize = tmpStats->clippedStdev / 10.0f;
-    
+
     // If stats->clippedStdev == 0.0, then all data elements have the same
     // value.  Therefore, we can set the appropiate results and return.
     if ( fabs( binSize ) <= FLT_EPSILON ) {
-            if ( stats->options & PS_STAT_ROBUST_MEAN ) {
-                    stats->robustMean = stats->clippedMean;
-                }
-            if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
-                    stats->robustMedian = stats->clippedMean;
-                }
-            if ( stats->options & PS_STAT_ROBUST_MODE ) {
-                    stats->robustMode = stats->clippedMean;
-                }
-            if ( stats->options & PS_STAT_ROBUST_STDEV ) {
-                    stats->robustStdev = 0.0;
-                }
-            if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
-                    stats->robustUQ = stats->clippedMean;
-                    stats->robustLQ = stats->clippedMean;
-                }
-            // XXX: Set these to the number of unmasked data points?
-            stats->robustNfit = 0.0;
-            stats->robustN50 = 0.0;
-            psFree( tmpStats );
-            return ;
-        }
-        
+        if ( stats->options & PS_STAT_ROBUST_MEAN ) {
+            stats->robustMean = stats->clippedMean;
+        }
+        if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
+            stats->robustMedian = stats->clippedMean;
+        }
+        if ( stats->options & PS_STAT_ROBUST_MODE ) {
+            stats->robustMode = stats->clippedMean;
+        }
+        if ( stats->options & PS_STAT_ROBUST_STDEV ) {
+            stats->robustStdev = 0.0;
+        }
+        if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
+            stats->robustUQ = stats->clippedMean;
+            stats->robustLQ = stats->clippedMean;
+        }
+        // XXX: Set these to the number of unmasked data points?
+        stats->robustNfit = 0.0;
+        stats->robustN50 = 0.0;
+        psFree( tmpStats );
+        return ;
+    }
+
     // Determine minimum and maximum values in the data vector.
     if ( isnan( stats->min ) ) {
-            p_psVectorMin( myVector, maskVector, maskVal, stats );
-        }
+        p_psVectorMin( myVector, maskVector, maskVal, stats );
+    }
     if ( isnan( stats->max ) ) {
-            p_psVectorMax( myVector, maskVector, maskVal, stats );
-        }
-        
+        p_psVectorMax( myVector, maskVector, maskVal, stats );
+    }
+
     // Create the histogram structure.  NOTE: we can not specify the bin size
     // precisely since the argument to psHistogramAlloc() is the number of
@@ -1236,20 +1239,20 @@
                                         stats->max,
                                         numBins );
-                                        
+
     // Populate the histogram array.
     psVectorHistogram( robustHistogram, myVector, maskVector, maskVal );
-    
+
     // Smooth the histogram.
     // XXX: is that the right stdev?
     robustHistogramVector = p_psVectorsmoothHistGaussian( robustHistogram,
                             tmpStats->clippedStdev / 4.0f );
-                            
+
     // The following was necessary to fit a gaussian to the data, since
     // gaussian functions produce data between 0.0 and 1.0.
     // p_psNormalizeVector(robustHistogramVector);
-    
+
     /**************************************************************************
     Determine the lower/upper quartiles.
-    **************************************************************************/ 
+    **************************************************************************/
     // We define a vector called "cumulativeRobustSums..." where the value at
     // index position i is equal to the sum of bins 0:i.  This will be used
@@ -1258,35 +1261,35 @@
     cumulativeRobustSumsFullRange->data.F32[ 0 ] = robustHistogramVector->data.F32[ 0 ];
     for ( i = 1;i < robustHistogramVector->n;i++ ) {
-            cumulativeRobustSumsFullRange->data.F32[ i ] =
-                cumulativeRobustSumsFullRange->data.F32[ i - 1 ] +
-                robustHistogramVector->data.F32[ i ];
-        }
+        cumulativeRobustSumsFullRange->data.F32[ i ] =
+            cumulativeRobustSumsFullRange->data.F32[ i - 1 ] +
+            robustHistogramVector->data.F32[ i ];
+    }
     sumRobust = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
-    
+
     // Determine the bin number containing the lower quartile point.
     LQBinNum = -1;
     for ( i = 0;i < cumulativeRobustSumsFullRange->n;i++ ) {
-            if ( cumulativeRobustSumsFullRange->data.F32[ i ] >= ( sumRobust / 4.0 ) ) {
-                    LQBinNum = i;
-                    break;
-                }
-        }
-        
+        if ( cumulativeRobustSumsFullRange->data.F32[ i ] >= ( sumRobust / 4.0 ) ) {
+            LQBinNum = i;
+            break;
+        }
+    }
+
     // Determine the bin number containing the upper quartile point.
     UQBinNum = -1;
     for ( i = cumulativeRobustSumsFullRange->n - 1;i >= 0;i-- ) {
-            if ( cumulativeRobustSumsFullRange->data.F32[ i ] <= ( 3.0 * sumRobust / 4.0 ) ) {
-                    UQBinNum = i;
-                    break;
-                }
-        }
-        
+        if ( cumulativeRobustSumsFullRange->data.F32[ i ] <= ( 3.0 * sumRobust / 4.0 ) ) {
+            UQBinNum = i;
+            break;
+        }
+    }
+
     if ( ( LQBinNum == -1 ) ||
             ( UQBinNum == -1 ) ) {
-            psAbort( __func__, "Could not determine the robust lower/upper quartiles." );
-        }
+        psAbort( __func__, "Could not determine the robust lower/upper quartiles." );
+    }
     /**************************************************************************
     Determine the mode in the range LQ:UQ.
-    **************************************************************************/ 
+    **************************************************************************/
     // Determine the bin with the peak value in the range LQ to UQ.
     maxBinNum = LQBinNum;
@@ -1294,16 +1297,16 @@
     sumN50 = ( float ) robustHistogram->nums->data.S32[ LQBinNum ];
     for ( i = LQBinNum + 1;i <= UQBinNum;i++ ) {
-            if ( robustHistogramVector->data.F32[ i ] > maxBinCount ) {
-                    maxBinNum = i;
-                    maxBinCount = robustHistogramVector->data.F32[ i ];
-                }
-            sumN50 += ( float ) robustHistogram->nums->data.S32[ i ];
-        }
-        
+        if ( robustHistogramVector->data.F32[ i ] > maxBinCount ) {
+            maxBinNum = i;
+            maxBinCount = robustHistogramVector->data.F32[ i ];
+        }
+        sumN50 += ( float ) robustHistogram->nums->data.S32[ i ];
+    }
+
     // XXX: is dL defined as the value at the LQ/UQ, or the bin number?
     dL = ( UQBinNum - LQBinNum ) / 4;
-    
+
     printf( "(LQBinNum, UQBinNum, maxBinNum) is (%d, %d, %d)\n", LQBinNum, UQBinNum, maxBinNum );
-    
+
     /**************************************************************************
     Determine the mean/stdev for the bins in the range mode-dL to mode+dL
@@ -1311,18 +1314,18 @@
     cumulativeRobustSumsDlRange = psVectorAlloc( robustHistogramVector->n, PS_TYPE_F32 );
     for ( i = 0;i < robustHistogramVector->n;i++ ) {
-            cumulativeRobustSumsDlRange->data.F32[ i ] = 0.0;
-        }
+        cumulativeRobustSumsDlRange->data.F32[ i ] = 0.0;
+    }
     sumNfit = 0.0;
     cumulativeMedian = 0.0;
     for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-            if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-                    cumulativeRobustSumsDlRange->data.F32[ i ] =
-                        cumulativeRobustSumsDlRange->data.F32[ i - 1 ] +
-                        robustHistogramVector->data.F32[ i ];
-                    cumulativeMedian += robustHistogramVector->data.F32[ i ];
-                    sumNfit += ( float ) robustHistogram->nums->data.S32[ i ];
-                }
-        }
-        
+        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
+            cumulativeRobustSumsDlRange->data.F32[ i ] =
+                cumulativeRobustSumsDlRange->data.F32[ i - 1 ] +
+                robustHistogramVector->data.F32[ i ];
+            cumulativeMedian += robustHistogramVector->data.F32[ i ];
+            sumNfit += ( float ) robustHistogram->nums->data.S32[ i ];
+        }
+    }
+
     // Calculate the mean of the smoothed robust histogram in the range
     // mode-dL to mode+dL.  We use the midpoint of each bin as the mean for
@@ -1330,43 +1333,43 @@
     myMean = 0.0;
     for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-            if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-                    myMean += ( robustHistogramVector->data.F32[ i ] ) * 0.5 *
-                              ( robustHistogram->bounds->data.F32[ i + 1 ] +
-                                robustHistogram->bounds->data.F32[ i ] );
-                    countFloat += robustHistogramVector->data.F32[ i ];
-                }
-        }
+        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
+            myMean += ( robustHistogramVector->data.F32[ i ] ) * 0.5 *
+                      ( robustHistogram->bounds->data.F32[ i + 1 ] +
+                        robustHistogram->bounds->data.F32[ i ] );
+            countFloat += robustHistogramVector->data.F32[ i ];
+        }
+    }
     myMean /= countFloat;
-    
+
     // Calculate the stdev of the smoothed robust histogram in the range
     // mode-dL to mode+dL.  We use the midpoint of each bin as the mean for
     // that bin.
     for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-            if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-                    diff = ( 0.5 * ( robustHistogram->bounds->data.F32[ i + 1 ] +
-                                     robustHistogram->bounds->data.F32[ i ] ) ) - myMean;
-                    sumSquares += diff * diff * robustHistogramVector->data.F32[ i ];
-                    sumDiffs += diff * robustHistogramVector->data.F32[ i ];
-                }
-        }
+        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
+            diff = ( 0.5 * ( robustHistogram->bounds->data.F32[ i + 1 ] +
+                             robustHistogram->bounds->data.F32[ i ] ) ) - myMean;
+            sumSquares += diff * diff * robustHistogramVector->data.F32[ i ];
+            sumDiffs += diff * robustHistogramVector->data.F32[ i ];
+        }
+    }
     myStdev = sqrt( ( sumSquares - ( sumDiffs * sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
-    
+
     /**************************************************************************
     Set the appropriate members in the output stats struct.
     **************************************************************************/
     if ( stats->options & PS_STAT_ROBUST_MEAN ) {
-            stats->robustMean = myMean;
-        }
-        
+        stats->robustMean = myMean;
+    }
+
     if ( stats->options & PS_STAT_ROBUST_MODE ) {
-            stats->robustMode = 0.5 *
-                                ( robustHistogram->bounds->data.F32[ maxBinNum ] +
-                                  robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
-        }
-        
+        stats->robustMode = 0.5 *
+                            ( robustHistogram->bounds->data.F32[ maxBinNum ] +
+                              robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
+    }
+
     if ( stats->options & PS_STAT_ROBUST_STDEV ) {
-            stats->robustStdev = myStdev;
-        }
-        
+        stats->robustStdev = myStdev;
+    }
+
     // To determine the median (and later, the lower/upper quartile), we fit
     // a quadratic to the three bins surrounding the bin containing the median.
@@ -1374,50 +1377,50 @@
     // the cumulative number of data points in all bins up to, and including,
     // this bin.  We then solve the quadratic for
-    
+
     if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
-            if ( ( maxBinNum > 0 ) && ( maxBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-                    x->data.F64[ 0 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ maxBinNum - 1 ] +
-                                         robustHistogram->bounds->data.F32[ maxBinNum ] );
-                    x->data.F64[ 1 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ maxBinNum ] +
-                                         robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
-                    x->data.F64[ 2 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
-                                         robustHistogram->bounds->data.F32[ maxBinNum + 2 ] );
-                                         
-                    y->data.F64[ 0 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum - 1 ];
-                    y->data.F64[ 1 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum ];
-                    y->data.F64[ 2 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum + 1 ];
-                    
-                    // Ensure that cumulativeMedian/2 is actually within the range of the bins
-                    // we are using.
-                    cumulativeMedian *= 0.5;
-                    if ( !( ( y->data.F64[ 0 ] <= cumulativeMedian ) &&
-                            ( cumulativeMedian <= y->data.F64[ 2 ] ) ) ) {
-                            printf( "((%f), %f, %f)\n", cumulativeMedian, y->data.F64[ 0 ], y->data.F64[ 2 ] );
-                            psAbort( __func__, "p_psVectorRobustStats(1): midpoint not within y-range\n" );
-                        }
-                    // XXX: yErr is not currently used by psVectorFitPolynomial1D().  We
-                    // may have to set this meaningfully later.
-                    yErr->data.F64[ 0 ] = 1.0;
-                    yErr->data.F64[ 1 ] = 1.0;
-                    yErr->data.F64[ 2 ] = 1.0;
-                    
-                    // Determine the coefficients of the polynomial.
-                    myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-                    // Call p_ps1DPolyMedian(), which does a binary search on the
-                    // polynomial, looking for the value x such that
-                    // f(x) = cumulativeMedian.
-                    stats->robustMedian = p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ],
-                                                            x->data.F64[ 2 ], cumulativeMedian );
-                } else {
-                    // If the mode is the first/last histogram bin, then simply use
-                    // the midpoint of that bin.
-                    stats->robustMedian = 0.5 * ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
-                                                  robustHistogram->bounds->data.F32[ maxBinNum ] );
-                }
-        }
-        
+        if ( ( maxBinNum > 0 ) && ( maxBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
+            x->data.F64[ 0 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ maxBinNum - 1 ] +
+                                 robustHistogram->bounds->data.F32[ maxBinNum ] );
+            x->data.F64[ 1 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ maxBinNum ] +
+                                 robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
+            x->data.F64[ 2 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
+                                 robustHistogram->bounds->data.F32[ maxBinNum + 2 ] );
+
+            y->data.F64[ 0 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum - 1 ];
+            y->data.F64[ 1 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum ];
+            y->data.F64[ 2 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum + 1 ];
+
+            // Ensure that cumulativeMedian/2 is actually within the range of the bins
+            // we are using.
+            cumulativeMedian *= 0.5;
+            if ( !( ( y->data.F64[ 0 ] <= cumulativeMedian ) &&
+                    ( cumulativeMedian <= y->data.F64[ 2 ] ) ) ) {
+                printf( "((%f), %f, %f)\n", cumulativeMedian, y->data.F64[ 0 ], y->data.F64[ 2 ] );
+                psAbort( __func__, "p_psVectorRobustStats(1): midpoint not within y-range\n" );
+            }
+            // XXX: yErr is not currently used by psVectorFitPolynomial1D().  We
+            // may have to set this meaningfully later.
+            yErr->data.F64[ 0 ] = 1.0;
+            yErr->data.F64[ 1 ] = 1.0;
+            yErr->data.F64[ 2 ] = 1.0;
+
+            // Determine the coefficients of the polynomial.
+            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+            // Call p_ps1DPolyMedian(), which does a binary search on the
+            // polynomial, looking for the value x such that
+            // f(x) = cumulativeMedian.
+            stats->robustMedian = p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ],
+                                                    x->data.F64[ 2 ], cumulativeMedian );
+        } else {
+            // If the mode is the first/last histogram bin, then simply use
+            // the midpoint of that bin.
+            stats->robustMedian = 0.5 * ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
+                                          robustHistogram->bounds->data.F32[ maxBinNum ] );
+        }
+    }
+
     // The lower/upper quartile calculations are very similar to the median
     // calculations.  We fit a quadratic to the array containing the
@@ -1426,82 +1429,82 @@
     //
     if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
-            countFloat = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
-            
-            if ( ( LQBinNum > 0 ) && ( LQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-                    x->data.F64[ 0 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ LQBinNum - 1 ] +
-                                         robustHistogram->bounds->data.F32[ LQBinNum ] );
-                    x->data.F64[ 1 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ LQBinNum ] +
-                                         robustHistogram->bounds->data.F32[ LQBinNum + 1 ] );
-                    x->data.F64[ 2 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
-                                         robustHistogram->bounds->data.F32[ LQBinNum + 2 ] );
-                                         
-                    y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum - 1 ];
-                    y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum ];
-                    y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum + 1 ];
-                    
-                    if ( !( ( y->data.F64[ 0 ] <= ( countFloat / 4.0 ) ) &&
-                            ( ( countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
-                            psAbort( __func__, "p_psVectorRobustStats(2): midpoint not within y-range\n" );
-                        }
-                        
-                    yErr->data.F64[ 0 ] = 1.0;
-                    yErr->data.F64[ 1 ] = 1.0;
-                    yErr->data.F64[ 2 ] = 1.0;
-                    
-                    myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-                    stats->robustLQ = p_ps1DPolyMedian( myPoly,
-                                                        x->data.F64[ 0 ],
-                                                        x->data.F64[ 2 ],
-                                                        countFloat / 4.0 );
-                                                        
-                } else {
-                    // If the LQ is the first/last histogram bin, then simply use
-                    // the midpoint of that bin.
-                    stats->robustLQ = 0.5 * ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
-                                              robustHistogram->bounds->data.F32[ LQBinNum ] );
-                }
-                
-            if ( ( UQBinNum > 0 ) && ( UQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-                    x->data.F64[ 0 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ UQBinNum - 1 ] +
-                                         robustHistogram->bounds->data.F32[ UQBinNum ] );
-                    x->data.F64[ 1 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ UQBinNum ] +
-                                         robustHistogram->bounds->data.F32[ UQBinNum + 1 ] );
-                    x->data.F64[ 2 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
-                                         robustHistogram->bounds->data.F32[ UQBinNum + 2 ] );
-                                         
-                    y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum - 1 ];
-                    y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum ];
-                    y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum + 1 ];
-                    
-                    if ( !( ( y->data.F64[ 0 ] <= ( 3.0 * countFloat / 4.0 ) ) &&
-                            ( ( 3.0 * countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
-                            psAbort( __func__, "p_psVectorRobustStats(3): midpoint not within y-range\n" );
-                        }
-                        
-                    yErr->data.F64[ 0 ] = 1.0;
-                    yErr->data.F64[ 1 ] = 1.0;
-                    yErr->data.F64[ 2 ] = 1.0;
-                    
-                    myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-                    stats->robustUQ = p_ps1DPolyMedian( myPoly,
-                                                        x->data.F64[ 0 ],
-                                                        x->data.F64[ 2 ],
-                                                        3.0 * countFloat / 4.0 );
-                } else {
-                    // If the UQ is the first/last histogram bin, then simply use
-                    // the midpoint of that bin.
-                    stats->robustUQ = 0.5 * ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
-                                              robustHistogram->bounds->data.F32[ UQBinNum ] );
-                }
-        }
+        countFloat = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
+
+        if ( ( LQBinNum > 0 ) && ( LQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
+            x->data.F64[ 0 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ LQBinNum - 1 ] +
+                                 robustHistogram->bounds->data.F32[ LQBinNum ] );
+            x->data.F64[ 1 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ LQBinNum ] +
+                                 robustHistogram->bounds->data.F32[ LQBinNum + 1 ] );
+            x->data.F64[ 2 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
+                                 robustHistogram->bounds->data.F32[ LQBinNum + 2 ] );
+
+            y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum - 1 ];
+            y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum ];
+            y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum + 1 ];
+
+            if ( !( ( y->data.F64[ 0 ] <= ( countFloat / 4.0 ) ) &&
+                    ( ( countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
+                psAbort( __func__, "p_psVectorRobustStats(2): midpoint not within y-range\n" );
+            }
+
+            yErr->data.F64[ 0 ] = 1.0;
+            yErr->data.F64[ 1 ] = 1.0;
+            yErr->data.F64[ 2 ] = 1.0;
+
+            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+            stats->robustLQ = p_ps1DPolyMedian( myPoly,
+                                                x->data.F64[ 0 ],
+                                                x->data.F64[ 2 ],
+                                                countFloat / 4.0 );
+
+        } else {
+            // If the LQ is the first/last histogram bin, then simply use
+            // the midpoint of that bin.
+            stats->robustLQ = 0.5 * ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
+                                      robustHistogram->bounds->data.F32[ LQBinNum ] );
+        }
+
+        if ( ( UQBinNum > 0 ) && ( UQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
+            x->data.F64[ 0 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ UQBinNum - 1 ] +
+                                 robustHistogram->bounds->data.F32[ UQBinNum ] );
+            x->data.F64[ 1 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ UQBinNum ] +
+                                 robustHistogram->bounds->data.F32[ UQBinNum + 1 ] );
+            x->data.F64[ 2 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
+                                 robustHistogram->bounds->data.F32[ UQBinNum + 2 ] );
+
+            y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum - 1 ];
+            y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum ];
+            y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum + 1 ];
+
+            if ( !( ( y->data.F64[ 0 ] <= ( 3.0 * countFloat / 4.0 ) ) &&
+                    ( ( 3.0 * countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
+                psAbort( __func__, "p_psVectorRobustStats(3): midpoint not within y-range\n" );
+            }
+
+            yErr->data.F64[ 0 ] = 1.0;
+            yErr->data.F64[ 1 ] = 1.0;
+            yErr->data.F64[ 2 ] = 1.0;
+
+            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+            stats->robustUQ = p_ps1DPolyMedian( myPoly,
+                                                x->data.F64[ 0 ],
+                                                x->data.F64[ 2 ],
+                                                3.0 * countFloat / 4.0 );
+        } else {
+            // If the UQ is the first/last histogram bin, then simply use
+            // the midpoint of that bin.
+            stats->robustUQ = 0.5 * ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
+                                      robustHistogram->bounds->data.F32[ UQBinNum ] );
+        }
+    }
     stats->robustNfit = sumNfit;
     stats->robustN50 = sumN50;
-    
+
     psFree( x );
     psFree( y );
@@ -1576,5 +1579,5 @@
 {
     psStats * newStruct = NULL;
-    
+
     newStruct = ( psStats * ) psAlloc( sizeof( psStats ) );
     newStruct->sampleMean = NAN;
@@ -1600,5 +1603,5 @@
     newStruct->binsize = NAN;
     newStruct->options = options;
-    
+
     return ( newStruct );
 }
@@ -1623,18 +1626,18 @@
     psHistogram *newHist = NULL;        // The new histogram structure
     float binSize = 0.0;                // The histogram bin size
-    
+
     // NOTE: Verify that this is the correct action.
     if ( n == 0 ) {
-            return ( NULL );
-        }
+        return ( NULL );
+    }
     if ( n < 0 ) {
-            psAbort( __func__, "psHistogramAlloc() called with bin size %d.\n", n );
-        }
-        
+        psAbort( __func__, "psHistogramAlloc() called with bin size %d.\n", n );
+    }
+
     // NOTE: Verify that this is the correct action.
     if ( lower > upper ) {
-            return ( NULL );
-        }
-        
+        return ( NULL );
+    }
+
     // Allocate memory for the new histogram structure.  If there are N
     // bins, then there are N+1 bounds to those bins.
@@ -1643,5 +1646,5 @@
     newHist->bounds = psVectorAlloc( n + 1, PS_TYPE_F32 );
     newHist->bounds->n = newHist->bounds->nalloc;
-    
+
     // Calculate the bounds for each bin.
     binSize = ( upper - lower ) / ( float ) n;
@@ -1650,19 +1653,19 @@
     binSize += FLT_EPSILON;
     for ( i = 0;i < n + 1;i++ ) {
-            newHist->bounds->data.F32[ i ] = lower + ( binSize * ( float ) i );
-        }
-        
+        newHist->bounds->data.F32[ i ] = lower + ( binSize * ( float ) i );
+    }
+
     // Allocate the bins, and initialize them to zero.
     newHist->nums = psVectorAlloc( n, PS_TYPE_U32 );
     newHist->nums->n = newHist->nums->nalloc;
     for ( i = 0;i < newHist->nums->n;i++ ) {
-            newHist->nums->data.U32[ i ] = 0;
-        }
-        
+        newHist->nums->data.U32[ i ] = 0;
+    }
+
     // Initialize the other members.
     newHist->minNum = 0;
     newHist->maxNum = 0;
     newHist->uniform = true;
-    
+
     return ( newHist );
 }
@@ -1681,22 +1684,22 @@
     psHistogram * newHist = NULL;        // The new histogram structure
     int i;                              // Loop index variable
-    
+
     // NOTE: Verify that this is the correct action.
     if ( bounds == NULL ) {
-            // psAbort(__func__, "psHistogram requested with NULL bounds");
-            return ( NULL );
-        }
-        
+        // psAbort(__func__, "psHistogram requested with NULL bounds");
+        return ( NULL );
+    }
+
     // NOTE: Verify that this is the correct action.
     if ( bounds->n <= 1 ) {
-            // psAbort(__func__, "psHistogram requested with NULL bounds");
-            return ( NULL );
-        }
-        
+        // psAbort(__func__, "psHistogram requested with NULL bounds");
+        return ( NULL );
+    }
+
     if ( bounds->type.type != PS_TYPE_F32 ) {
-            // psAbort(__func__, "psHistogram request a bound which is not type F32");
-            return ( NULL );
-        }
-        
+        // psAbort(__func__, "psHistogram request a bound which is not type F32");
+        return ( NULL );
+    }
+
     // Allocate memory for the new histogram structure.
     newHist = ( psHistogram * ) psAlloc( sizeof( psHistogram ) );
@@ -1705,7 +1708,7 @@
     newHist->bounds->n = newHist->bounds->nalloc;
     for ( i = 0;i < bounds->n;i++ ) {
-            newHist->bounds->data.F32[ i ] = bounds->data.F32[ i ];
-        }
-        
+        newHist->bounds->data.F32[ i ] = bounds->data.F32[ i ];
+    }
+
     // Allocate the bins, and initialize them to zero.  If there are N bounds,
     // then there are N-1 bins.
@@ -1713,12 +1716,12 @@
     newHist->nums->n = newHist->nums->nalloc;
     for ( i = 0;i < newHist->nums->n;i++ ) {
-            newHist->nums->data.U32[ i ] = 0;
-        }
-        
+        newHist->nums->data.U32[ i ] = 0;
+    }
+
     // Initialize the other members.
     newHist->minNum = 0;
     newHist->maxNum = 0;
     newHist->uniform = false;
-    
+
     return ( newHist );
 }
@@ -1755,89 +1758,90 @@
     int binNum = 0;                             // A temporary bin number
     int numBins = 0;                            // The total number of bins
-    
+
     // NOTE: Verify that this is the correct action.
     if ( out == NULL ) {
-            return ( NULL );
-        }
-        
+        return ( NULL );
+    }
+
     // Check the specified output histogram for type psF32
     if ( out->bounds->type.type != PS_TYPE_F32 ) {
-            psAbort( __func__,
-                     "Only data type PS_TYPE_F32 for the output.bounds member." );
-        }
-        
+        psAbort( __func__,
+                 "Only data type PS_TYPE_F32 for the output.bounds member." );
+    }
+
     if ( out->nums->type.type != PS_TYPE_U32 ) {
-            psAbort( __func__,
-                     "Only data type PS_TYPE_U32 for output.nums member." );
-        }
-        
+        psAbort( __func__,
+                 "Only data type PS_TYPE_U32 for output.nums member." );
+    }
+
     // NOTE: Verify that this is the correct action.
     if ( in == NULL ) {
-            return ( out );
-        }
-        
+        return ( out );
+    }
+
     if ( in->type.type != PS_TYPE_F32 ) {
+        psAbort( __func__,
+                 "Only data type PS_TYPE_F32 is currently supported (0x%x).",
+                 in->type.type );
+    }
+
+    if ( mask != NULL ) {
+        if ( in->n != mask->n ) {
             psAbort( __func__,
-                     "Only data type PS_TYPE_F32 is currently supported (0x%x).",
-                     in->type.type );
-        }
-        
-    if ( mask != NULL ) {
-            if ( in->n != mask->n ) {
-                    psAbort( __func__,
-                             "Vector data and vector mask are of different sizes." );
-                }
-            if ( mask->type.type != PS_TYPE_U8 ) {
-                    psAbort( __func__, "Vector mask must be type PS_TYPE_U8" );
-                }
-        }
+                     "Vector data and vector mask are of different sizes." );
+        }
+        if ( mask->type.type != PS_TYPE_U8 ) {
+            psAbort( __func__, "Vector mask must be type PS_TYPE_U8" );
+        }
+    }
     // NOTE: determine the correct action for a variety of other cases:
     // in vector has 0 elements, and histogram structure has zero bins.
-    
+
     numBins = out->nums->n;
     for ( i = 0;i < in->n;i++ ) {
-            // Check if this pixel is masked, and if so, skip it.
-            if ( ( mask == NULL ) ||
-                    ( ( mask != NULL ) && ( !( mask->data.U8[ i ] & maskVal ) ) ) ) {
-                    // Check if this pixel is below the minimum value, and if so
-                    // count it, then skip it.
-                    if ( in->data.F32[ i ] < out->bounds->data.F32[ 0 ] ) {
-                            out->minNum++;
-                            // Check if this pixel is above the maximum value, and if so
-                            // count it, then skip it.
-                        } else if ( in->data.F32[ i ] > out->bounds->data.F32[ numBins ] ) {
-                            out->maxNum++;
-                        } else {
-                            // If this is a uniform histogram, determining the correct
-                            // number is trivial.
-                            if ( out->uniform == true ) {
-                                    binSize = out->bounds->data.F32[ 1 ] - out->bounds->data.F32[ 0 ];
-                                    binNum = ( int ) ( ( in->data.F32[ i ] - out->bounds->data.F32[ 0 ] ) /
-                                                       binSize );
-                                                       
-                                    // NOTE: This next if-statement really shouldn't be necessary.
-                                    // However, do to numerical lack of precision, we occasionally
-                                    // produce a binNum outside the range of bins.
-                                    if ( binNum >= out->nums->n ) {
-                                            binNum = out->nums->n - 1;
-                                        }
-                                        
-                                    ( out->nums->data.S32[ binNum ] ) ++;
-                                    
-                                    // If this is a non-uniform histogram, determining the correct
-                                    // bin number requires a bit more work.
-                                } else {
-                                    // NOTE: This is slow.  Put a smarter algorithm here to
-                                    // find the correct bin number (bin search, probably)
-                                    for ( j = 0;j < ( out->bounds->n ) - 1;j++ ) {
-                                            if ( ( out->bounds->data.S32[ j ] <= in->data.F32[ i ] ) &&
-                                                    ( in->data.F32[ i ] <= out->bounds->data.S32[ j + 1 ] ) ) {
-                                                    ( out->nums->data.S32[ j ] ) ++;
-                                                }
-                                        }
-                                }
+        // Check if this pixel is masked, and if so, skip it.
+        if ( ( mask == NULL ) ||
+                ( ( mask != NULL ) && ( !( mask->data.U8[ i ] & maskVal ) ) ) ) {
+            // Check if this pixel is below the minimum value, and if so
+            // count it, then skip it.
+            if ( in->data.F32[ i ] < out->bounds->data.F32[ 0 ] ) {
+                out->minNum++;
+                // Check if this pixel is above the maximum value, and if so
+                // count it, then skip it.
+            } else
+                if ( in->data.F32[ i ] > out->bounds->data.F32[ numBins ] ) {
+                    out->maxNum++;
+                } else {
+                    // If this is a uniform histogram, determining the correct
+                    // number is trivial.
+                    if ( out->uniform == true ) {
+                        binSize = out->bounds->data.F32[ 1 ] - out->bounds->data.F32[ 0 ];
+                        binNum = ( int ) ( ( in->data.F32[ i ] - out->bounds->data.F32[ 0 ] ) /
+                                           binSize );
+
+                        // NOTE: This next if-statement really shouldn't be necessary.
+                        // However, do to numerical lack of precision, we occasionally
+                        // produce a binNum outside the range of bins.
+                        if ( binNum >= out->nums->n ) {
+                            binNum = out->nums->n - 1;
                         }
-                }
-        }
+
+                        ( out->nums->data.S32[ binNum ] ) ++;
+
+                        // If this is a non-uniform histogram, determining the correct
+                        // bin number requires a bit more work.
+                    } else {
+                        // NOTE: This is slow.  Put a smarter algorithm here to
+                        // find the correct bin number (bin search, probably)
+                        for ( j = 0;j < ( out->bounds->n ) - 1;j++ ) {
+                            if ( ( out->bounds->data.S32[ j ] <= in->data.F32[ i ] ) &&
+                                    ( in->data.F32[ i ] <= out->bounds->data.S32[ j + 1 ] ) ) {
+                                ( out->nums->data.S32[ j ] ) ++;
+                            }
+                        }
+                    }
+                }
+        }
+    }
     return ( out );
 }
@@ -1859,25 +1863,28 @@
     int i = 0;
     psVector *tmp = NULL;
-    
+
     if ( in->type.type == PS_TYPE_S32 ) {
+        tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
+        for ( i = 0;i < in->n;i++ ) {
+            tmp->data.F32[ i ] = ( float ) in->data.S32[ i ];
+        }
+    } else
+        if ( in->type.type == PS_TYPE_U32 ) {
             tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
             for ( i = 0;i < in->n;i++ ) {
-                    tmp->data.F32[ i ] = ( float ) in->data.S32[ i ];
-                }
-        } else if ( in->type.type == PS_TYPE_U32 ) {
-            tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-            for ( i = 0;i < in->n;i++ ) {
-                    tmp->data.F32[ i ] = ( float ) in->data.U32[ i ];
-                }
-        } else if ( in->type.type == PS_TYPE_F64 ) {
-            tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-            for ( i = 0;i < in->n;i++ ) {
+                tmp->data.F32[ i ] = ( float ) in->data.U32[ i ];
+            }
+        } else
+            if ( in->type.type == PS_TYPE_F64 ) {
+                tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
+                for ( i = 0;i < in->n;i++ ) {
                     tmp->data.F32[ i ] = ( float ) in->data.F64[ i ];
                 }
-        } else if ( in->type.type == PS_TYPE_F32 ) {
-            // do nothing
-        } else {
-            psAbort( __func__, "unsupported vector type 0x%x\n", in->type.type );
-        }
+            } else
+                if ( in->type.type == PS_TYPE_F32 ) {
+                    // do nothing
+                } else {
+                    psAbort( __func__, "unsupported vector type 0x%x\n", in->type.type );
+                }
     return ( tmp );
 }
@@ -1908,57 +1915,57 @@
     psVector * inF32;
     int mustFreeTmp = 1;
-    
+
     // NOTE: Verify that this is the correct action.
     if ( in == NULL ) {
-            return ( stats );
-        }
+        return ( stats );
+    }
     if ( stats == NULL ) {
-            return ( NULL );
-        }
-        
+        return ( NULL );
+    }
+
     inF32 = p_psConvertToF32( stats, in, mask, maskVal );
     if ( inF32 == NULL ) {
-            inF32 = in;
-            mustFreeTmp = 0;
-        }
-        
+        inF32 = in;
+        mustFreeTmp = 0;
+    }
+
     // XXX: Should we abort if (stats->min == stats->max)?
     if ( ( stats->options & PS_STAT_USE_RANGE ) &&
             ( stats->min >= stats->max ) ) {
-            psAbort( __func__, "psVectorStats() called with range: %f to %f\n",
-                     stats->min, stats->max );
-        }
-        
+        psAbort( __func__, "psVectorStats() called with range: %f to %f\n",
+                 stats->min, stats->max );
+    }
+
     //    PS_CHECK_VECTOR_TYPE(in, PS_TYPE_F32);
     if ( mask != NULL ) {
-            PS_CHECK_NULL_VECTOR( mask );
-            PS_CHECK_EMPTY_VECTOR( mask );
-            PS_CHECK_VECTOR_SIZE_EQUAL( mask, in );
-            PS_CHECK_VECTOR_TYPE( mask, PS_TYPE_U8 );
-        }
-        
+        PS_CHECK_NULL_VECTOR( mask );
+        PS_CHECK_EMPTY_VECTOR( mask );
+        PS_CHECK_VECTOR_SIZE_EQUAL( mask, in );
+        PS_CHECK_VECTOR_TYPE( mask, PS_TYPE_U8 );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_SAMPLE_MEAN ) {
-            p_psVectorSampleMean( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorSampleMean( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_SAMPLE_MEDIAN ) {
-            p_psVectorSampleMedian( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorSampleMedian( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     // NOTE: The Stdev calculation requires the mean.  Should we assume the
     // mean has already been calculated?  Or should we always calculate it?
     if ( stats->options & PS_STAT_SAMPLE_STDEV ) {
-            p_psVectorSampleMean( in, mask, maskVal, stats );
-            p_psVectorSampleStdev( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorSampleMean( in, mask, maskVal, stats );
+        p_psVectorSampleStdev( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_SAMPLE_QUARTILE ) {
-            p_psVectorSampleQuartiles( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorSampleQuartiles( in, mask, maskVal, stats );
+    }
+
     // Since the various robust stats quantities share much computation, they
     // are grouped together in a single private function:
@@ -1969,25 +1976,25 @@
             ( stats->options & PS_STAT_ROBUST_STDEV ) ||
             ( stats->options & PS_STAT_ROBUST_QUARTILE ) ) {
-            p_psVectorRobustStats( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorRobustStats( in, mask, maskVal, stats );
+    }
+
     if ( ( stats->options & PS_STAT_CLIPPED_MEAN ) ||
             ( stats->options & PS_STAT_CLIPPED_STDEV ) ) {
-            p_psVectorClippedStats( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorClippedStats( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_MAX ) {
-            p_psVectorMax( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorMax( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_MIN ) {
-            p_psVectorMin( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorMin( in, mask, maskVal, stats );
+    }
+
     if ( mustFreeTmp == 1 ) {
-            psFree( inF32 );
-        }
+        psFree( inF32 );
+    }
     return ( stats );
 }
Index: /trunk/psLib/src/dataManip/psStats.h
===================================================================
--- /trunk/psLib/src/dataManip/psStats.h	(revision 1384)
+++ /trunk/psLib/src/dataManip/psStats.h	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-29 01:59:06 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/dataManip/psVectorFFT.c
===================================================================
--- /trunk/psLib/src/dataManip/psVectorFFT.c	(revision 1384)
+++ /trunk/psLib/src/dataManip/psVectorFFT.c	(revision 1385)
@@ -5,6 +5,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-02 19:43:59 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,46 +33,46 @@
     psElemType type;
     fftwf_plan plan;
-    
+
     /* got good image data? */
     if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
-    type = in->type.type;
-    
+        psFree( out );
+        return NULL;
+    }
+
+    type = in->type.type;
+
     if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-            psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type != PS_TYPE_C32 && direction == PS_FFT_REVERSE ) {
-            psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-            
-        }
-        
+        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+
+    }
+
     if ( type != PS_TYPE_F32 && direction == PS_FFT_FORWARD ) {
-            psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     /* make sure the system-level wisdom information is imported. */
     if ( ! p_fftwWisdomImported ) {
-            fftwf_import_system_wisdom();
-            p_fftwWisdomImported = true;
-        }
-        
+        fftwf_import_system_wisdom();
+        p_fftwWisdomImported = true;
+    }
+
     numRows = in->numRows;
     numCols = in->numCols;
-    
+
     out = psImageCopy( out, in, PS_TYPE_C32 );
-    
+
     plan = fftwf_plan_dft_2d( numCols, numRows,
                               ( fftwf_complex* ) out->data.C32[ 0 ],
@@ -80,19 +80,19 @@
                               direction,
                               P_FFTW_PLAN_RIGOR );
-                              
+
     /* check if a plan exists now*/
     if ( plan == NULL ) {
-            psError( __func__, "Failed to create FFTW plan." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Failed to create FFTW plan." );
+        psFree( out );
+        return NULL;
+    }
+
     /* finally, call FFTW with the plan made above */
     fftwf_execute( plan );
-    
+
     fftwf_destroy_plan( plan );
-    
-    return out;
-    
+
+    return out;
+
 }
 
@@ -103,49 +103,50 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just a copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                      "Just an image copy was performed." );
-            return psImageCopy( out, in, type );
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                  "Just an image copy was performed." );
+        return psImageCopy( out, in, type );
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = crealf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = crealf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = creal( inRow[ col ] );
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = creal( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not extract real component from given image type (%d).",
@@ -154,5 +155,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -163,51 +164,52 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just zeroed image of same size */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                      "A zero image was returned." );
-            out = psImageRecycle( out, numCols, numRows, type );
-            memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                  "A zero image was returned." );
+        out = psImageRecycle( out, numCols, numRows, type );
+        memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = cimagf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = cimagf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = cimag( inRow[ col ] );
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = cimag( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not extract imaginary component from given image type (%d).",
@@ -216,5 +218,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -225,71 +227,72 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
+
+
     if ( real == NULL || imag == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+        psFree( out );
+        return NULL;
+    }
+
     type = real->type.type;
     numCols = real->numCols;
     numRows = real->numRows;
-    
+
     if ( imag->type.type != type ) {
-            psError( __func__, "The inputs to psImageComplex must be the same type." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex must be the same type." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( imag->numCols != numCols ||
             imag->numRows != numRows ) {
-            psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "The inputs to psImageComplex can not be complex." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex can not be complex." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type != PS_TYPE_F32 && type != PS_TYPE_F64 ) {
-            psError( __func__, "The input type to psImageComplex must be a floating point." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The input type to psImageComplex must be a floating point." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_F32 ) {
-            psC32 * outRow;
-            psF32* realRow;
-            psF32* imagRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-            
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C32[ row ];
-                    realRow = real->data.F32[ row ];
-                    imagRow = imag->data.F32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                        }
-                }
-        } else if ( type == PS_TYPE_F64 ) {
+        psC32 * outRow;
+        psF32* realRow;
+        psF32* imagRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
+
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.C32[ row ];
+            realRow = real->data.F32[ row ];
+            imagRow = imag->data.F32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
+            }
+        }
+    } else
+        if ( type == PS_TYPE_F64 ) {
             psC64 * outRow;
             psF64* realRow;
             psF64* imagRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C64[ row ];
-                    realRow = real->data.F64[ row ];
-                    imagRow = imag->data.F64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                        }
+                outRow = out->data.C64[ row ];
+                realRow = real->data.F64[ row ];
+                imagRow = imag->data.F64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
                 }
+            }
         } else {
             psError( __func__, "Can not merge real and imaginary portions for given image type (%d).",
@@ -298,5 +301,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -307,49 +310,50 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just a image copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                      "Image copy was performed instead." );
-            return psImageCopy( out, in, type );
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                  "Image copy was performed instead." );
+        return psImageCopy( out, in, type );
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psC32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psC32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.C32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psC64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
-                        }
+                outRow = out->data.C64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not compute complex conjugate for given image type (%d).",
@@ -358,5 +362,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -368,58 +372,59 @@
     unsigned int numRows;
     int numElementsSquared;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
     numElementsSquared = numCols * numCols * numRows * numRows;
-    
+
     /* if not a complex number, this is not implemented */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            psF32 real;
-            psF32 imag;
-            
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            real = crealf( inRow[ col ] );
-                            imag = cimagf( inRow[ col ] );
-                            outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+        psF32 real;
+        psF32 imag;
+
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                real = crealf( inRow[ col ] );
+                imag = cimagf( inRow[ col ] );
+                outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
             psF64 real;
             psF64 imag;
-            
-            
+
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            real = crealf( inRow[ col ] );
-                            imag = cimagf( inRow[ col ] );
-                            outRow[ col ] = real * real + imag * imag / numElementsSquared;
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    real = crealf( inRow[ col ] );
+                    imag = cimagf( inRow[ col ] );
+                    outRow[ col ] = real * real + imag * imag / numElementsSquared;
                 }
+            }
         } else {
             psError( __func__, "Can not power spectrum for given image type (%d).",
@@ -428,7 +433,7 @@
             return NULL;
         }
-        
-    return out;
-    
+
+    return out;
+
 }
 
@@ -440,61 +445,61 @@
     psElemType type;
     fftwf_plan plan;
-    
+
     /* got good image data? */
     if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
-    type = in->type.type;
-    
+        psFree( out );
+        return NULL;
+    }
+
+    type = in->type.type;
+
     if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-            psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     if ( ( type != PS_TYPE_C32 ) && ( direction == PS_FFT_REVERSE ) ) {
-            psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-            
-        }
-        
+        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+
+    }
+
     if ( ( type != PS_TYPE_F32 ) && ( direction == PS_FFT_FORWARD ) ) {
-            psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     /* make sure the system-level wisdom information is imported. */
     if ( ! p_fftwWisdomImported ) {
-            fftwf_import_system_wisdom();
-            p_fftwWisdomImported = true;
-        }
-        
+        fftwf_import_system_wisdom();
+        p_fftwWisdomImported = true;
+    }
+
     numElements = in->n;
-    
+
     out = psVectorRecycle( out, PS_TYPE_C32, numElements );
     out->n = numElements;
-    
+
     if ( type == PS_TYPE_F32 ) {
-            // need to convert to complex
-            psC32 * outVec = out->data.C32;
-            psF32* inVec = in->data.F32;
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = inVec[ i ];
-                }
-        } else {
-            psC32* outVec = out->data.C32;
-            psC32* inVec = in->data.C32;
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = inVec[ i ];
-                }
-        }
-        
+        // need to convert to complex
+        psC32 * outVec = out->data.C32;
+        psF32* inVec = in->data.F32;
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = inVec[ i ];
+        }
+    } else {
+        psC32* outVec = out->data.C32;
+        psC32* inVec = in->data.C32;
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = inVec[ i ];
+        }
+    }
+
     plan = fftwf_plan_dft_1d( numElements,
                               ( fftwf_complex* ) out->data.C32,
@@ -502,17 +507,17 @@
                               direction,
                               P_FFTW_PLAN_RIGOR );
-                              
+
     /* check if a plan exists now*/
     if ( plan == NULL ) {
-            psError( __func__, "Failed to create FFTW plan." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Failed to create FFTW plan." );
+        psFree( out );
+        return NULL;
+    }
+
     /* finally, call FFTW with the plan made above */
     fftwf_execute( plan );
-    
+
     fftwf_destroy_plan( plan );
-    
+
     return out;
 }
@@ -523,42 +528,42 @@
     psElemType type;
     unsigned int numElements;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just a copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                      "Just a vector copy was performed." );
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                  "Just a vector copy was performed." );
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, numElements );
-            out->n = numElements;
-            outVec = out->data.F32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = crealf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not extract real component from given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, numElements );
+        out->n = numElements;
+        outVec = out->data.F32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = crealf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not extract real component from given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -568,43 +573,43 @@
     psElemType type;
     unsigned int numElements;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just zeroed image of same size */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                      "A zeroed vector was returned." );
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                  "A zeroed vector was returned." );
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, numElements );
-            out->n = numElements;
-            outVec = out->data.F32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = cimagf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not extract imaginary component from given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, numElements );
+        out->n = numElements;
+        outVec = out->data.F32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = cimagf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not extract imaginary component from given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -614,49 +619,49 @@
     psElemType type;
     unsigned int numElements;
-    
-    
+
+
     if ( real == NULL || imag == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+        psFree( out );
+        return NULL;
+    }
+
     type = real->type.type;
     if ( real->n < imag->n ) {
-            numElements = real->n;
-        } else {
-            numElements = imag->n;
-        }
-        
+        numElements = real->n;
+    } else {
+        numElements = imag->n;
+    }
+
     if ( imag->type.type != type ) {
-            psError( __func__, "The inputs to psVectorComplex must be the same type." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psVectorComplex must be the same type." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "The inputs to psVectorComplex can not be complex." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psVectorComplex can not be complex." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_F32 ) {
-            psC32 * outVec;
-            psF32* realVec = real->data.F32;
-            psF32* imagVec = imag->data.F32;
-            
-            out = psVectorRecycle( out, PS_TYPE_C32, numElements );
-            out->n = numElements;
-            outVec = out->data.C32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
-                }
-        } else {
-            psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psC32 * outVec;
+        psF32* realVec = real->data.F32;
+        psF32* imagVec = imag->data.F32;
+
+        out = psVectorRecycle( out, PS_TYPE_C32, numElements );
+        out->n = numElements;
+        outVec = out->data.C32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
+        }
+    } else {
+        psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -666,44 +671,44 @@
     psElemType type;
     unsigned int numElements;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just a image copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                      "Vector copy was performed instead." );
-                      
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                  "Vector copy was performed instead." );
+
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psC32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_C32, numElements );
-            out->n = numElements;
-            outVec = out->data.C32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psC32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_C32, numElements );
+        out->n = numElements;
+        outVec = out->data.C32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -716,10 +721,10 @@
     unsigned int inHalfNumElements;
     unsigned int inNumElementsSquared;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     inNumElements = in->n;
@@ -727,44 +732,44 @@
     inHalfNumElements = inNumElements / 2;
     outNumElements = inHalfNumElements + 1;
-    
+
     /* if not a complex number, this is not implemented */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            psF32 inAbs1;
-            psF32 inAbs2;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, outNumElements );
-            out->n = outNumElements;
-            outVec = out->data.F32;
-            
-            // from ADD: P_0 = |C_0|^2/N^2
-            inAbs1 = cabsf( inVec[ 0 ] );
-            outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
-            
-            // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
-            for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
-                    inAbs1 = cabsf( inVec[ i ] );
-                    inAbs2 = cabsf( inVec[ inNumElements - i ] );
-                    outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
-                }
-                
-            // from ADD: P_N/2 = |C_N/2|^2/N^2
-            inAbs1 = cabsf( inVec[ inHalfNumElements ] );
-            outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
-        } else {
-            psError( __func__, "Can not power spectrum for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
-    return out;
-    
-}
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+        psF32 inAbs1;
+        psF32 inAbs2;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, outNumElements );
+        out->n = outNumElements;
+        outVec = out->data.F32;
+
+        // from ADD: P_0 = |C_0|^2/N^2
+        inAbs1 = cabsf( inVec[ 0 ] );
+        outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
+
+        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
+        for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
+            inAbs1 = cabsf( inVec[ i ] );
+            inAbs2 = cabsf( inVec[ inNumElements - i ] );
+            outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
+        }
+
+        // from ADD: P_N/2 = |C_N/2|^2/N^2
+        inAbs1 = cabsf( inVec[ inHalfNumElements ] );
+        outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
+    } else {
+        psError( __func__, "Can not power spectrum for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
+    return out;
+
+}
Index: /trunk/psLib/src/dataManip/psVectorFFT.h
===================================================================
--- /trunk/psLib/src/dataManip/psVectorFFT.h	(revision 1384)
+++ /trunk/psLib/src/dataManip/psVectorFFT.h	(revision 1385)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/fft/psVectorFFT.c
===================================================================
--- /trunk/psLib/src/fft/psVectorFFT.c	(revision 1384)
+++ /trunk/psLib/src/fft/psVectorFFT.c	(revision 1385)
@@ -5,6 +5,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-02 19:43:59 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,46 +33,46 @@
     psElemType type;
     fftwf_plan plan;
-    
+
     /* got good image data? */
     if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
-    type = in->type.type;
-    
+        psFree( out );
+        return NULL;
+    }
+
+    type = in->type.type;
+
     if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-            psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type != PS_TYPE_C32 && direction == PS_FFT_REVERSE ) {
-            psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-            
-        }
-        
+        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+
+    }
+
     if ( type != PS_TYPE_F32 && direction == PS_FFT_FORWARD ) {
-            psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     /* make sure the system-level wisdom information is imported. */
     if ( ! p_fftwWisdomImported ) {
-            fftwf_import_system_wisdom();
-            p_fftwWisdomImported = true;
-        }
-        
+        fftwf_import_system_wisdom();
+        p_fftwWisdomImported = true;
+    }
+
     numRows = in->numRows;
     numCols = in->numCols;
-    
+
     out = psImageCopy( out, in, PS_TYPE_C32 );
-    
+
     plan = fftwf_plan_dft_2d( numCols, numRows,
                               ( fftwf_complex* ) out->data.C32[ 0 ],
@@ -80,19 +80,19 @@
                               direction,
                               P_FFTW_PLAN_RIGOR );
-                              
+
     /* check if a plan exists now*/
     if ( plan == NULL ) {
-            psError( __func__, "Failed to create FFTW plan." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Failed to create FFTW plan." );
+        psFree( out );
+        return NULL;
+    }
+
     /* finally, call FFTW with the plan made above */
     fftwf_execute( plan );
-    
+
     fftwf_destroy_plan( plan );
-    
-    return out;
-    
+
+    return out;
+
 }
 
@@ -103,49 +103,50 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just a copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                      "Just an image copy was performed." );
-            return psImageCopy( out, in, type );
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                  "Just an image copy was performed." );
+        return psImageCopy( out, in, type );
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = crealf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = crealf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = creal( inRow[ col ] );
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = creal( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not extract real component from given image type (%d).",
@@ -154,5 +155,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -163,51 +164,52 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just zeroed image of same size */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                      "A zero image was returned." );
-            out = psImageRecycle( out, numCols, numRows, type );
-            memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                  "A zero image was returned." );
+        out = psImageRecycle( out, numCols, numRows, type );
+        memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = cimagf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = cimagf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = cimag( inRow[ col ] );
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = cimag( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not extract imaginary component from given image type (%d).",
@@ -216,5 +218,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -225,71 +227,72 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
+
+
     if ( real == NULL || imag == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+        psFree( out );
+        return NULL;
+    }
+
     type = real->type.type;
     numCols = real->numCols;
     numRows = real->numRows;
-    
+
     if ( imag->type.type != type ) {
-            psError( __func__, "The inputs to psImageComplex must be the same type." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex must be the same type." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( imag->numCols != numCols ||
             imag->numRows != numRows ) {
-            psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "The inputs to psImageComplex can not be complex." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psImageComplex can not be complex." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type != PS_TYPE_F32 && type != PS_TYPE_F64 ) {
-            psError( __func__, "The input type to psImageComplex must be a floating point." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The input type to psImageComplex must be a floating point." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_F32 ) {
-            psC32 * outRow;
-            psF32* realRow;
-            psF32* imagRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-            
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C32[ row ];
-                    realRow = real->data.F32[ row ];
-                    imagRow = imag->data.F32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                        }
-                }
-        } else if ( type == PS_TYPE_F64 ) {
+        psC32 * outRow;
+        psF32* realRow;
+        psF32* imagRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
+
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.C32[ row ];
+            realRow = real->data.F32[ row ];
+            imagRow = imag->data.F32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
+            }
+        }
+    } else
+        if ( type == PS_TYPE_F64 ) {
             psC64 * outRow;
             psF64* realRow;
             psF64* imagRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C64[ row ];
-                    realRow = real->data.F64[ row ];
-                    imagRow = imag->data.F64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                        }
+                outRow = out->data.C64[ row ];
+                realRow = real->data.F64[ row ];
+                imagRow = imag->data.F64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
                 }
+            }
         } else {
             psError( __func__, "Can not merge real and imaginary portions for given image type (%d).",
@@ -298,5 +301,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -307,49 +310,50 @@
     unsigned int numCols;
     unsigned int numRows;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
-    
+
     /* if not a complex number, this is logically just a image copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                      "Image copy was performed instead." );
-            return psImageCopy( out, in, type );
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                  "Image copy was performed instead." );
+        return psImageCopy( out, in, type );
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psC32 * outRow;
-            psC32* inRow;
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psC32 * outRow;
+        psC32* inRow;
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.C32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psC64 * outRow;
             psC64* inRow;
-            
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.C64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
-                        }
+                outRow = out->data.C64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
                 }
+            }
         } else {
             psError( __func__, "Can not compute complex conjugate for given image type (%d).",
@@ -358,5 +362,5 @@
             return NULL;
         }
-        
+
     return out;
 }
@@ -368,58 +372,59 @@
     unsigned int numRows;
     int numElementsSquared;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numCols = in->numCols;
     numRows = in->numRows;
     numElementsSquared = numCols * numCols * numRows * numRows;
-    
+
     /* if not a complex number, this is not implemented */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outRow;
-            psC32* inRow;
-            psF32 real;
-            psF32 imag;
-            
-            
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F32[ row ];
-                    inRow = in->data.C32[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            real = crealf( inRow[ col ] );
-                            imag = cimagf( inRow[ col ] );
-                            outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
-                        }
-                }
-        } else if ( type == PS_TYPE_C64 ) {
+        psF32 * outRow;
+        psC32* inRow;
+        psF32 real;
+        psF32 imag;
+
+
+        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
+        for ( unsigned int row = 0;row < numRows;row++ ) {
+            outRow = out->data.F32[ row ];
+            inRow = in->data.C32[ row ];
+
+            for ( unsigned int col = 0;col < numCols;col++ ) {
+                real = crealf( inRow[ col ] );
+                imag = cimagf( inRow[ col ] );
+                outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
+            }
+        }
+    } else
+        if ( type == PS_TYPE_C64 ) {
             psF64 * outRow;
             psC64* inRow;
             psF64 real;
             psF64 imag;
-            
-            
+
+
             out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
             for ( unsigned int row = 0;row < numRows;row++ ) {
-                    outRow = out->data.F64[ row ];
-                    inRow = in->data.C64[ row ];
-                    
-                    for ( unsigned int col = 0;col < numCols;col++ ) {
-                            real = crealf( inRow[ col ] );
-                            imag = cimagf( inRow[ col ] );
-                            outRow[ col ] = real * real + imag * imag / numElementsSquared;
-                        }
+                outRow = out->data.F64[ row ];
+                inRow = in->data.C64[ row ];
+
+                for ( unsigned int col = 0;col < numCols;col++ ) {
+                    real = crealf( inRow[ col ] );
+                    imag = cimagf( inRow[ col ] );
+                    outRow[ col ] = real * real + imag * imag / numElementsSquared;
                 }
+            }
         } else {
             psError( __func__, "Can not power spectrum for given image type (%d).",
@@ -428,7 +433,7 @@
             return NULL;
         }
-        
-    return out;
-    
+
+    return out;
+
 }
 
@@ -440,61 +445,61 @@
     psElemType type;
     fftwf_plan plan;
-    
+
     /* got good image data? */
     if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
-    type = in->type.type;
-    
+        psFree( out );
+        return NULL;
+    }
+
+    type = in->type.type;
+
     if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-            psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     if ( ( type != PS_TYPE_C32 ) && ( direction == PS_FFT_REVERSE ) ) {
-            psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-            
-        }
-        
+        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+
+    }
+
     if ( ( type != PS_TYPE_F32 ) && ( direction == PS_FFT_FORWARD ) ) {
-            psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     /* make sure the system-level wisdom information is imported. */
     if ( ! p_fftwWisdomImported ) {
-            fftwf_import_system_wisdom();
-            p_fftwWisdomImported = true;
-        }
-        
+        fftwf_import_system_wisdom();
+        p_fftwWisdomImported = true;
+    }
+
     numElements = in->n;
-    
+
     out = psVectorRecycle( out, PS_TYPE_C32, numElements );
     out->n = numElements;
-    
+
     if ( type == PS_TYPE_F32 ) {
-            // need to convert to complex
-            psC32 * outVec = out->data.C32;
-            psF32* inVec = in->data.F32;
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = inVec[ i ];
-                }
-        } else {
-            psC32* outVec = out->data.C32;
-            psC32* inVec = in->data.C32;
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = inVec[ i ];
-                }
-        }
-        
+        // need to convert to complex
+        psC32 * outVec = out->data.C32;
+        psF32* inVec = in->data.F32;
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = inVec[ i ];
+        }
+    } else {
+        psC32* outVec = out->data.C32;
+        psC32* inVec = in->data.C32;
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = inVec[ i ];
+        }
+    }
+
     plan = fftwf_plan_dft_1d( numElements,
                               ( fftwf_complex* ) out->data.C32,
@@ -502,17 +507,17 @@
                               direction,
                               P_FFTW_PLAN_RIGOR );
-                              
+
     /* check if a plan exists now*/
     if ( plan == NULL ) {
-            psError( __func__, "Failed to create FFTW plan." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Failed to create FFTW plan." );
+        psFree( out );
+        return NULL;
+    }
+
     /* finally, call FFTW with the plan made above */
     fftwf_execute( plan );
-    
+
     fftwf_destroy_plan( plan );
-    
+
     return out;
 }
@@ -523,42 +528,42 @@
     psElemType type;
     unsigned int numElements;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just a copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                      "Just a vector copy was performed." );
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                  "Just a vector copy was performed." );
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, numElements );
-            out->n = numElements;
-            outVec = out->data.F32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = crealf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not extract real component from given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, numElements );
+        out->n = numElements;
+        outVec = out->data.F32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = crealf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not extract real component from given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -568,43 +573,43 @@
     psElemType type;
     unsigned int numElements;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just zeroed image of same size */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                      "A zeroed vector was returned." );
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                  "A zeroed vector was returned." );
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, numElements );
-            out->n = numElements;
-            outVec = out->data.F32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = cimagf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not extract imaginary component from given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, numElements );
+        out->n = numElements;
+        outVec = out->data.F32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = cimagf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not extract imaginary component from given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -614,49 +619,49 @@
     psElemType type;
     unsigned int numElements;
-    
-    
+
+
     if ( real == NULL || imag == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+        psFree( out );
+        return NULL;
+    }
+
     type = real->type.type;
     if ( real->n < imag->n ) {
-            numElements = real->n;
-        } else {
-            numElements = imag->n;
-        }
-        
+        numElements = real->n;
+    } else {
+        numElements = imag->n;
+    }
+
     if ( imag->type.type != type ) {
-            psError( __func__, "The inputs to psVectorComplex must be the same type." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psVectorComplex must be the same type." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "The inputs to psVectorComplex can not be complex." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The inputs to psVectorComplex can not be complex." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_F32 ) {
-            psC32 * outVec;
-            psF32* realVec = real->data.F32;
-            psF32* imagVec = imag->data.F32;
-            
-            out = psVectorRecycle( out, PS_TYPE_C32, numElements );
-            out->n = numElements;
-            outVec = out->data.C32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
-                }
-        } else {
-            psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psC32 * outVec;
+        psF32* realVec = real->data.F32;
+        psF32* imagVec = imag->data.F32;
+
+        out = psVectorRecycle( out, PS_TYPE_C32, numElements );
+        out->n = numElements;
+        outVec = out->data.C32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
+        }
+    } else {
+        psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -666,44 +671,44 @@
     psElemType type;
     unsigned int numElements;
-    
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     numElements = in->n;
-    
+
     /* if not a complex number, this is logically just a image copy */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            // Warn user, as this is probably not expected
-            psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                      "Vector copy was performed instead." );
-                      
-            out = psVectorRecycle( out, type, numElements );
-            out->n = numElements;
-            memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
-            return out;
-        }
-        
+        // Warn user, as this is probably not expected
+        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                  "Vector copy was performed instead." );
+
+        out = psVectorRecycle( out, type, numElements );
+        out->n = numElements;
+        memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
+        return out;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psC32 * outVec;
-            psC32* inVec = in->data.C32;
-            
-            out = psVectorRecycle( out, PS_TYPE_C32, numElements );
-            out->n = numElements;
-            outVec = out->data.C32;
-            
-            for ( unsigned int i = 0;i < numElements;i++ ) {
-                    outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
-                }
-        } else {
-            psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
+        psC32 * outVec;
+        psC32* inVec = in->data.C32;
+
+        out = psVectorRecycle( out, PS_TYPE_C32, numElements );
+        out->n = numElements;
+        outVec = out->data.C32;
+
+        for ( unsigned int i = 0;i < numElements;i++ ) {
+            outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
+        }
+    } else {
+        psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
     return out;
 }
@@ -716,10 +721,10 @@
     unsigned int inHalfNumElements;
     unsigned int inNumElementsSquared;
-    
-    if ( in == NULL ) {
-            psFree( out );
-            return NULL;
-        }
-        
+
+    if ( in == NULL ) {
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     inNumElements = in->n;
@@ -727,44 +732,44 @@
     inHalfNumElements = inNumElements / 2;
     outNumElements = inHalfNumElements + 1;
-    
+
     /* if not a complex number, this is not implemented */
     if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-            psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( type == PS_TYPE_C32 ) {
-            psF32 * outVec;
-            psC32* inVec = in->data.C32;
-            psF32 inAbs1;
-            psF32 inAbs2;
-            
-            out = psVectorRecycle( out, PS_TYPE_F32, outNumElements );
-            out->n = outNumElements;
-            outVec = out->data.F32;
-            
-            // from ADD: P_0 = |C_0|^2/N^2
-            inAbs1 = cabsf( inVec[ 0 ] );
-            outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
-            
-            // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
-            for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
-                    inAbs1 = cabsf( inVec[ i ] );
-                    inAbs2 = cabsf( inVec[ inNumElements - i ] );
-                    outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
-                }
-                
-            // from ADD: P_N/2 = |C_N/2|^2/N^2
-            inAbs1 = cabsf( inVec[ inHalfNumElements ] );
-            outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
-        } else {
-            psError( __func__, "Can not power spectrum for given vector type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-        
-    return out;
-    
-}
+        psF32 * outVec;
+        psC32* inVec = in->data.C32;
+        psF32 inAbs1;
+        psF32 inAbs2;
+
+        out = psVectorRecycle( out, PS_TYPE_F32, outNumElements );
+        out->n = outNumElements;
+        outVec = out->data.F32;
+
+        // from ADD: P_0 = |C_0|^2/N^2
+        inAbs1 = cabsf( inVec[ 0 ] );
+        outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
+
+        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
+        for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
+            inAbs1 = cabsf( inVec[ i ] );
+            inAbs2 = cabsf( inVec[ inNumElements - i ] );
+            outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
+        }
+
+        // from ADD: P_N/2 = |C_N/2|^2/N^2
+        inAbs1 = cabsf( inVec[ inHalfNumElements ] );
+        outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
+    } else {
+        psError( __func__, "Can not power spectrum for given vector type (%d).",
+                 type );
+        psFree( out );
+        return NULL;
+    }
+
+    return out;
+
+}
Index: /trunk/psLib/src/fft/psVectorFFT.h
===================================================================
--- /trunk/psLib/src/fft/psVectorFFT.h	(revision 1384)
+++ /trunk/psLib/src/fft/psVectorFFT.h	(revision 1385)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/image/psImage.c
===================================================================
--- /trunk/psLib/src/image/psImage.c	(revision 1384)
+++ /trunk/psLib/src/image/psImage.c	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 20:42:22 $
+ *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/image/psImage.h
===================================================================
--- /trunk/psLib/src/image/psImage.h	(revision 1384)
+++ /trunk/psLib/src/image/psImage.h	(revision 1385)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 20:42:22 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/image/psImageExtraction.c
===================================================================
--- /trunk/psLib/src/image/psImageExtraction.c	(revision 1384)
+++ /trunk/psLib/src/image/psImageExtraction.c	(revision 1385)
@@ -9,6 +9,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 00:55:17 $
+*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -29,45 +29,45 @@
     unsigned int outputRowSize;         // output row size in bytes
     unsigned int inputColOffset;        // offset in bytes to first subset pixel in input row
-    
+
     if ( image == NULL || image->data.V == NULL ) {
-            psError( __func__, "Can not subset image because input image or its pixel buffer is NULL." );
-            return NULL;
-        }
-        
+        psError( __func__, "Can not subset image because input image or its pixel buffer is NULL." );
+        return NULL;
+    }
+
     if ( image->type.dimen != PS_DIMEN_IMAGE ) {
-            psError( __func__, "Can not subset image because input image is not an image." );
-            return NULL;
-        }
-        
+        psError( __func__, "Can not subset image because input image is not an image." );
+        return NULL;
+    }
+
     if ( numCols < 1 || numRows < 1 ) {
-            psError( __func__, "Can not subset image because number of rows or columns are zero (%dx%d).",
-                     numCols, numRows );
-            return NULL;
-        }
-        
+        psError( __func__, "Can not subset image because number of rows or columns are zero (%dx%d).",
+                 numCols, numRows );
+        return NULL;
+    }
+
     if ( col0 >= image->numCols || row0 >= image->numRows ) {
-            psError( __func__, "Can not subset image because col0,row0 (%d,%d) is not a valid pixel location.",
-                     col0, row0 );
-            return NULL;
-        }
-        
+        psError( __func__, "Can not subset image because col0,row0 (%d,%d) is not a valid pixel location.",
+                 col0, row0 );
+        return NULL;
+    }
+
     /* validate subimage size */
     if ( col0 + numCols >= image->numCols || row0 + numRows >= image->numRows ) {
-            psError( __func__, "Can not subset image outside of image boundaries (size=%dx%d, "
-                     "subset=[%d:%d,%d:%d]).", image->numCols, image->numRows, col0,
-                     col0 + numCols, row0, row0 + numRows );
-            return NULL;
-        }
-        
-        
+        psError( __func__, "Can not subset image outside of image boundaries (size=%dx%d, "
+                 "subset=[%d:%d,%d:%d]).", image->numCols, image->numRows, col0,
+                 col0 + numCols, row0, row0 + numRows );
+        return NULL;
+    }
+
+
     elementSize = PSELEMTYPE_SIZEOF( image->type.type );
-    
+
     out = psImageRecycle( out, numCols, numRows, image->type.type );
-    
+
     // set the parent information into the child output image
     *( int* ) & out->row0 = row0;
     *( int* ) & out->col0 = col0;
     *( psImage** ) & out->parent = ( psImage* ) image;
-    
+
     // add output image as a child of the input image.
     image->nChildren++;
@@ -75,13 +75,13 @@
                       image->nChildren * sizeof( psImage* ) );
     image->children[ image->nChildren - 1 ] = out;
-    
+
     inputColOffset = elementSize * col0;
     outputRowSize = elementSize * numCols;
-    
+
     for ( int row = 0; row < numRows; row++ ) {
-            memcpy( out->data.V[ row ], image->data.U8[ row0 + row ] + inputColOffset,
-                    outputRowSize );
-        }
-        
+        memcpy( out->data.V[ row ], image->data.U8[ row0 + row ] + inputColOffset,
+                outputRowSize );
+    }
+
     return ( out );
 }
@@ -96,24 +96,24 @@
     int numRows;
     int numCols;
-    
+
     if ( input == NULL || input->data.V == NULL ) {
-            psError( __func__, "Can not copy image because input image or its pixel buffer is NULL." );
-            psFree( output );
-            return NULL;
-        }
-        
+        psError( __func__, "Can not copy image because input image or its pixel buffer is NULL." );
+        psFree( output );
+        return NULL;
+    }
+
     if ( input == output ) {
-            psError( __func__, "Can not copy image because given input and output "
-                     "parameter reference the same psImage struct." );
-            psFree( output );
-            return NULL;
-        }
-        
+        psError( __func__, "Can not copy image because given input and output "
+                 "parameter reference the same psImage struct." );
+        psFree( output );
+        return NULL;
+    }
+
     if ( input->type.dimen != PS_DIMEN_IMAGE ) {
-            psError( __func__, "Can not copy image because input image is not actually an image." );
-            psFree( output );
-            return NULL;
-        }
-        
+        psError( __func__, "Can not copy image because input image is not actually an image." );
+        psFree( output );
+        return NULL;
+    }
+
     inDatatype = input->type.type;
     numRows = input->numRows;
@@ -121,109 +121,109 @@
     elements = numRows * numCols;
     elementSize = PSELEMTYPE_SIZEOF( inDatatype );
-    
+
     if ( inDatatype == PS_TYPE_PTR || type == PS_TYPE_PTR ) {
-            psError( __func__, "Can not copy image to/from a void* matrix" );
-            psFree( output );
-            return NULL;
-        }
-        
+        psError( __func__, "Can not copy image to/from a void* matrix" );
+        psFree( output );
+        return NULL;
+    }
+
     output = psImageRecycle( output, numCols, numRows, type );
-    
+
     // cover the trival case of copy of the same datatype.
     if ( type == inDatatype ) {
-            memcpy( output->data.V[ 0 ], input->data.V[ 0 ], elementSize * elements );
-            return output;
-        }
-        
+        memcpy( output->data.V[ 0 ], input->data.V[ 0 ], elementSize * elements );
+        return output;
+    }
+
     #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
         ps##INTYPE *in = IN->data.INTYPE[0]; \
         ps##OUTTYPE *out = OUT->data.OUTTYPE[0]; \
         for (int e=0;e<ELEMENTS;e++) { \
-                *(out++) = *(in++); \
-            } \
-    }
-    
+            *(out++) = *(in++); \
+        } \
+    }
+
     #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) \
     switch (inDatatype) { \
-            case PS_TYPE_S8: \
-            PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_S16: \
-            PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_S32: \
-            PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_S64: \
-            PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_U8: \
-            PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_U16: \
-            PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_U32: \
-            PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_U64: \
-            PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_F32: \
-            PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_F64: \
-            PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_C32: \
-            PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
-            break; \
-            case PS_TYPE_C64: \
-            PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
-            break; \
-            default: \
-            break; \
-        }
-        
+    case PS_TYPE_S8: \
+        PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_S16: \
+        PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_S32: \
+        PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_S64: \
+        PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_U8: \
+        PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_U16: \
+        PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_U32: \
+        PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_U64: \
+        PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_F32: \
+        PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_F64: \
+        PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_C32: \
+        PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
+        break; \
+    case PS_TYPE_C64: \
+        PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
+        break; \
+    default: \
+        break; \
+    }
+
     switch ( type ) {
-            case PS_TYPE_S8:
-            PSIMAGE_COPY_CASE( output, S8 );
-            break;
-            case PS_TYPE_S16:
-            PSIMAGE_COPY_CASE( output, S16 );
-            break;
-            case PS_TYPE_S32:
-            PSIMAGE_COPY_CASE( output, S32 );
-            break;
-            case PS_TYPE_S64:
-            PSIMAGE_COPY_CASE( output, S64 );
-            break;
-            case PS_TYPE_U8:
-            PSIMAGE_COPY_CASE( output, U8 );
-            break;
-            case PS_TYPE_U16:
-            PSIMAGE_COPY_CASE( output, U16 );
-            break;
-            case PS_TYPE_U32:
-            PSIMAGE_COPY_CASE( output, U32 );
-            break;
-            case PS_TYPE_U64:
-            PSIMAGE_COPY_CASE( output, U64 );
-            break;
-            case PS_TYPE_F32:
-            PSIMAGE_COPY_CASE( output, F32 );
-            break;
-            case PS_TYPE_F64:
-            PSIMAGE_COPY_CASE( output, F64 );
-            break;
-            case PS_TYPE_C32:
-            PSIMAGE_COPY_CASE( output, C32 );
-            break;
-            case PS_TYPE_C64:
-            PSIMAGE_COPY_CASE( output, C64 );
-            break;
-            default:
-            break;
-        }
+    case PS_TYPE_S8:
+        PSIMAGE_COPY_CASE( output, S8 );
+        break;
+    case PS_TYPE_S16:
+        PSIMAGE_COPY_CASE( output, S16 );
+        break;
+    case PS_TYPE_S32:
+        PSIMAGE_COPY_CASE( output, S32 );
+        break;
+    case PS_TYPE_S64:
+        PSIMAGE_COPY_CASE( output, S64 );
+        break;
+    case PS_TYPE_U8:
+        PSIMAGE_COPY_CASE( output, U8 );
+        break;
+    case PS_TYPE_U16:
+        PSIMAGE_COPY_CASE( output, U16 );
+        break;
+    case PS_TYPE_U32:
+        PSIMAGE_COPY_CASE( output, U32 );
+        break;
+    case PS_TYPE_U64:
+        PSIMAGE_COPY_CASE( output, U64 );
+        break;
+    case PS_TYPE_F32:
+        PSIMAGE_COPY_CASE( output, F32 );
+        break;
+    case PS_TYPE_F64:
+        PSIMAGE_COPY_CASE( output, F64 );
+        break;
+    case PS_TYPE_C32:
+        PSIMAGE_COPY_CASE( output, C32 );
+        break;
+    case PS_TYPE_C64:
+        PSIMAGE_COPY_CASE( output, C64 );
+        break;
+    default:
+        break;
+    }
     return output;
 }
@@ -247,142 +247,143 @@
     int delta = 1;
     psF64* outData;
-    
+
     if ( in == NULL || in->data.V == NULL ) {
-            psError( __func__, "Input image can not be NULL." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "Input image can not be NULL." );
+        psFree( out );
+        return NULL;
+    }
+
     if ( numRows == 0 || numCols == 0 ) {
-            psError( __func__, "The specified region contains no data (%dx%d)",
-                     numCols, numRows );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The specified region contains no data (%dx%d)",
+                 numCols, numRows );
+        psFree( out );
+        return NULL;
+    }
+
     type = in->type.type;
     inRows = in->numRows;
     inCols = in->numCols;
-    
+
     if ( direction == PS_CUT_X_NEG || direction == PS_CUT_Y_NEG ) {
-            delta = -1;
-        }
-        
+        delta = -1;
+    }
+
     // if numRows/numCols is negative, invert the problem to give positive
     // numRows/numCols (and cut in opposite direction).
     if ( numRows < 0 ) {
-            numRows = -numRows;
-            row -= ( numRows - 1 );
-            delta = -delta;
-        }
-        
+        numRows = -numRows;
+        row -= ( numRows - 1 );
+        delta = -delta;
+    }
+
     if ( numCols < 0 ) {
-            numCols = -numCols;
-            col -= ( numCols - 1 );
-            delta = -delta;
-        }
-        
+        numCols = -numCols;
+        col -= ( numCols - 1 );
+        delta = -delta;
+    }
+
     if ( mask != NULL ) {
-            if ( inRows != mask->numRows || inCols != mask->numCols ) {
-                    psError( __func__, "The mask and image dimensions did not match (%dx%d vs %dx%d)",
-                             mask->numCols, mask->numRows, in->numCols, in->numRows );
-                    psFree( out );
-                }
-            if ( mask->type.type != PS_TYPE_MASK ) {
-                    psError( __func__, "The mask datatype (%d) must be %s.",
-                             mask->type.type, PS_TYPE_MASK_NAME );
-                    psFree( out );
-                }
-        }
-        
+        if ( inRows != mask->numRows || inCols != mask->numCols ) {
+            psError( __func__, "The mask and image dimensions did not match (%dx%d vs %dx%d)",
+                     mask->numCols, mask->numRows, in->numCols, in->numRows );
+            psFree( out );
+        }
+        if ( mask->type.type != PS_TYPE_MASK ) {
+            psError( __func__, "The mask datatype (%d) must be %s.",
+                     mask->type.type, PS_TYPE_MASK_NAME );
+            psFree( out );
+        }
+    }
+
     if ( row >= inRows || col >= inCols ||
             col + numCols > in->numCols || row + numRows > in->numRows ) {
-            psError( __func__, "The specified image region (%d,%d to %d,%d) is outside of image area (0,0 to %d,%d).",
-                     col, row, col + numCols - 1, row + numRows - 1, in->numCols - 1, in->numRows - 1 );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The specified image region (%d,%d to %d,%d) is outside of image area (0,0 to %d,%d).",
+                 col, row, col + numCols - 1, row + numRows - 1, in->numCols - 1, in->numRows - 1 );
+        psFree( out );
+        return NULL;
+    }
+
     // verify that the stats struct specifies a single stats operation
     if ( stats == NULL || p_psGetStatValue( stats, &statVal ) == false ) {
-            psError( __func__, "The stat options didn't specify a single supported statistic type." );
-            psFree( out );
-            return NULL;
-        }
-        
+        psError( __func__, "The stat options didn't specify a single supported statistic type." );
+        psFree( out );
+        return NULL;
+    }
+
     // since stats input is const, I need to create a 'scratch' stats struct
     myStats = psAlloc( sizeof( psStats ) );
     *myStats = *stats;
-    
-    
-    
+
+
+
     if ( direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG ) {
-            psVector * imgVec = psVectorAlloc( numRows, type );
-            psVector* maskVec = NULL;
-            psMaskType* maskData = NULL;
-            
-            // recycle output to make a proper sized/type output structure
-            // n.b. type is double as that is the type given for all stats in psStats.
-            out = psVectorRecycle( out, PS_TYPE_F64, numCols );
-            outData = out->data.F64;
-            if ( delta < 0 ) {
-                    outData += numCols - 1;
-                }
-                
-            if ( mask != NULL ) {
-                    maskVec = psVectorAlloc( numRows, mask->type.type );
-                }
-                
-            #define PSIMAGE_CUT_VERTICAL(TYPE) \
-            case PS_TYPE_##TYPE: { \
-                psMaskType* maskVecData = NULL; \
-                for (int c=0;c<numCols;c++) { \
-                        ps##TYPE *imgData = in->data.TYPE[row] + col + c; \
-                        ps##TYPE *imgVecData = imgVec->data.TYPE; \
-                        if (maskVec != NULL) { \
-                                maskVecData = maskVec->data.V; \
-                                maskData = (psMaskType*)(mask->data.V[row]) + col + c; \
-                            } \
-                        for (int r=0;r<numRows;r++) { \
-                                *(imgVecData++) = *imgData; \
-                                imgData += inCols; \
-                                if (maskVecData != NULL) { \
-                                        *(maskVecData++) = *maskData; \
-                                        maskData += inCols; \
-                                    } \
-                            } \
-                        myStats = psVectorStats(myStats,imgVec,maskVec,maskVal); \
-                        (void)p_psGetStatValue(myStats,&statVal); \
-                        *outData = statVal; \
-                        outData += delta; \
+        psVector * imgVec = psVectorAlloc( numRows, type );
+        psVector* maskVec = NULL;
+        psMaskType* maskData = NULL;
+
+        // recycle output to make a proper sized/type output structure
+        // n.b. type is double as that is the type given for all stats in psStats.
+        out = psVectorRecycle( out, PS_TYPE_F64, numCols );
+        outData = out->data.F64;
+        if ( delta < 0 ) {
+            outData += numCols - 1;
+        }
+
+        if ( mask != NULL ) {
+            maskVec = psVectorAlloc( numRows, mask->type.type );
+        }
+
+        #define PSIMAGE_CUT_VERTICAL(TYPE) \
+    case PS_TYPE_##TYPE: { \
+            psMaskType* maskVecData = NULL; \
+            for (int c=0;c<numCols;c++) { \
+                ps##TYPE *imgData = in->data.TYPE[row] + col + c; \
+                ps##TYPE *imgVecData = imgVec->data.TYPE; \
+                if (maskVec != NULL) { \
+                    maskVecData = maskVec->data.V; \
+                    maskData = (psMaskType*)(mask->data.V[row]) + col + c; \
+                } \
+                for (int r=0;r<numRows;r++) { \
+                    *(imgVecData++) = *imgData; \
+                    imgData += inCols; \
+                    if (maskVecData != NULL) { \
+                        *(maskVecData++) = *maskData; \
+                        maskData += inCols; \
                     } \
-                break; \
-            }
-            
-            switch ( type ) {
-                    PSIMAGE_CUT_VERTICAL( U8 );
-                    PSIMAGE_CUT_VERTICAL( U16 );
-                    PSIMAGE_CUT_VERTICAL( U32 );
-                    PSIMAGE_CUT_VERTICAL( U64 );
-                    PSIMAGE_CUT_VERTICAL( S8 );
-                    PSIMAGE_CUT_VERTICAL( S16 );
-                    PSIMAGE_CUT_VERTICAL( S32 );
-                    PSIMAGE_CUT_VERTICAL( S64 );
-                    PSIMAGE_CUT_VERTICAL( F32 );
-                    PSIMAGE_CUT_VERTICAL( F64 );
-                    PSIMAGE_CUT_VERTICAL( C32 );
-                    PSIMAGE_CUT_VERTICAL( C64 );
-                    default:
-                    psError( __func__, "Unsupported datatype (%d)", type );
-                    psFree( out );
-                    out = NULL;
-                }
-            psFree( imgVec );
-            psFree( maskVec );
-        } else if ( direction == PS_CUT_Y_POS || direction == PS_CUT_Y_NEG ) { // Cut in Y direction
+                } \
+                myStats = psVectorStats(myStats,imgVec,maskVec,maskVal); \
+                (void)p_psGetStatValue(myStats,&statVal); \
+                *outData = statVal; \
+                outData += delta; \
+            } \
+            break; \
+        }
+
+        switch ( type ) {
+            PSIMAGE_CUT_VERTICAL( U8 );
+            PSIMAGE_CUT_VERTICAL( U16 );
+            PSIMAGE_CUT_VERTICAL( U32 );
+            PSIMAGE_CUT_VERTICAL( U64 );
+            PSIMAGE_CUT_VERTICAL( S8 );
+            PSIMAGE_CUT_VERTICAL( S16 );
+            PSIMAGE_CUT_VERTICAL( S32 );
+            PSIMAGE_CUT_VERTICAL( S64 );
+            PSIMAGE_CUT_VERTICAL( F32 );
+            PSIMAGE_CUT_VERTICAL( F64 );
+            PSIMAGE_CUT_VERTICAL( C32 );
+            PSIMAGE_CUT_VERTICAL( C64 );
+        default:
+            psError( __func__, "Unsupported datatype (%d)", type );
+            psFree( out );
+            out = NULL;
+        }
+        psFree( imgVec );
+        psFree( maskVec );
+    } else
+        if ( direction == PS_CUT_Y_POS || direction == PS_CUT_Y_NEG ) { // Cut in Y direction
             psVector * imgVec = NULL;
             psVector* maskVec = NULL;
             int elementSize = PSELEMTYPE_SIZEOF( type );
-            
+
             // fill in psVectors to fake out the statistics functions.
             imgVec = psAlloc( sizeof( psVector ) );
@@ -390,9 +391,9 @@
             imgVec->n = imgVec->nalloc = numCols;
             if ( mask != NULL ) {
-                    maskVec = psAlloc( sizeof( psVector ) );
-                    maskVec->type = mask->type;
-                    maskVec->n = maskVec->nalloc = numCols;
-                }
-                
+                maskVec = psAlloc( sizeof( psVector ) );
+                maskVec->type = mask->type;
+                maskVec->n = maskVec->nalloc = numCols;
+            }
+
             // recycle output to make a proper sized/type output structure
             // n.b. type is double as that is the type given for all stats in psStats.
@@ -400,18 +401,18 @@
             outData = out->data.F64;
             if ( delta < 0 ) {
-                    outData += numRows - 1;
+                outData += numRows - 1;
+            }
+
+            for ( int r = 0;r < numRows;r++ ) {
+                // point the vector struct to the data to calculate the stats
+                imgVec->data.V = ( void* ) ( in->data.U8[ row + r ] + col * elementSize );
+                if ( maskVec != NULL ) {
+                    maskVec->data.V = ( void* ) ( mask->data.U8[ row + r ] + col * sizeof( psMaskType ) );
                 }
-                
-            for ( int r = 0;r < numRows;r++ ) {
-                    // point the vector struct to the data to calculate the stats
-                    imgVec->data.V = ( void* ) ( in->data.U8[ row + r ] + col * elementSize );
-                    if ( maskVec != NULL ) {
-                            maskVec->data.V = ( void* ) ( mask->data.U8[ row + r ] + col * sizeof( psMaskType ) );
-                        }
-                    myStats = psVectorStats( myStats, imgVec, maskVec, maskVal );
-                    ( void ) p_psGetStatValue( myStats, &statVal ); // we know it works cause we tested it above
-                    *outData = statVal;
-                    outData += delta;
-                }
+                myStats = psVectorStats( myStats, imgVec, maskVec, maskVal );
+                ( void ) p_psGetStatValue( myStats, &statVal ); // we know it works cause we tested it above
+                *outData = statVal;
+                outData += delta;
+            }
             psFree( imgVec );
             psFree( maskVec );
@@ -421,7 +422,7 @@
             out = NULL;
         }
-        
+
     psFree( myStats );
-    
+
     return out;
 }
Index: /trunk/psLib/src/image/psImageIO.c
===================================================================
--- /trunk/psLib/src/image/psImageIO.c	(revision 1384)
+++ /trunk/psLib/src/image/psImageIO.c	(revision 1385)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-27 23:09:23 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -303,14 +303,16 @@
                         extnum, numHDUs);
                 return false;
-            } else if (numHDUs == extnum) {
-                createNewHDU = true;
-            } else if (fits_movabs_hdu(fptr, extnum+1, &hduType, &status) != 0) {
-                fits_get_errstatus(status, fitsErr);
-                status = 0;
-                (void)fits_close_file(fptr, &status);
-                psError(__func__,"Could not index to HDU #%d for file %s. (%s)",
-                        extnum, filename, fitsErr);
-                return false;
-            }
+            } else
+                if (numHDUs == extnum) {
+                    createNewHDU = true;
+                } else
+                    if (fits_movabs_hdu(fptr, extnum+1, &hduType, &status) != 0) {
+                        fits_get_errstatus(status, fitsErr);
+                        status = 0;
+                        (void)fits_close_file(fptr, &status);
+                        psError(__func__,"Could not index to HDU #%d for file %s. (%s)",
+                                extnum, filename, fitsErr);
+                        return false;
+                    }
         }
 
Index: /trunk/psLib/src/image/psImageManip.c
===================================================================
--- /trunk/psLib/src/image/psImageManip.c	(revision 1384)
+++ /trunk/psLib/src/image/psImageManip.c	(revision 1385)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-29 01:20:10 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -582,205 +582,208 @@
             return NULL;
         }
-    } else if (fabsf(angle-180.0f) < FLT_EPSILON) {
-        // perform 1/2 rotate
-        int numRows = in->numRows;
-        int lastRow = numRows - 1;
-        int numCols = in->numCols;
-        int lastCol = numCols - 1;
-        psElemType type = in->type.type;
-        out = psImageRecycle(out,numCols,numRows,type);
-
-        #define PSIMAGE_ROTATE_180_CASE(TYPE) \
-    case PS_TYPE_##TYPE: { \
-            for (int row=0;row<numRows;row++) { \
-                ps##TYPE* outRow = out->data.TYPE[row]; \
-                ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \
-                for (int col=0;col<numCols;col++) { \
-                    outRow[col] = inRow[lastCol - col]; \
+    } else
+        if (fabsf(angle-180.0f) < FLT_EPSILON) {
+            // perform 1/2 rotate
+            int numRows = in->numRows;
+            int lastRow = numRows - 1;
+            int numCols = in->numCols;
+            int lastCol = numCols - 1;
+            psElemType type = in->type.type;
+            out = psImageRecycle(out,numCols,numRows,type);
+
+            #define PSIMAGE_ROTATE_180_CASE(TYPE) \
+        case PS_TYPE_##TYPE: { \
+                for (int row=0;row<numRows;row++) { \
+                    ps##TYPE* outRow = out->data.TYPE[row]; \
+                    ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \
+                    for (int col=0;col<numCols;col++) { \
+                        outRow[col] = inRow[lastCol - col]; \
+                    } \
                 } \
             } \
-        } \
-        break;
-
-        switch (type) {
-            PSIMAGE_ROTATE_180_CASE(U8);
-            PSIMAGE_ROTATE_180_CASE(U16);
-            PSIMAGE_ROTATE_180_CASE(U32);
-            PSIMAGE_ROTATE_180_CASE(U64);
-            PSIMAGE_ROTATE_180_CASE(S8);
-            PSIMAGE_ROTATE_180_CASE(S16);
-            PSIMAGE_ROTATE_180_CASE(S32);
-            PSIMAGE_ROTATE_180_CASE(S64);
-            PSIMAGE_ROTATE_180_CASE(F32);
-            PSIMAGE_ROTATE_180_CASE(F64);
-            PSIMAGE_ROTATE_180_CASE(C32);
-            PSIMAGE_ROTATE_180_CASE(C64);
-        default:
-            psError(__func__,"Unsupported type (%d)",type);
-            psFree(out);
-            return NULL;
-        }
-    } else if (fabsf(angle-270.0f) < FLT_EPSILON) {
-        // perform 1/4 rotate clockwise
-        int numRows = in->numCols;
-        int lastRow = numRows - 1;
-        int numCols = in->numRows;
-        psElemType type = in->type.type;
-        out = psImageRecycle(out,numCols,numRows,type);
-
-        #define PSIMAGE_ROTATE_RIGHT_90(TYPE) \
-    case PS_TYPE_##TYPE: { \
-            ps##TYPE** inData = in->data.TYPE; \
-            for (int row=0;row<numRows;row++) { \
-                ps##TYPE* outRow = out->data.TYPE[row]; \
-                for (int col=0;col<numCols;col++) { \
-                    outRow[col] = inData[col][lastRow-row]; \
+            break;
+
+            switch (type) {
+                PSIMAGE_ROTATE_180_CASE(U8);
+                PSIMAGE_ROTATE_180_CASE(U16);
+                PSIMAGE_ROTATE_180_CASE(U32);
+                PSIMAGE_ROTATE_180_CASE(U64);
+                PSIMAGE_ROTATE_180_CASE(S8);
+                PSIMAGE_ROTATE_180_CASE(S16);
+                PSIMAGE_ROTATE_180_CASE(S32);
+                PSIMAGE_ROTATE_180_CASE(S64);
+                PSIMAGE_ROTATE_180_CASE(F32);
+                PSIMAGE_ROTATE_180_CASE(F64);
+                PSIMAGE_ROTATE_180_CASE(C32);
+                PSIMAGE_ROTATE_180_CASE(C64);
+            default:
+                psError(__func__,"Unsupported type (%d)",type);
+                psFree(out);
+                return NULL;
+            }
+        } else
+            if (fabsf(angle-270.0f) < FLT_EPSILON) {
+                // perform 1/4 rotate clockwise
+                int numRows = in->numCols;
+                int lastRow = numRows - 1;
+                int numCols = in->numRows;
+                psElemType type = in->type.type;
+                out = psImageRecycle(out,numCols,numRows,type);
+
+                #define PSIMAGE_ROTATE_RIGHT_90(TYPE) \
+            case PS_TYPE_##TYPE: { \
+                    ps##TYPE** inData = in->data.TYPE; \
+                    for (int row=0;row<numRows;row++) { \
+                        ps##TYPE* outRow = out->data.TYPE[row]; \
+                        for (int col=0;col<numCols;col++) { \
+                            outRow[col] = inData[col][lastRow-row]; \
+                        } \
+                    } \
                 } \
-            } \
-        } \
-        break;
-
-        switch (type) {
-            PSIMAGE_ROTATE_RIGHT_90(U8);
-            PSIMAGE_ROTATE_RIGHT_90(U16);
-            PSIMAGE_ROTATE_RIGHT_90(U32);
-            PSIMAGE_ROTATE_RIGHT_90(U64);
-            PSIMAGE_ROTATE_RIGHT_90(S8);
-            PSIMAGE_ROTATE_RIGHT_90(S16);
-            PSIMAGE_ROTATE_RIGHT_90(S32);
-            PSIMAGE_ROTATE_RIGHT_90(S64);
-            PSIMAGE_ROTATE_RIGHT_90(F32);
-            PSIMAGE_ROTATE_RIGHT_90(F64);
-            PSIMAGE_ROTATE_RIGHT_90(C32);
-            PSIMAGE_ROTATE_RIGHT_90(C64);
-        default:
-            psError(__func__,"Unsupported type (%d)",type);
-            psFree(out);
-            return NULL;
-        }
-    } else if (fabsf(angle) < FLT_EPSILON) {
-        out = psImageCopy(out,in,in->type.type);
-    } else {
-        psElemType type = in->type.type;
-        int numRows = in->numRows;
-        int numCols = in->numCols;
-        double centerX = (float)(numCols) / 2.0f;
-        float centerY = (float)(numRows) / 2.0f;
-        float t = angle*(3.14159265358f/180.0f);
-        float cosT = cosf(t);
-        float sinT = sinf(t);
-
-        // calculate the corners of the rotated image so we know the proper output image size.
-        //    x' = x cos(t) + y sin(t);  i.e, x' = (x-centerX)*cosT + (y-centerY)*sinT;
-        //    y' = y cos(t) - x sin(t);  i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT;
-
-
-        int outCols = ceil(abs(numCols*cosT)+abs(numRows*sinT))+1;
-        int outRows = ceil(abs(numCols*sinT)+abs(numRows*cosT))+1;
-        float minX = (float)outCols/-2.0f;
-        int intMinY = outRows/-2;
-
-        out = psImageRecycle(out,outCols,outRows,type);
-
-        /* optimized public domain rotation routine by Karl Lager
-        float cosT,sinT;
-        cosT = cos(t);
-        sinT = sin(t);
-        for (y = min_y; y <= max_y; y++)
-         { x' = min_x * cosT + y * sinT + x1';
-           y' = y * cosT - min_x * sinT + y1';
-           for (x = min_x; x <= max_x; x++)
-            { if (x', y') is in the bounds of the bitmap, 
-                 get pixel(x', y') and plot the pixel to 
-                 (x, y) on screen.
-              x' += cosT;
-              y' -= sinT;
-            }
-         }
-        */
-
-        // precalculate some figures that are used within loop
-        float minXTimesCosTPlusCenterX = minX*cosT+centerX;
-        float CenterYMinusminXTimesSinT = centerY-minX*sinT;
-
-        #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \
-            if (unexposedValue < PS_MIN_##TYPE || unexposedValue > PS_MAX_##TYPE) { \
-                psError(__func__,"The given unexposedValue (%g) is outside of the " \
-                        "image type's range (%g->%g).", \
-                        unexposedValue, (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
-                psFree(out); \
-                out = NULL; \
-                break; \
-            } \
-            float inX; \
-            float inY; \
-            ps##TYPE* outRow; \
-            for (int y = 0; y < outRows; y++) { \
-                inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \
-                inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \
-                outRow = out->data.TYPE[y]; \
-                for (int x = 0; x < outCols; x++) { \
-                    outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,unexposedValue); \
-                    inX += cosT; \
-                    inY -= sinT; \
-                } \
-            } \
-        }
-
-        #define PSIMAGE_ROTATE_ARBITRARY_CASE(MODE) \
-    case PS_INTERPOLATE_##MODE: \
-        switch (type) { \
-        case PS_TYPE_U8: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(U8,MODE); \
-            break; \
-        case PS_TYPE_U16: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(U16,MODE); \
-            break; \
-        case PS_TYPE_U32: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(U32,MODE); \
-            break; \
-        case PS_TYPE_U64: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(U64,MODE); \
-            break; \
-        case PS_TYPE_S8: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(S8,MODE); \
-            break; \
-        case PS_TYPE_S16: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(S16,MODE); \
-            break; \
-        case PS_TYPE_S32: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(S32,MODE); \
-            break; \
-        case PS_TYPE_S64: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(S64,MODE); \
-            break; \
-        case PS_TYPE_F32: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(F32,MODE); \
-            break; \
-        case PS_TYPE_F64: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(F64,MODE); \
-            break; \
-        case PS_TYPE_C32: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(C32,MODE); \
-            break; \
-        case PS_TYPE_C64: \
-            PSIMAGE_ROTATE_ARBITRARY_LOOP(C64,MODE); \
-            break; \
-        default: \
-            psError(__func__,"Image type (%d) not supported",type); \
-            psFree(out); \
-            out = NULL; \
-        } \
-        break;
-
-        switch (mode) {
-            PSIMAGE_ROTATE_ARBITRARY_CASE(FLAT);
-            PSIMAGE_ROTATE_ARBITRARY_CASE(BILINEAR);
-        default:
-            psError(__func__,"Unsupported interpolation mode (%d)",mode);
-            psFree(out);
-            out = NULL;
-        }
-    }
+                break;
+
+                switch (type) {
+                    PSIMAGE_ROTATE_RIGHT_90(U8);
+                    PSIMAGE_ROTATE_RIGHT_90(U16);
+                    PSIMAGE_ROTATE_RIGHT_90(U32);
+                    PSIMAGE_ROTATE_RIGHT_90(U64);
+                    PSIMAGE_ROTATE_RIGHT_90(S8);
+                    PSIMAGE_ROTATE_RIGHT_90(S16);
+                    PSIMAGE_ROTATE_RIGHT_90(S32);
+                    PSIMAGE_ROTATE_RIGHT_90(S64);
+                    PSIMAGE_ROTATE_RIGHT_90(F32);
+                    PSIMAGE_ROTATE_RIGHT_90(F64);
+                    PSIMAGE_ROTATE_RIGHT_90(C32);
+                    PSIMAGE_ROTATE_RIGHT_90(C64);
+                default:
+                    psError(__func__,"Unsupported type (%d)",type);
+                    psFree(out);
+                    return NULL;
+                }
+            } else
+                if (fabsf(angle) < FLT_EPSILON) {
+                    out = psImageCopy(out,in,in->type.type);
+                } else {
+                    psElemType type = in->type.type;
+                    int numRows = in->numRows;
+                    int numCols = in->numCols;
+                    double centerX = (float)(numCols) / 2.0f;
+                    float centerY = (float)(numRows) / 2.0f;
+                    float t = angle*(3.14159265358f/180.0f);
+                    float cosT = cosf(t);
+                    float sinT = sinf(t);
+
+                    // calculate the corners of the rotated image so we know the proper output image size.
+                    //    x' = x cos(t) + y sin(t);  i.e, x' = (x-centerX)*cosT + (y-centerY)*sinT;
+                    //    y' = y cos(t) - x sin(t);  i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT;
+
+
+                    int outCols = ceil(abs(numCols*cosT)+abs(numRows*sinT))+1;
+                    int outRows = ceil(abs(numCols*sinT)+abs(numRows*cosT))+1;
+                    float minX = (float)outCols/-2.0f;
+                    int intMinY = outRows/-2;
+
+                    out = psImageRecycle(out,outCols,outRows,type);
+
+                    /* optimized public domain rotation routine by Karl Lager
+                    float cosT,sinT;
+                    cosT = cos(t);
+                    sinT = sin(t);
+                    for (y = min_y; y <= max_y; y++)
+                     { x' = min_x * cosT + y * sinT + x1';
+                       y' = y * cosT - min_x * sinT + y1';
+                       for (x = min_x; x <= max_x; x++)
+                        { if (x', y') is in the bounds of the bitmap, 
+                             get pixel(x', y') and plot the pixel to 
+                             (x, y) on screen.
+                          x' += cosT;
+                          y' -= sinT;
+                        }
+                     }
+                    */
+
+                    // precalculate some figures that are used within loop
+                    float minXTimesCosTPlusCenterX = minX*cosT+centerX;
+                    float CenterYMinusminXTimesSinT = centerY-minX*sinT;
+
+                    #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \
+                        if (unexposedValue < PS_MIN_##TYPE || unexposedValue > PS_MAX_##TYPE) { \
+                            psError(__func__,"The given unexposedValue (%g) is outside of the " \
+                                    "image type's range (%g->%g).", \
+                                    unexposedValue, (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
+                            psFree(out); \
+                            out = NULL; \
+                            break; \
+                        } \
+                        float inX; \
+                        float inY; \
+                        ps##TYPE* outRow; \
+                        for (int y = 0; y < outRows; y++) { \
+                            inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \
+                            inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \
+                            outRow = out->data.TYPE[y]; \
+                            for (int x = 0; x < outCols; x++) { \
+                                outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,unexposedValue); \
+                                inX += cosT; \
+                                inY -= sinT; \
+                            } \
+                        } \
+                    }
+
+                    #define PSIMAGE_ROTATE_ARBITRARY_CASE(MODE) \
+                case PS_INTERPOLATE_##MODE: \
+                    switch (type) { \
+                    case PS_TYPE_U8: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(U8,MODE); \
+                        break; \
+                    case PS_TYPE_U16: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(U16,MODE); \
+                        break; \
+                    case PS_TYPE_U32: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(U32,MODE); \
+                        break; \
+                    case PS_TYPE_U64: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(U64,MODE); \
+                        break; \
+                    case PS_TYPE_S8: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(S8,MODE); \
+                        break; \
+                    case PS_TYPE_S16: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(S16,MODE); \
+                        break; \
+                    case PS_TYPE_S32: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(S32,MODE); \
+                        break; \
+                    case PS_TYPE_S64: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(S64,MODE); \
+                        break; \
+                    case PS_TYPE_F32: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(F32,MODE); \
+                        break; \
+                    case PS_TYPE_F64: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(F64,MODE); \
+                        break; \
+                    case PS_TYPE_C32: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(C32,MODE); \
+                        break; \
+                    case PS_TYPE_C64: \
+                        PSIMAGE_ROTATE_ARBITRARY_LOOP(C64,MODE); \
+                        break; \
+                    default: \
+                        psError(__func__,"Image type (%d) not supported",type); \
+                        psFree(out); \
+                        out = NULL; \
+                    } \
+                    break;
+
+                    switch (mode) {
+                        PSIMAGE_ROTATE_ARBITRARY_CASE(FLAT);
+                        PSIMAGE_ROTATE_ARBITRARY_CASE(BILINEAR);
+                    default:
+                        psError(__func__,"Unsupported interpolation mode (%d)",mode);
+                        psFree(out);
+                        out = NULL;
+                    }
+                }
 
     return out;
Index: /trunk/psLib/src/image/psImageStats.c
===================================================================
--- /trunk/psLib/src/image/psImageStats.c	(revision 1384)
+++ /trunk/psLib/src/image/psImageStats.c	(revision 1385)
@@ -271,9 +271,10 @@
             if ((i != 0) && (j != 0)) {
                 coeffs->coeff[i][j]*= 4.0;
-            } else if ((i == 0) && (j == 0)) {
-                coeffs->coeff[i][j]*= 1.0;
-            } else {
-                coeffs->coeff[i][j]*= 2.0;
-            }
+            } else
+                if ((i == 0) && (j == 0)) {
+                    coeffs->coeff[i][j]*= 1.0;
+                } else {
+                    coeffs->coeff[i][j]*= 2.0;
+                }
         }
     }
Index: /trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.c	(revision 1384)
+++ /trunk/psLib/src/imageops/psImageStats.c	(revision 1385)
@@ -271,9 +271,10 @@
             if ((i != 0) && (j != 0)) {
                 coeffs->coeff[i][j]*= 4.0;
-            } else if ((i == 0) && (j == 0)) {
-                coeffs->coeff[i][j]*= 1.0;
-            } else {
-                coeffs->coeff[i][j]*= 2.0;
-            }
+            } else
+                if ((i == 0) && (j == 0)) {
+                    coeffs->coeff[i][j]*= 1.0;
+                } else {
+                    coeffs->coeff[i][j]*= 2.0;
+                }
         }
     }
Index: /trunk/psLib/src/math/psMatrix.c
===================================================================
--- /trunk/psLib/src/math/psMatrix.c	(revision 1384)
+++ /trunk/psLib/src/math/psMatrix.c	(revision 1385)
@@ -20,6 +20,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-08 01:57:52 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -475,12 +475,13 @@
         PS_CHECK_ALLOC_VECTOR(outVector, inImage->numCols, inImage->type.type);
         outVector->type.dimen = PS_DIMEN_TRANSV;
-    } else if(inImage->numCols == 1) {
-        // Create non-transposed column vector
-        PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
-    } else {
-        psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
-                inImage->numCols);
-        return outVector;
-    }
+    } else
+        if(inImage->numCols == 1) {
+            // Create non-transposed column vector
+            PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
+        } else {
+            psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
+                    inImage->numCols);
+            return outVector;
+        }
 
     PS_CHECK_NULL_VECTOR(outVector, outVector);
@@ -502,18 +503,19 @@
         size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
 
-    } else if(outVector->type.dimen == PS_DIMEN_TRANSV) {
-        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
-
-        if(outVector->n == 0) {
-            outVector->n = inImage->numCols;
+    } else
+        if(outVector->type.dimen == PS_DIMEN_TRANSV) {
+            PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
+
+            if(outVector->n == 0) {
+                outVector->n = inImage->numCols;
+            }
+
+            if(outVector->n != inImage->numCols) {
+                psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
+                return outVector;
+            }
+
+            size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numCols;
         }
-
-        if(outVector->n != inImage->numCols) {
-            psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
-            return outVector;
-        }
-
-        size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numCols;
-    }
 
     memcpy(outVector->data.V, inImage->data.V[0], size);
@@ -538,27 +540,30 @@
             psError(__func__, "Image has more than 1 column: numCols = %d.", outImage->numCols);
             return outImage;
-        } else if(outImage->numRows != inVector->n) {
-            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
-            return outImage;
+        } else
+            if(outImage->numRows != inVector->n) {
+                psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
+                return outImage;
+            }
+
+        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
+
+    } else
+        if(inVector->type.dimen == PS_DIMEN_TRANSV) {
+            PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
+            PS_CHECK_SIZE_VECTOR(inVector, outImage);
+            PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
+
+            // More checks for PS_DIMEN_TRANSV
+            if(outImage->numRows > 1) {
+                psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
+                return outImage;
+            } else
+                if(outImage->numCols != inVector->n) {
+                    psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
+                    return outImage;
+                }
+
+            size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numCols;
         }
-
-        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
-
-    } else if(inVector->type.dimen == PS_DIMEN_TRANSV) {
-        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
-        PS_CHECK_SIZE_VECTOR(inVector, outImage);
-        PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
-
-        // More checks for PS_DIMEN_TRANSV
-        if(outImage->numRows > 1) {
-            psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
-            return outImage;
-        } else if(outImage->numCols != inVector->n) {
-            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
-            return outImage;
-        }
-
-        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numCols;
-    }
 
     PS_CHECK_NULL_IMAGE(outImage, outImage);
Index: /trunk/psLib/src/math/psMinimize.c
===================================================================
--- /trunk/psLib/src/math/psMinimize.c	(revision 1384)
+++ /trunk/psLib/src/math/psMinimize.c	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-30 00:39:14 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/math/psPolynomial.c
===================================================================
--- /trunk/psLib/src/math/psPolynomial.c	(revision 1384)
+++ /trunk/psLib/src/math/psPolynomial.c	(revision 1385)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-29 23:34:24 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/math/psPolynomial.h
===================================================================
--- /trunk/psLib/src/math/psPolynomial.h	(revision 1384)
+++ /trunk/psLib/src/math/psPolynomial.h	(revision 1385)
@@ -12,6 +12,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 22:11:09 $
+*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -39,6 +39,6 @@
             bool normal      ///< Indicates whether result should be normalized
           );
-          
-          
+
+
 /** Produce a vector of random numbers from a Gaussian distribution with
     the specified mean and sigma */
@@ -46,47 +46,47 @@
                          float sigma,    ///< The sigma of the Gaussian
                          int Npts );     ///< The size of the vector
-                         
-                         
-                         
-                         
-                         
+
+
+
+
+
 /** One-dimensional polynomial */
 typedef struct
-    {
-        int n;           ///< Number of terms
-        float *coeff;    ///< Coefficients
-        float *coeffErr; ///< Error in coefficients
-        char *mask;      ///< Coefficient mask
-    }
+{
+    int n;           ///< Number of terms
+    float *coeff;    ///< Coefficients
+    float *coeffErr; ///< Error in coefficients
+    char *mask;      ///< Coefficient mask
+}
 psPolynomial1D;
 
 /** Two-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY;    ///< Number of terms in x and y
-        float **coeff;   ///< Coefficients
-        float **coeffErr;   ///< Error in coefficients
-        char **mask;   ///< Coefficients mask
-    }
+{
+    int nX, nY;    ///< Number of terms in x and y
+    float **coeff;   ///< Coefficients
+    float **coeffErr;   ///< Error in coefficients
+    char **mask;   ///< Coefficients mask
+}
 psPolynomial2D;
 
 /** Three-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY, nZ;   ///< Number of terms in x, y and z
-        float ***coeff;    ///< Coefficients
-        float ***coeffErr;    ///< Error in coefficients
-        char ***mask;    ///< Coefficients mask
-    }
+{
+    int nX, nY, nZ;   ///< Number of terms in x, y and z
+    float ***coeff;    ///< Coefficients
+    float ***coeffErr;    ///< Error in coefficients
+    char ***mask;    ///< Coefficients mask
+}
 psPolynomial3D;
 
 /** Four-dimensional polynomial */
 typedef struct
-    {
-        int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-        float ****coeff;    ///< Coefficients
-        float ****coeffErr;   ///< Error in coefficients
-        char ****mask;    ///< Coefficients mask
-    }
+{
+    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
+    float ****coeff;    ///< Coefficients
+    float ****coeffErr;   ///< Error in coefficients
+    char ****mask;    ///< Coefficients mask
+}
 psPolynomial4D;
 
@@ -106,5 +106,5 @@
 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
                                    );
-                                   
+
 /** Evaluate 1D polynomial */
 float
@@ -112,5 +112,5 @@
                     const psPolynomial1D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 2D polynomial */
 float
@@ -119,5 +119,5 @@
                     const psPolynomial2D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 3D polynomial */
 float
@@ -127,5 +127,5 @@
                     const psPolynomial3D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 4D polynomial */
 float
@@ -136,5 +136,5 @@
                     const psPolynomial4D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /*****************************************************************************/
 
@@ -143,40 +143,40 @@
 /** Double-precision one-dimensional polynomial */
 typedef struct
-    {
-        int n;    ///< Number of terms
-        double *coeff;   ///< Coefficients
-        double *coeffErr;   ///< Error in coefficients
-        char *mask;    ///< Coefficient mask
-    }
+{
+    int n;    ///< Number of terms
+    double *coeff;   ///< Coefficients
+    double *coeffErr;   ///< Error in coefficients
+    char *mask;    ///< Coefficient mask
+}
 psDPolynomial1D;
 
 /** Double-precision two-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY;    ///< Number of terms in x and y
-        double **coeff;   ///< Coefficients
-        double **coeffErr;    ///< Error in coefficients
-        char **mask;   ///< Coefficients mask
-    }
+{
+    int nX, nY;    ///< Number of terms in x and y
+    double **coeff;   ///< Coefficients
+    double **coeffErr;    ///< Error in coefficients
+    char **mask;   ///< Coefficients mask
+}
 psDPolynomial2D;
 
 /** Double-precision three-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY, nZ;   ///< Number of terms in x, y and z
-        double ***coeff;   ///< Coefficients
-        double ***coeffErr;   ///< Error in coefficients
-        char ***mask;    ///< Coefficient mask
-    }
+{
+    int nX, nY, nZ;   ///< Number of terms in x, y and z
+    double ***coeff;   ///< Coefficients
+    double ***coeffErr;   ///< Error in coefficients
+    char ***mask;    ///< Coefficient mask
+}
 psDPolynomial3D;
 
 /** Double-precision four-dimensional polynomial */
 typedef struct
-    {
-        int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-        double ****coeff;    ///< Coefficients
-        double ****coeffErr;   ///< Error in coefficients
-        char ****mask;    ///< Coefficients mask
-    }
+{
+    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
+    double ****coeff;    ///< Coefficients
+    double ****coeffErr;   ///< Error in coefficients
+    char ****mask;    ///< Coefficients mask
+}
 psDPolynomial4D;
 
@@ -193,5 +193,5 @@
 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
                                      );
-                                     
+
 /** Evaluate 1D polynomial (double precision) */
 double
@@ -199,5 +199,5 @@
                      const psDPolynomial1D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 2D polynomial (double precision) */
 double
@@ -206,5 +206,5 @@
                      const psDPolynomial2D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 3D polynomial (double precision) */
 double
@@ -214,5 +214,5 @@
                      const psDPolynomial3D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 4D polynomial (double precision) */
 double
@@ -223,5 +223,5 @@
                      const psDPolynomial4D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /* \} */ // End of MathGroup Functions
 
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 1384)
+++ /trunk/psLib/src/math/psSpline.c	(revision 1385)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-29 23:34:24 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/math/psSpline.h
===================================================================
--- /trunk/psLib/src/math/psSpline.h	(revision 1384)
+++ /trunk/psLib/src/math/psSpline.h	(revision 1385)
@@ -12,6 +12,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 22:11:09 $
+*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -39,6 +39,6 @@
             bool normal      ///< Indicates whether result should be normalized
           );
-          
-          
+
+
 /** Produce a vector of random numbers from a Gaussian distribution with
     the specified mean and sigma */
@@ -46,47 +46,47 @@
                          float sigma,    ///< The sigma of the Gaussian
                          int Npts );     ///< The size of the vector
-                         
-                         
-                         
-                         
-                         
+
+
+
+
+
 /** One-dimensional polynomial */
 typedef struct
-    {
-        int n;           ///< Number of terms
-        float *coeff;    ///< Coefficients
-        float *coeffErr; ///< Error in coefficients
-        char *mask;      ///< Coefficient mask
-    }
+{
+    int n;           ///< Number of terms
+    float *coeff;    ///< Coefficients
+    float *coeffErr; ///< Error in coefficients
+    char *mask;      ///< Coefficient mask
+}
 psPolynomial1D;
 
 /** Two-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY;    ///< Number of terms in x and y
-        float **coeff;   ///< Coefficients
-        float **coeffErr;   ///< Error in coefficients
-        char **mask;   ///< Coefficients mask
-    }
+{
+    int nX, nY;    ///< Number of terms in x and y
+    float **coeff;   ///< Coefficients
+    float **coeffErr;   ///< Error in coefficients
+    char **mask;   ///< Coefficients mask
+}
 psPolynomial2D;
 
 /** Three-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY, nZ;   ///< Number of terms in x, y and z
-        float ***coeff;    ///< Coefficients
-        float ***coeffErr;    ///< Error in coefficients
-        char ***mask;    ///< Coefficients mask
-    }
+{
+    int nX, nY, nZ;   ///< Number of terms in x, y and z
+    float ***coeff;    ///< Coefficients
+    float ***coeffErr;    ///< Error in coefficients
+    char ***mask;    ///< Coefficients mask
+}
 psPolynomial3D;
 
 /** Four-dimensional polynomial */
 typedef struct
-    {
-        int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-        float ****coeff;    ///< Coefficients
-        float ****coeffErr;   ///< Error in coefficients
-        char ****mask;    ///< Coefficients mask
-    }
+{
+    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
+    float ****coeff;    ///< Coefficients
+    float ****coeffErr;   ///< Error in coefficients
+    char ****mask;    ///< Coefficients mask
+}
 psPolynomial4D;
 
@@ -106,5 +106,5 @@
 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
                                    );
-                                   
+
 /** Evaluate 1D polynomial */
 float
@@ -112,5 +112,5 @@
                     const psPolynomial1D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 2D polynomial */
 float
@@ -119,5 +119,5 @@
                     const psPolynomial2D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 3D polynomial */
 float
@@ -127,5 +127,5 @@
                     const psPolynomial3D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /** Evaluate 4D polynomial */
 float
@@ -136,5 +136,5 @@
                     const psPolynomial4D *myPoly ///< Coefficients for the polynomial
                   );
-                  
+
 /*****************************************************************************/
 
@@ -143,40 +143,40 @@
 /** Double-precision one-dimensional polynomial */
 typedef struct
-    {
-        int n;    ///< Number of terms
-        double *coeff;   ///< Coefficients
-        double *coeffErr;   ///< Error in coefficients
-        char *mask;    ///< Coefficient mask
-    }
+{
+    int n;    ///< Number of terms
+    double *coeff;   ///< Coefficients
+    double *coeffErr;   ///< Error in coefficients
+    char *mask;    ///< Coefficient mask
+}
 psDPolynomial1D;
 
 /** Double-precision two-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY;    ///< Number of terms in x and y
-        double **coeff;   ///< Coefficients
-        double **coeffErr;    ///< Error in coefficients
-        char **mask;   ///< Coefficients mask
-    }
+{
+    int nX, nY;    ///< Number of terms in x and y
+    double **coeff;   ///< Coefficients
+    double **coeffErr;    ///< Error in coefficients
+    char **mask;   ///< Coefficients mask
+}
 psDPolynomial2D;
 
 /** Double-precision three-dimensional polynomial */
 typedef struct
-    {
-        int nX, nY, nZ;   ///< Number of terms in x, y and z
-        double ***coeff;   ///< Coefficients
-        double ***coeffErr;   ///< Error in coefficients
-        char ***mask;    ///< Coefficient mask
-    }
+{
+    int nX, nY, nZ;   ///< Number of terms in x, y and z
+    double ***coeff;   ///< Coefficients
+    double ***coeffErr;   ///< Error in coefficients
+    char ***mask;    ///< Coefficient mask
+}
 psDPolynomial3D;
 
 /** Double-precision four-dimensional polynomial */
 typedef struct
-    {
-        int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-        double ****coeff;    ///< Coefficients
-        double ****coeffErr;   ///< Error in coefficients
-        char ****mask;    ///< Coefficients mask
-    }
+{
+    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
+    double ****coeff;    ///< Coefficients
+    double ****coeffErr;   ///< Error in coefficients
+    char ****mask;    ///< Coefficients mask
+}
 psDPolynomial4D;
 
@@ -193,5 +193,5 @@
 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
                                      );
-                                     
+
 /** Evaluate 1D polynomial (double precision) */
 double
@@ -199,5 +199,5 @@
                      const psDPolynomial1D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 2D polynomial (double precision) */
 double
@@ -206,5 +206,5 @@
                      const psDPolynomial2D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 3D polynomial (double precision) */
 double
@@ -214,5 +214,5 @@
                      const psDPolynomial3D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /** Evaluate 4D polynomial (double precision) */
 double
@@ -223,5 +223,5 @@
                      const psDPolynomial4D *myPoly ///< Coefficients for the polynomial
                    );
-                   
+
 /* \} */ // End of MathGroup Functions
 
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 1384)
+++ /trunk/psLib/src/math/psStats.c	(revision 1385)
@@ -36,33 +36,33 @@
                             unsigned int maskVal,
                             psStats *stats );
-                            
+
 /** Preprocessor macro to generate error on an incorrect type */
 #define PS_CHECK_VECTOR_TYPE(NAME, TYPE) \
 if (NAME->type.type != TYPE) { \
-        psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \
-    }
-    
+    psError(__func__,"Invalid operation: %s has incorrect type.", #NAME); \
+}
+
 /** Preprocessor macro to generate error on a NULL vector */
 #define PS_CHECK_NULL_VECTOR(NAME) \
 if (NAME == NULL || NAME->data.V == NULL) { \
-        psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \
-    }
-    
+    psError(__func__,"Invalid operation: %s or its data is NULL.", #NAME); \
+}
+
 /** Preprocessor macro to generate error for zero length vector */
 #define PS_CHECK_EMPTY_VECTOR(NAME) \
 if (NAME->n < 1) { \
-        psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \
-    }
-    
+    psError(__func__,"Invalid operation: %s has zero n value.", #NAME); \
+}
+
 /** Preprocessor macro to generate error on differing size vectors */
 #define PS_CHECK_VECTOR_SIZE_EQUAL(VEC1, VEC2) \
 if (VEC1->n != VEC2->n) { \
-        psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
-    }
-    
+    psError(__func__,"Vector %s has size %d, Vector %s has size %d.", #VEC1, VEC1->n, #VEC2, VEC2->n); \
+}
+
 #define PS_PRINT_VECTOR(NAME) \
 for (int my_i=0;my_i<NAME->n;my_i++) { \
-        printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
-    } \
+    printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \
+} \
 printf("\n"); \
 
@@ -92,51 +92,51 @@
     switch ( stats->options &
              ~ ( PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE | PS_STAT_ROBUST_FOR_SAMPLE ) ) {
-            case PS_STAT_SAMPLE_MEAN:
-            *value = stats->sampleMean;
-            return true;
-            
-            case PS_STAT_SAMPLE_MEDIAN:
-            *value = stats->sampleMedian;
-            return true;
-            
-            case PS_STAT_SAMPLE_STDEV:
-            *value = stats->sampleStdev;
-            return true;
-            
-            case PS_STAT_ROBUST_MEAN:
-            *value = stats->robustMean;
-            return true;
-            
-            case PS_STAT_ROBUST_MEDIAN:
-            *value = stats->robustMedian;
-            return true;
-            
-            case PS_STAT_ROBUST_MODE:
-            *value = stats->robustMode;
-            return true;
-            
-            case PS_STAT_ROBUST_STDEV:
-            *value = stats->robustStdev;
-            return true;
-            
-            case PS_STAT_CLIPPED_MEAN:
-            *value = stats->clippedMean;
-            return true;
-            
-            case PS_STAT_CLIPPED_STDEV:
-            *value = stats->clippedStdev;
-            return true;
-            
-            case PS_STAT_MAX:
-            *value = stats->max;
-            return true;
-            
-            case PS_STAT_MIN:
-            *value = stats->min;
-            return true;
-            
-            default:
-            return false;
-        }
+    case PS_STAT_SAMPLE_MEAN:
+        *value = stats->sampleMean;
+        return true;
+
+    case PS_STAT_SAMPLE_MEDIAN:
+        *value = stats->sampleMedian;
+        return true;
+
+    case PS_STAT_SAMPLE_STDEV:
+        *value = stats->sampleStdev;
+        return true;
+
+    case PS_STAT_ROBUST_MEAN:
+        *value = stats->robustMean;
+        return true;
+
+    case PS_STAT_ROBUST_MEDIAN:
+        *value = stats->robustMedian;
+        return true;
+
+    case PS_STAT_ROBUST_MODE:
+        *value = stats->robustMode;
+        return true;
+
+    case PS_STAT_ROBUST_STDEV:
+        *value = stats->robustStdev;
+        return true;
+
+    case PS_STAT_CLIPPED_MEAN:
+        *value = stats->clippedMean;
+        return true;
+
+    case PS_STAT_CLIPPED_STDEV:
+        *value = stats->clippedStdev;
+        return true;
+
+    case PS_STAT_MAX:
+        *value = stats->max;
+        return true;
+
+    case PS_STAT_MIN:
+        *value = stats->min;
+        return true;
+
+    default:
+        return false;
+    }
 }
 
@@ -153,11 +153,11 @@
 {
     int i = 0;                                  // Loop index variable.
-    
+
     for ( i = 0;i < myVector->n;i++ ) {
-            if ( maskVector != NULL )
-                printf( "Element %d is %f (mask is %d)\n", i, myVector->data.F32[ i ], maskVector->data.U8[ i ] );
-            else
-                printf( "Element %d is %f\n", i, myVector->data.F32[ i ] );
-        }
+        if ( maskVector != NULL )
+            printf( "Element %d is %f (mask is %d)\n", i, myVector->data.F32[ i ], maskVector->data.U8[ i ] );
+        else
+            printf( "Element %d is %f\n", i, myVector->data.F32[ i ] );
+    }
 }
 
@@ -204,48 +204,48 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     // If PS_STAT_USE_RANGE is requested, then we enter a slightly different
     // loop.
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            // Check if the data is with the specified range
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    mean += myVector->data.F32[ i ];
-                                    count++;
-                                }
-                        }
-                    mean /= ( float ) count;
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    mean += myVector->data.F32[ i ];
-                                    count++;
-                                }
-                        }
-                    mean /= ( float ) count;
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                // Check if the data is with the specified range
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    mean += myVector->data.F32[ i ];
+                    count++;
+                }
+            }
+            mean /= ( float ) count;
         } else {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    mean += myVector->data.F32[ i ];
-                                    count++;
-                                }
-                        }
-                    mean /= ( float ) count;
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            mean += myVector->data.F32[ i ];
-                        }
-                    mean /= ( float ) myVector->n;
-                }
-        }
-        
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    mean += myVector->data.F32[ i ];
+                    count++;
+                }
+            }
+            mean /= ( float ) count;
+        }
+    } else {
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    mean += myVector->data.F32[ i ];
+                    count++;
+                }
+            }
+            mean /= ( float ) count;
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                mean += myVector->data.F32[ i ];
+            }
+            mean /= ( float ) myVector->n;
+        }
+    }
+
     stats->sampleMean = mean;
 }
@@ -271,46 +271,46 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     // If PS_STAT_USE_RANGE is requested, then we enter a different loop.
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    if ( ( myVector->data.F32[ i ] > max ) &&
-                                            ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                            max = myVector->data.F32[ i ];
-                                        }
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( myVector->data.F32[ i ] > max ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    max = myVector->data.F32[ i ];
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    if ( ( myVector->data.F32[ i ] > max ) &&
+                            ( rangeMin <= myVector->data.F32[ i ] ) &&
+                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                        max = myVector->data.F32[ i ];
+                    }
+                }
+            }
         } else {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    if ( myVector->data.F32[ i ] > max ) {
-                                            max = myVector->data.F32[ i ];
-                                        }
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( myVector->data.F32[ i ] > max ) {
-                                    max = myVector->data.F32[ i ];
-                                }
-                        }
-                }
-        }
-        
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( myVector->data.F32[ i ] > max ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    max = myVector->data.F32[ i ];
+                }
+            }
+        }
+    } else {
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    if ( myVector->data.F32[ i ] > max ) {
+                        max = myVector->data.F32[ i ];
+                    }
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( myVector->data.F32[ i ] > max ) {
+                    max = myVector->data.F32[ i ];
+                }
+            }
+        }
+    }
+
     stats->max = max;
 }
@@ -336,45 +336,45 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    if ( ( myVector->data.F32[ i ] < min ) &&
-                                            ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                            min = myVector->data.F32[ i ];
-                                        }
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( myVector->data.F32[ i ] < min ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    min = myVector->data.F32[ i ];
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    if ( ( myVector->data.F32[ i ] < min ) &&
+                            ( rangeMin <= myVector->data.F32[ i ] ) &&
+                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                        min = myVector->data.F32[ i ];
+                    }
+                }
+            }
         } else {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    if ( myVector->data.F32[ i ] < min ) {
-                                            min = myVector->data.F32[ i ];
-                                        }
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( myVector->data.F32[ i ] < min ) {
-                                    min = myVector->data.F32[ i ];
-                                }
-                        }
-                }
-        }
-        
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( myVector->data.F32[ i ] < min ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    min = myVector->data.F32[ i ];
+                }
+            }
+        }
+    } else {
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    if ( myVector->data.F32[ i ] < min ) {
+                        min = myVector->data.F32[ i ];
+                    }
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( myVector->data.F32[ i ] < min ) {
+                    min = myVector->data.F32[ i ];
+                }
+            }
+        }
+    }
+
     stats->min = min;
 }
@@ -401,37 +401,37 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    numData++;
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    numData++;
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    numData++;
+                }
+            }
         } else {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    numData++;
-                                }
-                        }
-                } else {
-                    numData = myVector->n;
-                }
-        }
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    numData++;
+                }
+            }
+        }
+    } else {
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    numData++;
+                }
+            }
+        } else {
+            numData = myVector->n;
+        }
+    }
     return ( numData );
 }
@@ -462,6 +462,6 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
-    
+
+
     // Determine if the number of data points exceed a threshold which will
     // cause to generate robust stats, as opposed to exact stats.
@@ -488,67 +488,67 @@
         }
     */
-    
+
     // Determine how many data points fit inside this min/max range
     // and are not masked, IF the maskVector is not NULL>
     nValues = p_psVectorNValues( myVector, maskVector, maskVal, stats );
-    
+
     // Allocate temporary vectors for the data.
     unsortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
     unsortedVector->n = unsortedVector->nalloc;
-    
+
     sortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
     sortedVector->n = sortedVector->nalloc;
-    
+
     // Determine if we must only use data points within a min/max range.
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            
-            // Store all non-masked data points within the min/max range
-            // into the temporary vectors.
-            count = 0;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    unsortedVector->data.F32[ count++ ] = maskVector->data.F32[ i ];
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+
+        // Store all non-masked data points within the min/max range
+        // into the temporary vectors.
+        count = 0;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    unsortedVector->data.F32[ count++ ] = maskVector->data.F32[ i ];
+                }
+            }
         } else {
-            // Store all non-masked data points into the temporary vectors.
-            count = 0;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
-                        }
-                }
-        }
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
+        }
+    } else {
+        // Store all non-masked data points into the temporary vectors.
+        count = 0;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
+            }
+        }
+    }
     // Sort the temporary vectors.
     psVectorSort( sortedVector, unsortedVector );
-    
+
     // Calculate the median exactly.
     // XXX: Is this the correct action?
     if ( 0 == ( nValues % 2 ) ) {
-            stats->sampleMedian = 0.5 * ( sortedVector->data.F32[ ( nValues / 2 ) - 1 ] +
-                                          sortedVector->data.F32[ nValues / 2 ] );
-        } else {
-            stats->sampleMedian = sortedVector->data.F32[ nValues / 2 ];
-        }
-        
+        stats->sampleMedian = 0.5 * ( sortedVector->data.F32[ ( nValues / 2 ) - 1 ] +
+                                      sortedVector->data.F32[ nValues / 2 ] );
+    } else {
+        stats->sampleMedian = sortedVector->data.F32[ nValues / 2 ];
+    }
+
     // Free the temporary data structures.
     psFree( unsortedVector );
@@ -577,47 +577,47 @@
     float gaussianCoefs[ 1 + ( 2 * GAUSS_WIDTH ) ]; // The Gaussian Coefficients
     psVector *smooth = psVectorAlloc( robustHistogram->nums->n, PS_TYPE_F32 );
-    
+
     for ( i = 0;i < ( 1 + ( 2 * GAUSS_WIDTH ) );i++ ) {
-            if ( fabs( sigma ) >= FLT_EPSILON ) {
-                    // If sigma does not equal zero, then we use Gaussian smoothing.
-                    #ifdef  DARWIN
-                    denom = ( float ) sqrt( 2.0 * M_PI * sigma * sigma );
-                    #else
-                    
-                    denom = sqrtf( 2.0 * M_PI * sigma * sigma );
-                    #endif
-                    
-                    expo = - ( float ) ( ( i - GAUSS_WIDTH ) * ( i - GAUSS_WIDTH ) );
-                    expo /= ( 2.0 * sigma * sigma );
-                    gaussianCoefs[ i ] = exp( expo / denom );
-                    
-                    // NOTE: Gaussian smoothing just isn't working with low sigma
-                    // values.  The problem is that the Gaussian coefficients are
-                    // all zero, except for the middle coefficient, which is exactly
-                    // one.  Therefore, I'm using boxcar smoothing.
-                    gaussianCoefs[ i ] = 1.0 / ( 1.0 + ( 2.0 * ( float ) GAUSS_WIDTH ) );
-                    //            printf("gaussianCoefs[%d] is %f\n", i, gaussianCoefs[i]);
-                } else {
-                    /* If sigma equals zero (all pixels have the same value)
-                     * the above code will divide by zero.  Therefore, we don't need
-                     * to smooth the data.
-                     */
-                    for ( i = 0;i < robustHistogram->nums->n;i++ ) {
-                            smooth->data.F32[ i ] = ( float ) robustHistogram->nums->data.S32[ i ];
-                        }
-                    return ( smooth );
-                }
-        }
-        
+        if ( fabs( sigma ) >= FLT_EPSILON ) {
+            // If sigma does not equal zero, then we use Gaussian smoothing.
+            #ifdef  DARWIN
+            denom = ( float ) sqrt( 2.0 * M_PI * sigma * sigma );
+            #else
+
+            denom = sqrtf( 2.0 * M_PI * sigma * sigma );
+            #endif
+
+            expo = - ( float ) ( ( i - GAUSS_WIDTH ) * ( i - GAUSS_WIDTH ) );
+            expo /= ( 2.0 * sigma * sigma );
+            gaussianCoefs[ i ] = exp( expo / denom );
+
+            // NOTE: Gaussian smoothing just isn't working with low sigma
+            // values.  The problem is that the Gaussian coefficients are
+            // all zero, except for the middle coefficient, which is exactly
+            // one.  Therefore, I'm using boxcar smoothing.
+            gaussianCoefs[ i ] = 1.0 / ( 1.0 + ( 2.0 * ( float ) GAUSS_WIDTH ) );
+            //            printf("gaussianCoefs[%d] is %f\n", i, gaussianCoefs[i]);
+        } else {
+            /* If sigma equals zero (all pixels have the same value)
+             * the above code will divide by zero.  Therefore, we don't need
+             * to smooth the data.
+             */
+            for ( i = 0;i < robustHistogram->nums->n;i++ ) {
+                smooth->data.F32[ i ] = ( float ) robustHistogram->nums->data.S32[ i ];
+            }
+            return ( smooth );
+        }
+    }
+
     // Perform the actual smoothing.
     for ( i = 0;i < robustHistogram->nums->n;i++ ) {
-            smooth->data.F32[ i ] = 0.0;
-            for ( j = -GAUSS_WIDTH;j <= + GAUSS_WIDTH;j++ ) {
-                    if ( ( ( j + i ) >= 0 ) && ( ( j + i ) < smooth->n ) ) {
-                            smooth->data.F32[ i ] += ( gaussianCoefs[ j + GAUSS_WIDTH ] *
-                                                       ( float ) robustHistogram->nums->data.S32[ j + i ] );
-                        }
-                }
-        }
+        smooth->data.F32[ i ] = 0.0;
+        for ( j = -GAUSS_WIDTH;j <= + GAUSS_WIDTH;j++ ) {
+            if ( ( ( j + i ) >= 0 ) && ( ( j + i ) < smooth->n ) ) {
+                smooth->data.F32[ i ] += ( gaussianCoefs[ j + GAUSS_WIDTH ] *
+                                           ( float ) robustHistogram->nums->data.S32[ j + i ] );
+            }
+        }
+    }
     return ( smooth );
 }
@@ -646,9 +646,9 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     // Determine how many data points fit inside this min/max range
     // and are not maxed, IF the maskVector is not NULL>
     nValues = p_psVectorNValues( myVector, maskVector, maskVal, stats );
-    
+
     // Allocate temporary vectors for the data.
     unsortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
@@ -656,51 +656,51 @@
     sortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
     sortedVector->n = sortedVector->nalloc;
-    
+
     // Determine if we must only use data points within a min/max range.
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            rangeMin = stats->min;
-            rangeMax = stats->max;
-            // Store all non-masked data points within the min/max range
-            // into the temporary vectors.
-            count = 0;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                }
+        rangeMin = stats->min;
+        rangeMax = stats->max;
+        // Store all non-masked data points within the min/max range
+        // into the temporary vectors.
+        count = 0;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
         } else {
-            // Store all non-masked data points into the temporary vectors.
-            count = 0;
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
-                        }
-                }
-        }
-        
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
+        }
+    } else {
+        // Store all non-masked data points into the temporary vectors.
+        count = 0;
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
+            }
+        }
+    }
+
     // Sort the temporary vectors.
     psVectorSort( sortedVector, unsortedVector );
-    
+
     // Calculate the quartile points exactly.
     stats->sampleUQ = sortedVector->data.F32[ 3 * ( nValues / 4 ) ];
     stats->sampleLQ = sortedVector->data.F32[ nValues / 4 ];
-    
+
     // Free the temporary data structures.
     psFree( unsortedVector );
@@ -735,64 +735,64 @@
     float rangeMin = 0.0;                       // Exclude data below this
     float rangeMax = 0.0;                       // Exclude date above this
-    
+
     // This procedure requires the mean.  If it has not been already
     // calculated, then call p_psVectorSampleMean()
     if ( 0 != isnan( stats->sampleMean ) ) {
-            p_psVectorSampleMean( myVector, maskVector, maskVal, stats );
-        }
+        p_psVectorSampleMean( myVector, maskVector, maskVal, stats );
+    }
     mean = stats->sampleMean;
-    
+
     if ( stats->options & PS_STAT_USE_RANGE ) {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                                    ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    diff = myVector->data.F32[ i ] - mean;
-                                    sumSquares += ( diff * diff );
-                                    sumDiffs += diff;
-                                    countInt++;
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                                    ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                                    diff = myVector->data.F32[ i ] - mean;
-                                    sumSquares += ( diff * diff );
-                                    sumDiffs += diff;
-                                    countInt++;
-                                }
-                        }
-                    countInt = myVector->n;
-                }
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
+                        ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    diff = myVector->data.F32[ i ] - mean;
+                    sumSquares += ( diff * diff );
+                    sumDiffs += diff;
+                    countInt++;
+                }
+            }
         } else {
-            if ( maskVector != NULL ) {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                                    diff = myVector->data.F32[ i ] - mean;
-                                    sumSquares += ( diff * diff );
-                                    sumDiffs += diff;
-                                    countInt++;
-                                }
-                        }
-                } else {
-                    for ( i = 0;i < myVector->n;i++ ) {
-                            diff = myVector->data.F32[ i ] - mean;
-                            sumSquares += ( diff * diff );
-                            sumDiffs += diff;
-                            countInt++;
-                        }
-                    countInt = myVector->n;
-                }
-        }
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
+                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+                    diff = myVector->data.F32[ i ] - mean;
+                    sumSquares += ( diff * diff );
+                    sumDiffs += diff;
+                    countInt++;
+                }
+            }
+            countInt = myVector->n;
+        }
+    } else {
+        if ( maskVector != NULL ) {
+            for ( i = 0;i < myVector->n;i++ ) {
+                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+                    diff = myVector->data.F32[ i ] - mean;
+                    sumSquares += ( diff * diff );
+                    sumDiffs += diff;
+                    countInt++;
+                }
+            }
+        } else {
+            for ( i = 0;i < myVector->n;i++ ) {
+                diff = myVector->data.F32[ i ] - mean;
+                sumSquares += ( diff * diff );
+                sumDiffs += diff;
+                countInt++;
+            }
+            countInt = myVector->n;
+        }
+    }
     countFloat = ( float ) countInt;
-    
+
     #ifdef DARWIN
-    
+
     stats->sampleStdev = ( float ) sqrt( ( sumSquares - ( sumDiffs *
                                            sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
     #else
-    
+
     stats->sampleStdev = sqrtf( ( sumSquares - ( sumDiffs *
                                   sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
@@ -824,19 +824,19 @@
     float oldStanStdev = 0.0;                   // Temporary variable
     psVector *tmpMask = NULL;                   // Temporary vector
-    
+
     // Endure that stats->clipIter is within the proper range.
     if ( !( ( CLIPPED_NUM_ITER_LB <= stats->clipIter ) &&
             ( stats->clipIter <= CLIPPED_NUM_ITER_UB ) ) ) {
-            psAbort( __func__, "Unallowed value for clipIter (%d).\n",
-                     stats->clipIter );
-        }
-        
+        psAbort( __func__, "Unallowed value for clipIter (%d).\n",
+                 stats->clipIter );
+    }
+
     // Endure that stats->clipSigma is within the proper range.
     if ( !( ( CLIPPED_SIGMA_LB <= stats->clipSigma ) &&
             ( stats->clipSigma <= CLIPPED_SIGMA_UB ) ) ) {
-            psAbort( __func__, "Unallowed value for clipSigma (%f).\n",
-                     stats->clipSigma );
-        }
-        
+        psAbort( __func__, "Unallowed value for clipSigma (%f).\n",
+                 stats->clipSigma );
+    }
+
     // We allocate a temporary mask vector since during the iterative
     // steps that follow, we will be masking off additional data points.
@@ -844,65 +844,65 @@
     tmpMask = psVectorAlloc( myVector->n, PS_TYPE_U8 );
     tmpMask->n = myVector->n;
-    
+
     // If we were called with a mask vector, then initialize the temporary
     // mask vector with those values.
     if ( maskVector != NULL ) {
-            for ( i = 0;i < tmpMask->n;i++ ) {
-                    tmpMask->data.U8[ i ] = maskVector->data.U8[ i ];
-                }
-        }
-        
+        for ( i = 0;i < tmpMask->n;i++ ) {
+            tmpMask->data.U8[ i ] = maskVector->data.U8[ i ];
+        }
+    }
+
     // 1. Compute the sample median.
     // NOTE: This seems odd.  Verify with IfA that we want to calculate the
     // median here, not the mean.
     p_psVectorSampleMedian( myVector, maskVector, maskVal, stats );
-    
+
     // 2. Compute the sample standard deviation.
     p_psVectorSampleStdev( myVector, maskVector, maskVal, stats );
-    
+
     // 3. Use the sample median as the first estimator of the mean X.
     clippedMean = stats->sampleMean;
-    
+
     // 4. Use the sample stdev as the first estimator of the mean stdev.
     clippedStdev = stats->sampleStdev;
-    
+
     // Must save the old sampleMean and sampleStdev since the following code
     // block overwrites them.
     oldStanMean = stats->sampleMean;
     oldStanStdev = stats->sampleStdev;
-    
+
     // 5. Repeat N times:
     for ( i = 0;i < stats->clipIter;i++ ) {
-            for ( j = 0;j < myVector->n;j++ ) {
-                    // a) Exclude all values x_i for which |x_i - x| > K * stdev
-                    if ( fabs( myVector->data.F32[ j ] - clippedMean ) >
-                            ( stats->clipSigma * clippedStdev ) ) {
-                            tmpMask->data.U8[ i ] = 0xff;
-                        }
-                    // b) compute new mean and stdev
-                    p_psVectorSampleMedian( myVector, tmpMask, maskVal, stats );
-                    p_psVectorSampleStdev( myVector, tmpMask, maskVal, stats );
-                    
-                    // c) Use the new mean for x
-                    clippedMean = stats->sampleMean;
-                    
-                    // d) Use the new stdev for stdev
-                    clippedStdev = stats->sampleStdev;
-                }
-                
-        }
+        for ( j = 0;j < myVector->n;j++ ) {
+            // a) Exclude all values x_i for which |x_i - x| > K * stdev
+            if ( fabs( myVector->data.F32[ j ] - clippedMean ) >
+                    ( stats->clipSigma * clippedStdev ) ) {
+                tmpMask->data.U8[ i ] = 0xff;
+            }
+            // b) compute new mean and stdev
+            p_psVectorSampleMedian( myVector, tmpMask, maskVal, stats );
+            p_psVectorSampleStdev( myVector, tmpMask, maskVal, stats );
+
+            // c) Use the new mean for x
+            clippedMean = stats->sampleMean;
+
+            // d) Use the new stdev for stdev
+            clippedStdev = stats->sampleStdev;
+        }
+
+    }
     stats->sampleMean = oldStanMean;
     stats->sampleStdev = oldStanStdev;
-    
+
     // 7. The last calcuated value of x is the cliped mean.
     if ( stats->options & PS_STAT_CLIPPED_MEAN ) {
-            stats->clippedMean = clippedMean;
-        }
-        
+        stats->clippedMean = clippedMean;
+    }
+
     // 8. The last calcuated value of stdev is the cliped stdev.
     if ( stats->options & PS_STAT_CLIPPED_STDEV ) {
-            stats->clippedStdev = clippedStdev;
-        }
-        
+        stats->clippedStdev = clippedStdev;
+    }
+
     psFree( tmpMask );
 }
@@ -918,18 +918,18 @@
     float range = 0.0;
     int i = 0;
-    
+
     for ( i = 0;i < myData->n;i++ ) {
-            if ( myData->data.F32[ i ] < min ) {
-                    min = myData->data.F32[ i ];
-                }
-            if ( myData->data.F32[ i ] > max ) {
-                    max = myData->data.F32[ i ];
-                }
-        }
-        
+        if ( myData->data.F32[ i ] < min ) {
+            min = myData->data.F32[ i ];
+        }
+        if ( myData->data.F32[ i ] > max ) {
+            max = myData->data.F32[ i ];
+        }
+    }
+
     range = max - min;
     for ( i = 0;i < myData->n;i++ ) {
-            myData->data.F32[ i ] = ( myData->data.F32[ i ] - min ) / range;
-        }
+        myData->data.F32[ i ] = ( myData->data.F32[ i ] - min ) / range;
+    }
 }
 
@@ -948,5 +948,5 @@
     float tmp = exp( -( ( x - mean ) * ( x - mean ) ) / ( 2.0 * stdev * stdev ) );
     tmp /= ( ( float ) sqrt( 2.0 * M_PI * ( stdev * stdev ) ) );
-    
+
     //    printf("p_psGaussian((%.2f), %.2f, %.2f) is %.2f\n", x, mean, stdev, tmp);
     return ( tmp );
@@ -965,10 +965,11 @@
     float stdev = myParams->data.F32[ 1 ];
     float tmp = 0.0;
-    
+
     if ( whichParam == 0 ) {
-            // Return the derivative w.r.t. the mean.
-            tmp = ( x - mean ) * p_psGaussian( myData, myParams );
-            tmp /= ( stdev * stdev );
-        } else if ( whichParam == 1 ) {
+        // Return the derivative w.r.t. the mean.
+        tmp = ( x - mean ) * p_psGaussian( myData, myParams );
+        tmp /= ( stdev * stdev );
+    } else
+        if ( whichParam == 1 ) {
             // Return the derivative w.r.t. the stdev.
             tmp = ( x - mean ) * ( x - mean ) * p_psGaussian( myData, myParams );
@@ -976,5 +977,5 @@
         }
     printf( "p_psGaussianDeriv((%.2f), %.2f, %.2f, (%d)) is %.2f\n", x, mean, stdev, whichParam, tmp );
-    
+
     return ( tmp );
 }
@@ -994,5 +995,5 @@
     float C = myParams->data.F32[ 2 ];
     float tmp = 0.0;
-    
+
     tmp = ( A * x * x ) + ( B * x ) + C;
     return ( tmp );
@@ -1009,13 +1010,15 @@
     float x = myCoords->data.F32[ 0 ];
     float tmp = 0.0;
-    
+
     if ( whichParamDeriv == 0 ) {
-            tmp = x * x;
-        } else if ( whichParamDeriv == 1 ) {
+        tmp = x * x;
+    } else
+        if ( whichParamDeriv == 1 ) {
             tmp = x;
-        } else if ( whichParamDeriv == 2 ) {
-            tmp = 1.0;
-        }
-        
+        } else
+            if ( whichParamDeriv == 2 ) {
+                tmp = 1.0;
+            }
+
     return ( tmp );
 }
@@ -1039,27 +1042,27 @@
     float oldMidpoint = 1.0;
     float f = 0.0;
-    
+
     //  printf("p_ps1DPolyMedian(%f, %f, %f) \n", rangeLow, rangeHigh, getThisValue);
-    
+
     while ( numIterations < MAX_ITERATIONS ) {
-            midpoint = ( rangeHigh + rangeLow ) / 2.0;
-            if ( fabs( midpoint - oldMidpoint ) <= FLT_EPSILON ) {
-                    return ( midpoint );
-                }
-            oldMidpoint = midpoint;
-            
-            f = psPolynomial1DEval( midpoint, myPoly );
-            //        printf("p_ps1DPolyMedian() iteration %d.  f(%f) is %f\n", numIterations, midpoint, f);
-            if ( fabs( f - getThisValue ) <= FLT_EPSILON ) {
-                    return ( midpoint );
-                }
-                
-            if ( f > getThisValue ) {
-                    rangeHigh = midpoint;
-                } else {
-                    rangeLow = midpoint;
-                }
-            numIterations++;
-        }
+        midpoint = ( rangeHigh + rangeLow ) / 2.0;
+        if ( fabs( midpoint - oldMidpoint ) <= FLT_EPSILON ) {
+            return ( midpoint );
+        }
+        oldMidpoint = midpoint;
+
+        f = psPolynomial1DEval( midpoint, myPoly );
+        //        printf("p_ps1DPolyMedian() iteration %d.  f(%f) is %f\n", numIterations, midpoint, f);
+        if ( fabs( f - getThisValue ) <= FLT_EPSILON ) {
+            return ( midpoint );
+        }
+
+        if ( f > getThisValue ) {
+            rangeHigh = midpoint;
+        } else {
+            rangeLow = midpoint;
+        }
+        numIterations++;
+    }
     return ( midpoint );
 }
@@ -1082,38 +1085,38 @@
     psVector *yErr = psVectorAlloc( 3, PS_TYPE_F64 );
     psPolynomial1D *myPoly = psPolynomial1DAlloc( 2 );
-    
+
     if ( ( binNum > 0 ) &&
             ( binNum < ( histogram->nums->n + 1 ) ) ) {
-            x->data.F64[ 0 ] = ( double ) 0.5 *
-                               ( histogram->bounds->data.F32[ binNum - 1 ] +
-                                 histogram->bounds->data.F32[ binNum ] );
-            x->data.F64[ 1 ] = ( double ) 0.5 *
-                               ( histogram->bounds->data.F32[ binNum ] +
-                                 histogram->bounds->data.F32[ binNum + 1 ] );
-            x->data.F64[ 2 ] = ( double ) 0.5 *
-                               ( histogram->bounds->data.F32[ binNum + 1 ] +
-                                 histogram->bounds->data.F32[ binNum + 2 ] );
-                                 
-            y->data.F64[ 0 ] = cumulativeSums->data.F32[ binNum - 1 ];
-            y->data.F64[ 1 ] = cumulativeSums->data.F32[ binNum ];
-            y->data.F64[ 2 ] = cumulativeSums->data.F32[ binNum + 1 ];
-            
-            if ( !( ( y->data.F64[ 0 ] <= fitFloat ) &&
-                    ( fitFloat <= y->data.F64[ 2 ] ) ) ) {
-                    psAbort( __func__, "p_psVectorRobustStats(0): midpoint not within y-range\n" );
-                }
-                
-            yErr->data.F64[ 0 ] = 1.0;
-            yErr->data.F64[ 1 ] = 1.0;
-            yErr->data.F64[ 2 ] = 1.0;
-            
-            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-            return ( p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ], x->data.F64[ 2 ],
-                                       fitFloat ) );
-        } else {
-            return ( 0.5 * ( histogram->bounds->data.F32[ binNum + 1 ] +
-                             histogram->bounds->data.F32[ binNum ] ) );
-        }
-        
+        x->data.F64[ 0 ] = ( double ) 0.5 *
+                           ( histogram->bounds->data.F32[ binNum - 1 ] +
+                             histogram->bounds->data.F32[ binNum ] );
+        x->data.F64[ 1 ] = ( double ) 0.5 *
+                           ( histogram->bounds->data.F32[ binNum ] +
+                             histogram->bounds->data.F32[ binNum + 1 ] );
+        x->data.F64[ 2 ] = ( double ) 0.5 *
+                           ( histogram->bounds->data.F32[ binNum + 1 ] +
+                             histogram->bounds->data.F32[ binNum + 2 ] );
+
+        y->data.F64[ 0 ] = cumulativeSums->data.F32[ binNum - 1 ];
+        y->data.F64[ 1 ] = cumulativeSums->data.F32[ binNum ];
+        y->data.F64[ 2 ] = cumulativeSums->data.F32[ binNum + 1 ];
+
+        if ( !( ( y->data.F64[ 0 ] <= fitFloat ) &&
+                ( fitFloat <= y->data.F64[ 2 ] ) ) ) {
+            psAbort( __func__, "p_psVectorRobustStats(0): midpoint not within y-range\n" );
+        }
+
+        yErr->data.F64[ 0 ] = 1.0;
+        yErr->data.F64[ 1 ] = 1.0;
+        yErr->data.F64[ 2 ] = 1.0;
+
+        myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+        return ( p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ], x->data.F64[ 2 ],
+                                   fitFloat ) );
+    } else {
+        return ( 0.5 * ( histogram->bounds->data.F32[ binNum + 1 ] +
+                         histogram->bounds->data.F32[ binNum ] ) );
+    }
+
     psFree( x );
     psFree( y );
@@ -1187,5 +1190,5 @@
     float sumNfit = 0.0;
     float cumulativeMedian = 0.0;
-    
+
     // Compute the initial bin size of the robust histogram.  This is done
     // by computing the clipped standard deviation of the vector, and dividing
@@ -1193,39 +1196,39 @@
     p_psVectorClippedStats( myVector, maskVector, maskVal, tmpStats );
     binSize = tmpStats->clippedStdev / 10.0f;
-    
+
     // If stats->clippedStdev == 0.0, then all data elements have the same
     // value.  Therefore, we can set the appropiate results and return.
     if ( fabs( binSize ) <= FLT_EPSILON ) {
-            if ( stats->options & PS_STAT_ROBUST_MEAN ) {
-                    stats->robustMean = stats->clippedMean;
-                }
-            if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
-                    stats->robustMedian = stats->clippedMean;
-                }
-            if ( stats->options & PS_STAT_ROBUST_MODE ) {
-                    stats->robustMode = stats->clippedMean;
-                }
-            if ( stats->options & PS_STAT_ROBUST_STDEV ) {
-                    stats->robustStdev = 0.0;
-                }
-            if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
-                    stats->robustUQ = stats->clippedMean;
-                    stats->robustLQ = stats->clippedMean;
-                }
-            // XXX: Set these to the number of unmasked data points?
-            stats->robustNfit = 0.0;
-            stats->robustN50 = 0.0;
-            psFree( tmpStats );
-            return ;
-        }
-        
+        if ( stats->options & PS_STAT_ROBUST_MEAN ) {
+            stats->robustMean = stats->clippedMean;
+        }
+        if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
+            stats->robustMedian = stats->clippedMean;
+        }
+        if ( stats->options & PS_STAT_ROBUST_MODE ) {
+            stats->robustMode = stats->clippedMean;
+        }
+        if ( stats->options & PS_STAT_ROBUST_STDEV ) {
+            stats->robustStdev = 0.0;
+        }
+        if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
+            stats->robustUQ = stats->clippedMean;
+            stats->robustLQ = stats->clippedMean;
+        }
+        // XXX: Set these to the number of unmasked data points?
+        stats->robustNfit = 0.0;
+        stats->robustN50 = 0.0;
+        psFree( tmpStats );
+        return ;
+    }
+
     // Determine minimum and maximum values in the data vector.
     if ( isnan( stats->min ) ) {
-            p_psVectorMin( myVector, maskVector, maskVal, stats );
-        }
+        p_psVectorMin( myVector, maskVector, maskVal, stats );
+    }
     if ( isnan( stats->max ) ) {
-            p_psVectorMax( myVector, maskVector, maskVal, stats );
-        }
-        
+        p_psVectorMax( myVector, maskVector, maskVal, stats );
+    }
+
     // Create the histogram structure.  NOTE: we can not specify the bin size
     // precisely since the argument to psHistogramAlloc() is the number of
@@ -1236,20 +1239,20 @@
                                         stats->max,
                                         numBins );
-                                        
+
     // Populate the histogram array.
     psVectorHistogram( robustHistogram, myVector, maskVector, maskVal );
-    
+
     // Smooth the histogram.
     // XXX: is that the right stdev?
     robustHistogramVector = p_psVectorsmoothHistGaussian( robustHistogram,
                             tmpStats->clippedStdev / 4.0f );
-                            
+
     // The following was necessary to fit a gaussian to the data, since
     // gaussian functions produce data between 0.0 and 1.0.
     // p_psNormalizeVector(robustHistogramVector);
-    
+
     /**************************************************************************
     Determine the lower/upper quartiles.
-    **************************************************************************/ 
+    **************************************************************************/
     // We define a vector called "cumulativeRobustSums..." where the value at
     // index position i is equal to the sum of bins 0:i.  This will be used
@@ -1258,35 +1261,35 @@
     cumulativeRobustSumsFullRange->data.F32[ 0 ] = robustHistogramVector->data.F32[ 0 ];
     for ( i = 1;i < robustHistogramVector->n;i++ ) {
-            cumulativeRobustSumsFullRange->data.F32[ i ] =
-                cumulativeRobustSumsFullRange->data.F32[ i - 1 ] +
-                robustHistogramVector->data.F32[ i ];
-        }
+        cumulativeRobustSumsFullRange->data.F32[ i ] =
+            cumulativeRobustSumsFullRange->data.F32[ i - 1 ] +
+            robustHistogramVector->data.F32[ i ];
+    }
     sumRobust = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
-    
+
     // Determine the bin number containing the lower quartile point.
     LQBinNum = -1;
     for ( i = 0;i < cumulativeRobustSumsFullRange->n;i++ ) {
-            if ( cumulativeRobustSumsFullRange->data.F32[ i ] >= ( sumRobust / 4.0 ) ) {
-                    LQBinNum = i;
-                    break;
-                }
-        }
-        
+        if ( cumulativeRobustSumsFullRange->data.F32[ i ] >= ( sumRobust / 4.0 ) ) {
+            LQBinNum = i;
+            break;
+        }
+    }
+
     // Determine the bin number containing the upper quartile point.
     UQBinNum = -1;
     for ( i = cumulativeRobustSumsFullRange->n - 1;i >= 0;i-- ) {
-            if ( cumulativeRobustSumsFullRange->data.F32[ i ] <= ( 3.0 * sumRobust / 4.0 ) ) {
-                    UQBinNum = i;
-                    break;
-                }
-        }
-        
+        if ( cumulativeRobustSumsFullRange->data.F32[ i ] <= ( 3.0 * sumRobust / 4.0 ) ) {
+            UQBinNum = i;
+            break;
+        }
+    }
+
     if ( ( LQBinNum == -1 ) ||
             ( UQBinNum == -1 ) ) {
-            psAbort( __func__, "Could not determine the robust lower/upper quartiles." );
-        }
+        psAbort( __func__, "Could not determine the robust lower/upper quartiles." );
+    }
     /**************************************************************************
     Determine the mode in the range LQ:UQ.
-    **************************************************************************/ 
+    **************************************************************************/
     // Determine the bin with the peak value in the range LQ to UQ.
     maxBinNum = LQBinNum;
@@ -1294,16 +1297,16 @@
     sumN50 = ( float ) robustHistogram->nums->data.S32[ LQBinNum ];
     for ( i = LQBinNum + 1;i <= UQBinNum;i++ ) {
-            if ( robustHistogramVector->data.F32[ i ] > maxBinCount ) {
-                    maxBinNum = i;
-                    maxBinCount = robustHistogramVector->data.F32[ i ];
-                }
-            sumN50 += ( float ) robustHistogram->nums->data.S32[ i ];
-        }
-        
+        if ( robustHistogramVector->data.F32[ i ] > maxBinCount ) {
+            maxBinNum = i;
+            maxBinCount = robustHistogramVector->data.F32[ i ];
+        }
+        sumN50 += ( float ) robustHistogram->nums->data.S32[ i ];
+    }
+
     // XXX: is dL defined as the value at the LQ/UQ, or the bin number?
     dL = ( UQBinNum - LQBinNum ) / 4;
-    
+
     printf( "(LQBinNum, UQBinNum, maxBinNum) is (%d, %d, %d)\n", LQBinNum, UQBinNum, maxBinNum );
-    
+
     /**************************************************************************
     Determine the mean/stdev for the bins in the range mode-dL to mode+dL
@@ -1311,18 +1314,18 @@
     cumulativeRobustSumsDlRange = psVectorAlloc( robustHistogramVector->n, PS_TYPE_F32 );
     for ( i = 0;i < robustHistogramVector->n;i++ ) {
-            cumulativeRobustSumsDlRange->data.F32[ i ] = 0.0;
-        }
+        cumulativeRobustSumsDlRange->data.F32[ i ] = 0.0;
+    }
     sumNfit = 0.0;
     cumulativeMedian = 0.0;
     for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-            if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-                    cumulativeRobustSumsDlRange->data.F32[ i ] =
-                        cumulativeRobustSumsDlRange->data.F32[ i - 1 ] +
-                        robustHistogramVector->data.F32[ i ];
-                    cumulativeMedian += robustHistogramVector->data.F32[ i ];
-                    sumNfit += ( float ) robustHistogram->nums->data.S32[ i ];
-                }
-        }
-        
+        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
+            cumulativeRobustSumsDlRange->data.F32[ i ] =
+                cumulativeRobustSumsDlRange->data.F32[ i - 1 ] +
+                robustHistogramVector->data.F32[ i ];
+            cumulativeMedian += robustHistogramVector->data.F32[ i ];
+            sumNfit += ( float ) robustHistogram->nums->data.S32[ i ];
+        }
+    }
+
     // Calculate the mean of the smoothed robust histogram in the range
     // mode-dL to mode+dL.  We use the midpoint of each bin as the mean for
@@ -1330,43 +1333,43 @@
     myMean = 0.0;
     for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-            if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-                    myMean += ( robustHistogramVector->data.F32[ i ] ) * 0.5 *
-                              ( robustHistogram->bounds->data.F32[ i + 1 ] +
-                                robustHistogram->bounds->data.F32[ i ] );
-                    countFloat += robustHistogramVector->data.F32[ i ];
-                }
-        }
+        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
+            myMean += ( robustHistogramVector->data.F32[ i ] ) * 0.5 *
+                      ( robustHistogram->bounds->data.F32[ i + 1 ] +
+                        robustHistogram->bounds->data.F32[ i ] );
+            countFloat += robustHistogramVector->data.F32[ i ];
+        }
+    }
     myMean /= countFloat;
-    
+
     // Calculate the stdev of the smoothed robust histogram in the range
     // mode-dL to mode+dL.  We use the midpoint of each bin as the mean for
     // that bin.
     for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-            if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-                    diff = ( 0.5 * ( robustHistogram->bounds->data.F32[ i + 1 ] +
-                                     robustHistogram->bounds->data.F32[ i ] ) ) - myMean;
-                    sumSquares += diff * diff * robustHistogramVector->data.F32[ i ];
-                    sumDiffs += diff * robustHistogramVector->data.F32[ i ];
-                }
-        }
+        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
+            diff = ( 0.5 * ( robustHistogram->bounds->data.F32[ i + 1 ] +
+                             robustHistogram->bounds->data.F32[ i ] ) ) - myMean;
+            sumSquares += diff * diff * robustHistogramVector->data.F32[ i ];
+            sumDiffs += diff * robustHistogramVector->data.F32[ i ];
+        }
+    }
     myStdev = sqrt( ( sumSquares - ( sumDiffs * sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
-    
+
     /**************************************************************************
     Set the appropriate members in the output stats struct.
     **************************************************************************/
     if ( stats->options & PS_STAT_ROBUST_MEAN ) {
-            stats->robustMean = myMean;
-        }
-        
+        stats->robustMean = myMean;
+    }
+
     if ( stats->options & PS_STAT_ROBUST_MODE ) {
-            stats->robustMode = 0.5 *
-                                ( robustHistogram->bounds->data.F32[ maxBinNum ] +
-                                  robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
-        }
-        
+        stats->robustMode = 0.5 *
+                            ( robustHistogram->bounds->data.F32[ maxBinNum ] +
+                              robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
+    }
+
     if ( stats->options & PS_STAT_ROBUST_STDEV ) {
-            stats->robustStdev = myStdev;
-        }
-        
+        stats->robustStdev = myStdev;
+    }
+
     // To determine the median (and later, the lower/upper quartile), we fit
     // a quadratic to the three bins surrounding the bin containing the median.
@@ -1374,50 +1377,50 @@
     // the cumulative number of data points in all bins up to, and including,
     // this bin.  We then solve the quadratic for
-    
+
     if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
-            if ( ( maxBinNum > 0 ) && ( maxBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-                    x->data.F64[ 0 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ maxBinNum - 1 ] +
-                                         robustHistogram->bounds->data.F32[ maxBinNum ] );
-                    x->data.F64[ 1 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ maxBinNum ] +
-                                         robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
-                    x->data.F64[ 2 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
-                                         robustHistogram->bounds->data.F32[ maxBinNum + 2 ] );
-                                         
-                    y->data.F64[ 0 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum - 1 ];
-                    y->data.F64[ 1 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum ];
-                    y->data.F64[ 2 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum + 1 ];
-                    
-                    // Ensure that cumulativeMedian/2 is actually within the range of the bins
-                    // we are using.
-                    cumulativeMedian *= 0.5;
-                    if ( !( ( y->data.F64[ 0 ] <= cumulativeMedian ) &&
-                            ( cumulativeMedian <= y->data.F64[ 2 ] ) ) ) {
-                            printf( "((%f), %f, %f)\n", cumulativeMedian, y->data.F64[ 0 ], y->data.F64[ 2 ] );
-                            psAbort( __func__, "p_psVectorRobustStats(1): midpoint not within y-range\n" );
-                        }
-                    // XXX: yErr is not currently used by psVectorFitPolynomial1D().  We
-                    // may have to set this meaningfully later.
-                    yErr->data.F64[ 0 ] = 1.0;
-                    yErr->data.F64[ 1 ] = 1.0;
-                    yErr->data.F64[ 2 ] = 1.0;
-                    
-                    // Determine the coefficients of the polynomial.
-                    myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-                    // Call p_ps1DPolyMedian(), which does a binary search on the
-                    // polynomial, looking for the value x such that
-                    // f(x) = cumulativeMedian.
-                    stats->robustMedian = p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ],
-                                                            x->data.F64[ 2 ], cumulativeMedian );
-                } else {
-                    // If the mode is the first/last histogram bin, then simply use
-                    // the midpoint of that bin.
-                    stats->robustMedian = 0.5 * ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
-                                                  robustHistogram->bounds->data.F32[ maxBinNum ] );
-                }
-        }
-        
+        if ( ( maxBinNum > 0 ) && ( maxBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
+            x->data.F64[ 0 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ maxBinNum - 1 ] +
+                                 robustHistogram->bounds->data.F32[ maxBinNum ] );
+            x->data.F64[ 1 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ maxBinNum ] +
+                                 robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
+            x->data.F64[ 2 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
+                                 robustHistogram->bounds->data.F32[ maxBinNum + 2 ] );
+
+            y->data.F64[ 0 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum - 1 ];
+            y->data.F64[ 1 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum ];
+            y->data.F64[ 2 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum + 1 ];
+
+            // Ensure that cumulativeMedian/2 is actually within the range of the bins
+            // we are using.
+            cumulativeMedian *= 0.5;
+            if ( !( ( y->data.F64[ 0 ] <= cumulativeMedian ) &&
+                    ( cumulativeMedian <= y->data.F64[ 2 ] ) ) ) {
+                printf( "((%f), %f, %f)\n", cumulativeMedian, y->data.F64[ 0 ], y->data.F64[ 2 ] );
+                psAbort( __func__, "p_psVectorRobustStats(1): midpoint not within y-range\n" );
+            }
+            // XXX: yErr is not currently used by psVectorFitPolynomial1D().  We
+            // may have to set this meaningfully later.
+            yErr->data.F64[ 0 ] = 1.0;
+            yErr->data.F64[ 1 ] = 1.0;
+            yErr->data.F64[ 2 ] = 1.0;
+
+            // Determine the coefficients of the polynomial.
+            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+            // Call p_ps1DPolyMedian(), which does a binary search on the
+            // polynomial, looking for the value x such that
+            // f(x) = cumulativeMedian.
+            stats->robustMedian = p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ],
+                                                    x->data.F64[ 2 ], cumulativeMedian );
+        } else {
+            // If the mode is the first/last histogram bin, then simply use
+            // the midpoint of that bin.
+            stats->robustMedian = 0.5 * ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
+                                          robustHistogram->bounds->data.F32[ maxBinNum ] );
+        }
+    }
+
     // The lower/upper quartile calculations are very similar to the median
     // calculations.  We fit a quadratic to the array containing the
@@ -1426,82 +1429,82 @@
     //
     if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
-            countFloat = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
-            
-            if ( ( LQBinNum > 0 ) && ( LQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-                    x->data.F64[ 0 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ LQBinNum - 1 ] +
-                                         robustHistogram->bounds->data.F32[ LQBinNum ] );
-                    x->data.F64[ 1 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ LQBinNum ] +
-                                         robustHistogram->bounds->data.F32[ LQBinNum + 1 ] );
-                    x->data.F64[ 2 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
-                                         robustHistogram->bounds->data.F32[ LQBinNum + 2 ] );
-                                         
-                    y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum - 1 ];
-                    y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum ];
-                    y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum + 1 ];
-                    
-                    if ( !( ( y->data.F64[ 0 ] <= ( countFloat / 4.0 ) ) &&
-                            ( ( countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
-                            psAbort( __func__, "p_psVectorRobustStats(2): midpoint not within y-range\n" );
-                        }
-                        
-                    yErr->data.F64[ 0 ] = 1.0;
-                    yErr->data.F64[ 1 ] = 1.0;
-                    yErr->data.F64[ 2 ] = 1.0;
-                    
-                    myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-                    stats->robustLQ = p_ps1DPolyMedian( myPoly,
-                                                        x->data.F64[ 0 ],
-                                                        x->data.F64[ 2 ],
-                                                        countFloat / 4.0 );
-                                                        
-                } else {
-                    // If the LQ is the first/last histogram bin, then simply use
-                    // the midpoint of that bin.
-                    stats->robustLQ = 0.5 * ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
-                                              robustHistogram->bounds->data.F32[ LQBinNum ] );
-                }
-                
-            if ( ( UQBinNum > 0 ) && ( UQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-                    x->data.F64[ 0 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ UQBinNum - 1 ] +
-                                         robustHistogram->bounds->data.F32[ UQBinNum ] );
-                    x->data.F64[ 1 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ UQBinNum ] +
-                                         robustHistogram->bounds->data.F32[ UQBinNum + 1 ] );
-                    x->data.F64[ 2 ] = ( double ) 0.5 *
-                                       ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
-                                         robustHistogram->bounds->data.F32[ UQBinNum + 2 ] );
-                                         
-                    y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum - 1 ];
-                    y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum ];
-                    y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum + 1 ];
-                    
-                    if ( !( ( y->data.F64[ 0 ] <= ( 3.0 * countFloat / 4.0 ) ) &&
-                            ( ( 3.0 * countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
-                            psAbort( __func__, "p_psVectorRobustStats(3): midpoint not within y-range\n" );
-                        }
-                        
-                    yErr->data.F64[ 0 ] = 1.0;
-                    yErr->data.F64[ 1 ] = 1.0;
-                    yErr->data.F64[ 2 ] = 1.0;
-                    
-                    myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-                    stats->robustUQ = p_ps1DPolyMedian( myPoly,
-                                                        x->data.F64[ 0 ],
-                                                        x->data.F64[ 2 ],
-                                                        3.0 * countFloat / 4.0 );
-                } else {
-                    // If the UQ is the first/last histogram bin, then simply use
-                    // the midpoint of that bin.
-                    stats->robustUQ = 0.5 * ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
-                                              robustHistogram->bounds->data.F32[ UQBinNum ] );
-                }
-        }
+        countFloat = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
+
+        if ( ( LQBinNum > 0 ) && ( LQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
+            x->data.F64[ 0 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ LQBinNum - 1 ] +
+                                 robustHistogram->bounds->data.F32[ LQBinNum ] );
+            x->data.F64[ 1 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ LQBinNum ] +
+                                 robustHistogram->bounds->data.F32[ LQBinNum + 1 ] );
+            x->data.F64[ 2 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
+                                 robustHistogram->bounds->data.F32[ LQBinNum + 2 ] );
+
+            y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum - 1 ];
+            y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum ];
+            y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum + 1 ];
+
+            if ( !( ( y->data.F64[ 0 ] <= ( countFloat / 4.0 ) ) &&
+                    ( ( countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
+                psAbort( __func__, "p_psVectorRobustStats(2): midpoint not within y-range\n" );
+            }
+
+            yErr->data.F64[ 0 ] = 1.0;
+            yErr->data.F64[ 1 ] = 1.0;
+            yErr->data.F64[ 2 ] = 1.0;
+
+            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+            stats->robustLQ = p_ps1DPolyMedian( myPoly,
+                                                x->data.F64[ 0 ],
+                                                x->data.F64[ 2 ],
+                                                countFloat / 4.0 );
+
+        } else {
+            // If the LQ is the first/last histogram bin, then simply use
+            // the midpoint of that bin.
+            stats->robustLQ = 0.5 * ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
+                                      robustHistogram->bounds->data.F32[ LQBinNum ] );
+        }
+
+        if ( ( UQBinNum > 0 ) && ( UQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
+            x->data.F64[ 0 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ UQBinNum - 1 ] +
+                                 robustHistogram->bounds->data.F32[ UQBinNum ] );
+            x->data.F64[ 1 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ UQBinNum ] +
+                                 robustHistogram->bounds->data.F32[ UQBinNum + 1 ] );
+            x->data.F64[ 2 ] = ( double ) 0.5 *
+                               ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
+                                 robustHistogram->bounds->data.F32[ UQBinNum + 2 ] );
+
+            y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum - 1 ];
+            y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum ];
+            y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum + 1 ];
+
+            if ( !( ( y->data.F64[ 0 ] <= ( 3.0 * countFloat / 4.0 ) ) &&
+                    ( ( 3.0 * countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
+                psAbort( __func__, "p_psVectorRobustStats(3): midpoint not within y-range\n" );
+            }
+
+            yErr->data.F64[ 0 ] = 1.0;
+            yErr->data.F64[ 1 ] = 1.0;
+            yErr->data.F64[ 2 ] = 1.0;
+
+            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+            stats->robustUQ = p_ps1DPolyMedian( myPoly,
+                                                x->data.F64[ 0 ],
+                                                x->data.F64[ 2 ],
+                                                3.0 * countFloat / 4.0 );
+        } else {
+            // If the UQ is the first/last histogram bin, then simply use
+            // the midpoint of that bin.
+            stats->robustUQ = 0.5 * ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
+                                      robustHistogram->bounds->data.F32[ UQBinNum ] );
+        }
+    }
     stats->robustNfit = sumNfit;
     stats->robustN50 = sumN50;
-    
+
     psFree( x );
     psFree( y );
@@ -1576,5 +1579,5 @@
 {
     psStats * newStruct = NULL;
-    
+
     newStruct = ( psStats * ) psAlloc( sizeof( psStats ) );
     newStruct->sampleMean = NAN;
@@ -1600,5 +1603,5 @@
     newStruct->binsize = NAN;
     newStruct->options = options;
-    
+
     return ( newStruct );
 }
@@ -1623,18 +1626,18 @@
     psHistogram *newHist = NULL;        // The new histogram structure
     float binSize = 0.0;                // The histogram bin size
-    
+
     // NOTE: Verify that this is the correct action.
     if ( n == 0 ) {
-            return ( NULL );
-        }
+        return ( NULL );
+    }
     if ( n < 0 ) {
-            psAbort( __func__, "psHistogramAlloc() called with bin size %d.\n", n );
-        }
-        
+        psAbort( __func__, "psHistogramAlloc() called with bin size %d.\n", n );
+    }
+
     // NOTE: Verify that this is the correct action.
     if ( lower > upper ) {
-            return ( NULL );
-        }
-        
+        return ( NULL );
+    }
+
     // Allocate memory for the new histogram structure.  If there are N
     // bins, then there are N+1 bounds to those bins.
@@ -1643,5 +1646,5 @@
     newHist->bounds = psVectorAlloc( n + 1, PS_TYPE_F32 );
     newHist->bounds->n = newHist->bounds->nalloc;
-    
+
     // Calculate the bounds for each bin.
     binSize = ( upper - lower ) / ( float ) n;
@@ -1650,19 +1653,19 @@
     binSize += FLT_EPSILON;
     for ( i = 0;i < n + 1;i++ ) {
-            newHist->bounds->data.F32[ i ] = lower + ( binSize * ( float ) i );
-        }
-        
+        newHist->bounds->data.F32[ i ] = lower + ( binSize * ( float ) i );
+    }
+
     // Allocate the bins, and initialize them to zero.
     newHist->nums = psVectorAlloc( n, PS_TYPE_U32 );
     newHist->nums->n = newHist->nums->nalloc;
     for ( i = 0;i < newHist->nums->n;i++ ) {
-            newHist->nums->data.U32[ i ] = 0;
-        }
-        
+        newHist->nums->data.U32[ i ] = 0;
+    }
+
     // Initialize the other members.
     newHist->minNum = 0;
     newHist->maxNum = 0;
     newHist->uniform = true;
-    
+
     return ( newHist );
 }
@@ -1681,22 +1684,22 @@
     psHistogram * newHist = NULL;        // The new histogram structure
     int i;                              // Loop index variable
-    
+
     // NOTE: Verify that this is the correct action.
     if ( bounds == NULL ) {
-            // psAbort(__func__, "psHistogram requested with NULL bounds");
-            return ( NULL );
-        }
-        
+        // psAbort(__func__, "psHistogram requested with NULL bounds");
+        return ( NULL );
+    }
+
     // NOTE: Verify that this is the correct action.
     if ( bounds->n <= 1 ) {
-            // psAbort(__func__, "psHistogram requested with NULL bounds");
-            return ( NULL );
-        }
-        
+        // psAbort(__func__, "psHistogram requested with NULL bounds");
+        return ( NULL );
+    }
+
     if ( bounds->type.type != PS_TYPE_F32 ) {
-            // psAbort(__func__, "psHistogram request a bound which is not type F32");
-            return ( NULL );
-        }
-        
+        // psAbort(__func__, "psHistogram request a bound which is not type F32");
+        return ( NULL );
+    }
+
     // Allocate memory for the new histogram structure.
     newHist = ( psHistogram * ) psAlloc( sizeof( psHistogram ) );
@@ -1705,7 +1708,7 @@
     newHist->bounds->n = newHist->bounds->nalloc;
     for ( i = 0;i < bounds->n;i++ ) {
-            newHist->bounds->data.F32[ i ] = bounds->data.F32[ i ];
-        }
-        
+        newHist->bounds->data.F32[ i ] = bounds->data.F32[ i ];
+    }
+
     // Allocate the bins, and initialize them to zero.  If there are N bounds,
     // then there are N-1 bins.
@@ -1713,12 +1716,12 @@
     newHist->nums->n = newHist->nums->nalloc;
     for ( i = 0;i < newHist->nums->n;i++ ) {
-            newHist->nums->data.U32[ i ] = 0;
-        }
-        
+        newHist->nums->data.U32[ i ] = 0;
+    }
+
     // Initialize the other members.
     newHist->minNum = 0;
     newHist->maxNum = 0;
     newHist->uniform = false;
-    
+
     return ( newHist );
 }
@@ -1755,89 +1758,90 @@
     int binNum = 0;                             // A temporary bin number
     int numBins = 0;                            // The total number of bins
-    
+
     // NOTE: Verify that this is the correct action.
     if ( out == NULL ) {
-            return ( NULL );
-        }
-        
+        return ( NULL );
+    }
+
     // Check the specified output histogram for type psF32
     if ( out->bounds->type.type != PS_TYPE_F32 ) {
-            psAbort( __func__,
-                     "Only data type PS_TYPE_F32 for the output.bounds member." );
-        }
-        
+        psAbort( __func__,
+                 "Only data type PS_TYPE_F32 for the output.bounds member." );
+    }
+
     if ( out->nums->type.type != PS_TYPE_U32 ) {
-            psAbort( __func__,
-                     "Only data type PS_TYPE_U32 for output.nums member." );
-        }
-        
+        psAbort( __func__,
+                 "Only data type PS_TYPE_U32 for output.nums member." );
+    }
+
     // NOTE: Verify that this is the correct action.
     if ( in == NULL ) {
-            return ( out );
-        }
-        
+        return ( out );
+    }
+
     if ( in->type.type != PS_TYPE_F32 ) {
+        psAbort( __func__,
+                 "Only data type PS_TYPE_F32 is currently supported (0x%x).",
+                 in->type.type );
+    }
+
+    if ( mask != NULL ) {
+        if ( in->n != mask->n ) {
             psAbort( __func__,
-                     "Only data type PS_TYPE_F32 is currently supported (0x%x).",
-                     in->type.type );
-        }
-        
-    if ( mask != NULL ) {
-            if ( in->n != mask->n ) {
-                    psAbort( __func__,
-                             "Vector data and vector mask are of different sizes." );
-                }
-            if ( mask->type.type != PS_TYPE_U8 ) {
-                    psAbort( __func__, "Vector mask must be type PS_TYPE_U8" );
-                }
-        }
+                     "Vector data and vector mask are of different sizes." );
+        }
+        if ( mask->type.type != PS_TYPE_U8 ) {
+            psAbort( __func__, "Vector mask must be type PS_TYPE_U8" );
+        }
+    }
     // NOTE: determine the correct action for a variety of other cases:
     // in vector has 0 elements, and histogram structure has zero bins.
-    
+
     numBins = out->nums->n;
     for ( i = 0;i < in->n;i++ ) {
-            // Check if this pixel is masked, and if so, skip it.
-            if ( ( mask == NULL ) ||
-                    ( ( mask != NULL ) && ( !( mask->data.U8[ i ] & maskVal ) ) ) ) {
-                    // Check if this pixel is below the minimum value, and if so
-                    // count it, then skip it.
-                    if ( in->data.F32[ i ] < out->bounds->data.F32[ 0 ] ) {
-                            out->minNum++;
-                            // Check if this pixel is above the maximum value, and if so
-                            // count it, then skip it.
-                        } else if ( in->data.F32[ i ] > out->bounds->data.F32[ numBins ] ) {
-                            out->maxNum++;
-                        } else {
-                            // If this is a uniform histogram, determining the correct
-                            // number is trivial.
-                            if ( out->uniform == true ) {
-                                    binSize = out->bounds->data.F32[ 1 ] - out->bounds->data.F32[ 0 ];
-                                    binNum = ( int ) ( ( in->data.F32[ i ] - out->bounds->data.F32[ 0 ] ) /
-                                                       binSize );
-                                                       
-                                    // NOTE: This next if-statement really shouldn't be necessary.
-                                    // However, do to numerical lack of precision, we occasionally
-                                    // produce a binNum outside the range of bins.
-                                    if ( binNum >= out->nums->n ) {
-                                            binNum = out->nums->n - 1;
-                                        }
-                                        
-                                    ( out->nums->data.S32[ binNum ] ) ++;
-                                    
-                                    // If this is a non-uniform histogram, determining the correct
-                                    // bin number requires a bit more work.
-                                } else {
-                                    // NOTE: This is slow.  Put a smarter algorithm here to
-                                    // find the correct bin number (bin search, probably)
-                                    for ( j = 0;j < ( out->bounds->n ) - 1;j++ ) {
-                                            if ( ( out->bounds->data.S32[ j ] <= in->data.F32[ i ] ) &&
-                                                    ( in->data.F32[ i ] <= out->bounds->data.S32[ j + 1 ] ) ) {
-                                                    ( out->nums->data.S32[ j ] ) ++;
-                                                }
-                                        }
-                                }
+        // Check if this pixel is masked, and if so, skip it.
+        if ( ( mask == NULL ) ||
+                ( ( mask != NULL ) && ( !( mask->data.U8[ i ] & maskVal ) ) ) ) {
+            // Check if this pixel is below the minimum value, and if so
+            // count it, then skip it.
+            if ( in->data.F32[ i ] < out->bounds->data.F32[ 0 ] ) {
+                out->minNum++;
+                // Check if this pixel is above the maximum value, and if so
+                // count it, then skip it.
+            } else
+                if ( in->data.F32[ i ] > out->bounds->data.F32[ numBins ] ) {
+                    out->maxNum++;
+                } else {
+                    // If this is a uniform histogram, determining the correct
+                    // number is trivial.
+                    if ( out->uniform == true ) {
+                        binSize = out->bounds->data.F32[ 1 ] - out->bounds->data.F32[ 0 ];
+                        binNum = ( int ) ( ( in->data.F32[ i ] - out->bounds->data.F32[ 0 ] ) /
+                                           binSize );
+
+                        // NOTE: This next if-statement really shouldn't be necessary.
+                        // However, do to numerical lack of precision, we occasionally
+                        // produce a binNum outside the range of bins.
+                        if ( binNum >= out->nums->n ) {
+                            binNum = out->nums->n - 1;
                         }
-                }
-        }
+
+                        ( out->nums->data.S32[ binNum ] ) ++;
+
+                        // If this is a non-uniform histogram, determining the correct
+                        // bin number requires a bit more work.
+                    } else {
+                        // NOTE: This is slow.  Put a smarter algorithm here to
+                        // find the correct bin number (bin search, probably)
+                        for ( j = 0;j < ( out->bounds->n ) - 1;j++ ) {
+                            if ( ( out->bounds->data.S32[ j ] <= in->data.F32[ i ] ) &&
+                                    ( in->data.F32[ i ] <= out->bounds->data.S32[ j + 1 ] ) ) {
+                                ( out->nums->data.S32[ j ] ) ++;
+                            }
+                        }
+                    }
+                }
+        }
+    }
     return ( out );
 }
@@ -1859,25 +1863,28 @@
     int i = 0;
     psVector *tmp = NULL;
-    
+
     if ( in->type.type == PS_TYPE_S32 ) {
+        tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
+        for ( i = 0;i < in->n;i++ ) {
+            tmp->data.F32[ i ] = ( float ) in->data.S32[ i ];
+        }
+    } else
+        if ( in->type.type == PS_TYPE_U32 ) {
             tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
             for ( i = 0;i < in->n;i++ ) {
-                    tmp->data.F32[ i ] = ( float ) in->data.S32[ i ];
-                }
-        } else if ( in->type.type == PS_TYPE_U32 ) {
-            tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-            for ( i = 0;i < in->n;i++ ) {
-                    tmp->data.F32[ i ] = ( float ) in->data.U32[ i ];
-                }
-        } else if ( in->type.type == PS_TYPE_F64 ) {
-            tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-            for ( i = 0;i < in->n;i++ ) {
+                tmp->data.F32[ i ] = ( float ) in->data.U32[ i ];
+            }
+        } else
+            if ( in->type.type == PS_TYPE_F64 ) {
+                tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
+                for ( i = 0;i < in->n;i++ ) {
                     tmp->data.F32[ i ] = ( float ) in->data.F64[ i ];
                 }
-        } else if ( in->type.type == PS_TYPE_F32 ) {
-            // do nothing
-        } else {
-            psAbort( __func__, "unsupported vector type 0x%x\n", in->type.type );
-        }
+            } else
+                if ( in->type.type == PS_TYPE_F32 ) {
+                    // do nothing
+                } else {
+                    psAbort( __func__, "unsupported vector type 0x%x\n", in->type.type );
+                }
     return ( tmp );
 }
@@ -1908,57 +1915,57 @@
     psVector * inF32;
     int mustFreeTmp = 1;
-    
+
     // NOTE: Verify that this is the correct action.
     if ( in == NULL ) {
-            return ( stats );
-        }
+        return ( stats );
+    }
     if ( stats == NULL ) {
-            return ( NULL );
-        }
-        
+        return ( NULL );
+    }
+
     inF32 = p_psConvertToF32( stats, in, mask, maskVal );
     if ( inF32 == NULL ) {
-            inF32 = in;
-            mustFreeTmp = 0;
-        }
-        
+        inF32 = in;
+        mustFreeTmp = 0;
+    }
+
     // XXX: Should we abort if (stats->min == stats->max)?
     if ( ( stats->options & PS_STAT_USE_RANGE ) &&
             ( stats->min >= stats->max ) ) {
-            psAbort( __func__, "psVectorStats() called with range: %f to %f\n",
-                     stats->min, stats->max );
-        }
-        
+        psAbort( __func__, "psVectorStats() called with range: %f to %f\n",
+                 stats->min, stats->max );
+    }
+
     //    PS_CHECK_VECTOR_TYPE(in, PS_TYPE_F32);
     if ( mask != NULL ) {
-            PS_CHECK_NULL_VECTOR( mask );
-            PS_CHECK_EMPTY_VECTOR( mask );
-            PS_CHECK_VECTOR_SIZE_EQUAL( mask, in );
-            PS_CHECK_VECTOR_TYPE( mask, PS_TYPE_U8 );
-        }
-        
+        PS_CHECK_NULL_VECTOR( mask );
+        PS_CHECK_EMPTY_VECTOR( mask );
+        PS_CHECK_VECTOR_SIZE_EQUAL( mask, in );
+        PS_CHECK_VECTOR_TYPE( mask, PS_TYPE_U8 );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_SAMPLE_MEAN ) {
-            p_psVectorSampleMean( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorSampleMean( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_SAMPLE_MEDIAN ) {
-            p_psVectorSampleMedian( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorSampleMedian( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     // NOTE: The Stdev calculation requires the mean.  Should we assume the
     // mean has already been calculated?  Or should we always calculate it?
     if ( stats->options & PS_STAT_SAMPLE_STDEV ) {
-            p_psVectorSampleMean( in, mask, maskVal, stats );
-            p_psVectorSampleStdev( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorSampleMean( in, mask, maskVal, stats );
+        p_psVectorSampleStdev( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_SAMPLE_QUARTILE ) {
-            p_psVectorSampleQuartiles( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorSampleQuartiles( in, mask, maskVal, stats );
+    }
+
     // Since the various robust stats quantities share much computation, they
     // are grouped together in a single private function:
@@ -1969,25 +1976,25 @@
             ( stats->options & PS_STAT_ROBUST_STDEV ) ||
             ( stats->options & PS_STAT_ROBUST_QUARTILE ) ) {
-            p_psVectorRobustStats( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorRobustStats( in, mask, maskVal, stats );
+    }
+
     if ( ( stats->options & PS_STAT_CLIPPED_MEAN ) ||
             ( stats->options & PS_STAT_CLIPPED_STDEV ) ) {
-            p_psVectorClippedStats( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorClippedStats( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_MAX ) {
-            p_psVectorMax( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorMax( in, mask, maskVal, stats );
+    }
+
     // ************************************************************************
     if ( stats->options & PS_STAT_MIN ) {
-            p_psVectorMin( in, mask, maskVal, stats );
-        }
-        
+        p_psVectorMin( in, mask, maskVal, stats );
+    }
+
     if ( mustFreeTmp == 1 ) {
-            psFree( inF32 );
-        }
+        psFree( inF32 );
+    }
     return ( stats );
 }
Index: /trunk/psLib/src/math/psStats.h
===================================================================
--- /trunk/psLib/src/math/psStats.h	(revision 1384)
+++ /trunk/psLib/src/math/psStats.h	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-29 01:59:06 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 1384)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 20:42:22 $
+ *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/mathtypes/psImage.h
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.h	(revision 1384)
+++ /trunk/psLib/src/mathtypes/psImage.h	(revision 1385)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 20:42:22 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/mathtypes/psScalar.c
===================================================================
--- /trunk/psLib/src/mathtypes/psScalar.c	(revision 1384)
+++ /trunk/psLib/src/mathtypes/psScalar.c	(revision 1385)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-01 00:14:40 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/mathtypes/psScalar.h
===================================================================
--- /trunk/psLib/src/mathtypes/psScalar.h	(revision 1384)
+++ /trunk/psLib/src/mathtypes/psScalar.h	(revision 1385)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-18 23:36:02 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.c	(revision 1384)
+++ /trunk/psLib/src/mathtypes/psVector.c	(revision 1385)
@@ -8,6 +8,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-07-31 02:28:10 $
+*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -63,25 +63,25 @@
     psVector * psVec = NULL;
     int elementSize = 0;
-    
+
     // Invalid nalloc
     if ( nalloc < 1 ) {
-            psError( __func__, "Invalid value for nalloc. nalloc: %d\n", nalloc );
-            return NULL;
-        }
-        
+        psError( __func__, "Invalid value for nalloc. nalloc: %d\n", nalloc );
+        return NULL;
+    }
+
     elementSize = PSELEMTYPE_SIZEOF( elemType );
-    
+
     // Create vector struct
     psVec = ( psVector * ) psAlloc( sizeof( psVector ) );
     p_psMemSetDeallocator( psVec, ( psFreeFcn ) vectorFree );
-    
+
     psVec->type.dimen = PS_DIMEN_VECTOR;
     psVec->type.type = elemType;
     psVec->nalloc = nalloc;
     psVec->n = nalloc;
-    
+
     // Create vector data array
     psVec->data.V = psAlloc( nalloc * elementSize );
-    
+
     return psVec;
 }
@@ -91,26 +91,27 @@
     int elementSize = 0;
     psElemType elemType;
-    
+
     // Invalid nalloc
     if ( nalloc < 1 ) {
-            psError( __func__, "Invalid value for realloc (%d)\n", nalloc );
-            return NULL;
-        }
-        
+        psError( __func__, "Invalid value for realloc (%d)\n", nalloc );
+        return NULL;
+    }
+
     if ( in == NULL ) {
-            psError( __func__, "Null input vector\n" );
-            return NULL;
-        } else if ( in->nalloc != nalloc ) {                    // No need to realloc to same size
+        psError( __func__, "Null input vector\n" );
+        return NULL;
+    } else
+        if ( in->nalloc != nalloc ) {                    // No need to realloc to same size
             elemType = in->type.type;
             elementSize = PSELEMTYPE_SIZEOF( elemType );
             if ( nalloc < in->n ) {
-                    in->n = nalloc;
-                }
-                
+                in->n = nalloc;
+            }
+
             // Realloc after decrementation to avoid accessing freed array elements
             in->data.V = psRealloc( in->data.V, nalloc * elementSize );
             in->nalloc = nalloc;
         }
-        
+
     return in;
 }
@@ -119,30 +120,30 @@
 {
     psElemType elemType;
-    
+
     if ( in == NULL ) {
-            return psVectorAlloc( nalloc, type );
-        }
-        
+        return psVectorAlloc( nalloc, type );
+    }
+
     elemType = in->type.type;
-    
+
     if ( in->nalloc == nalloc && elemType == type ) {
-            // it is proper size/type already
-            return in;
-        }
-        
+        // it is proper size/type already
+        return in;
+    }
+
     // Invalid nalloc
     if ( nalloc < 1 ) {
-            psError( __func__, "Invalid value for nalloc (%d)\n", nalloc );
-            psFree( in );
-            return NULL;
-        }
-        
-        
+        psError( __func__, "Invalid value for nalloc (%d)\n", nalloc );
+        psFree( in );
+        return NULL;
+    }
+
+
     in->data.V = psRealloc( in->data.V, nalloc * PSELEMTYPE_SIZEOF( type ) );
-    
+
     in->type.type = type;
     in->nalloc = nalloc;
     in->n = nalloc;
-    
+
     return in;
 }
@@ -156,84 +157,84 @@
     void *outVec = NULL;
     psElemType inType = 0;
-    
+
     if ( inVector == NULL ) {
-            psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
+        return outVector;
+    }
+
     inType = inVector->type.type;
     inN = inVector->n;
     inVec = inVector->data.V;
     elSize = PSELEMTYPE_SIZEOF( inType );
-    
+
     if ( outVector == NULL ) {
-            outVector = psVectorAlloc( inN, inType );
-            outVector->n = inVector->n;
-        }
-        
+        outVector = psVectorAlloc( inN, inType );
+        outVector->n = inVector->n;
+    }
+
     outN = outVector->n;
     outVec = outVector->data.V;
-    
+
     if ( inN != outN ) {
-            psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
-                     inN, outN );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
+                 inN, outN );
+        return outVector;
+    }
+
     if ( inType != outVector->type.type ) {
-            psError( __func__, " : Line %d - Input and output vectors are not same type: in=%d out=%d\n", __LINE__,
-                     inType, outVector->type.type );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Input and output vectors are not same type: in=%d out=%d\n", __LINE__,
+                 inType, outVector->type.type );
+        return outVector;
+    }
+
     if ( inN == 0 ) {
-            psError( __func__, " : Line %d - No elements in use for input vector\n", __LINE__ );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - No elements in use for input vector\n", __LINE__ );
+        return outVector;
+    }
+
     if ( outN == 0 ) {
-            psError( __func__, " : Line %d - No elements in use for output vector\n", __LINE__ );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - No elements in use for output vector\n", __LINE__ );
+        return outVector;
+    }
+
     // Copy input vector values into output vector
     memcpy( outVec, inVec, elSize * outN );
-    
+
     // Sort output vector
     switch ( inType ) {
-            case PS_TYPE_U8:
-            qsort( outVec, inN, elSize, psCompareU8 );
-            break;
-            case PS_TYPE_U16:
-            qsort( outVec, inN, elSize, psCompareU16 );
-            break;
-            case PS_TYPE_U32:
-            qsort( outVec, inN, elSize, psCompareU32 );
-            break;
-            case PS_TYPE_U64:
-            qsort( outVec, inN, elSize, psCompareU64 );
-            break;
-            case PS_TYPE_S8:
-            qsort( outVec, inN, elSize, psCompareS8 );
-            break;
-            case PS_TYPE_S16:
-            qsort( outVec, inN, elSize, psCompareS16 );
-            break;
-            case PS_TYPE_S32:
-            qsort( outVec, inN, elSize, psCompareS32 );
-            break;
-            case PS_TYPE_S64:
-            qsort( outVec, inN, elSize, psCompareS64 );
-            break;
-            case PS_TYPE_F32:
-            qsort( outVec, inN, elSize, psCompareF32 );
-            break;
-            case PS_TYPE_F64:
-            qsort( outVec, inN, elSize, psCompareF64 );
-            break;
-            default:
-            psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
-        }
-        
+    case PS_TYPE_U8:
+        qsort( outVec, inN, elSize, psCompareU8 );
+        break;
+    case PS_TYPE_U16:
+        qsort( outVec, inN, elSize, psCompareU16 );
+        break;
+    case PS_TYPE_U32:
+        qsort( outVec, inN, elSize, psCompareU32 );
+        break;
+    case PS_TYPE_U64:
+        qsort( outVec, inN, elSize, psCompareU64 );
+        break;
+    case PS_TYPE_S8:
+        qsort( outVec, inN, elSize, psCompareS8 );
+        break;
+    case PS_TYPE_S16:
+        qsort( outVec, inN, elSize, psCompareS16 );
+        break;
+    case PS_TYPE_S32:
+        qsort( outVec, inN, elSize, psCompareS32 );
+        break;
+    case PS_TYPE_S64:
+        qsort( outVec, inN, elSize, psCompareS64 );
+        break;
+    case PS_TYPE_F32:
+        qsort( outVec, inN, elSize, psCompareF32 );
+        break;
+    case PS_TYPE_F64:
+        qsort( outVec, inN, elSize, psCompareF64 );
+        break;
+    default:
+        psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
+    }
+
     return outVector;
 }
@@ -241,13 +242,13 @@
 #define SORT_INDICES(TYPE)                                                                                   \
 for(i=0; i<inN; i++) {                                                                                       \
-        for(j=0; j<inN; j++) {                                                                                   \
-                diff = fabs((double)tmpVector->data.TYPE[i] - inVec[j]);                                             \
-                if(diff < FLT_EPSILON) {                                                                             \
-                        outVec[i] = j;                                                                                   \
-                        break;                                                                                           \
-                    }                                                                                                    \
-            }                                                                                                        \
-    }
-    
+    for(j=0; j<inN; j++) {                                                                                   \
+        diff = fabs((double)tmpVector->data.TYPE[i] - inVec[j]);                                             \
+        if(diff < FLT_EPSILON) {                                                                             \
+            outVec[i] = j;                                                                                   \
+            break;                                                                                           \
+        }                                                                                                    \
+    }                                                                                                        \
+}
+
 psVector *psVectorSortIndex( psVector *restrict outVector, const psVector *restrict inVector )
 {
@@ -261,77 +262,77 @@
     psVector *tmpVector = NULL;
     psElemType inType = 0;
-    
+
     if ( inVector == NULL ) {
-            psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
+        return outVector;
+    }
+
     inN = inVector->n;
     inVec = inVector->data.V;
     inType = inVector->type.type;
-    
+
     if ( outVector == NULL ) {
-            outVector = psVectorAlloc( inN, PS_TYPE_U32 );
-            outVector->n = inN;
-        }
-        
+        outVector = psVectorAlloc( inN, PS_TYPE_U32 );
+        outVector->n = inN;
+    }
+
     outN = outVector->n;
     outVec = outVector->data.V;
-    
+
     if ( inN != outN ) {
-            psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
-                     __LINE__, inN, outN );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
+                 __LINE__, inN, outN );
+        return outVector;
+    }
+
     if ( outVector->type.type != PS_TYPE_U32 ) {
-            psError( __func__, " : Line %d - Output vector is not of type U32: out=%d\n",
-                     __LINE__, outVector->type.type );
-            return outVector;
-        }
-        
+        psError( __func__, " : Line %d - Output vector is not of type U32: out=%d\n",
+                 __LINE__, outVector->type.type );
+        return outVector;
+    }
+
     tmpVector = psVectorAlloc( inN, inType );
     tmpVector->n = inN;
     tmpVector = psVectorSort( tmpVector, inVector );
-    
+
     // Sort output vector
     switch ( inType ) {
-            case PS_TYPE_U8:
-            SORT_INDICES( U8 );
-            break;
-            case PS_TYPE_U16:
-            SORT_INDICES( U16 );
-            break;
-            case PS_TYPE_U32:
-            SORT_INDICES( U32 );
-            break;
-            case PS_TYPE_U64:
-            SORT_INDICES( U64 );
-            break;
-            case PS_TYPE_S8:
-            SORT_INDICES( S8 );
-            break;
-            case PS_TYPE_S16:
-            SORT_INDICES( S16 );
-            break;
-            case PS_TYPE_S32:
-            SORT_INDICES( S32 );
-            break;
-            case PS_TYPE_S64:
-            SORT_INDICES( S64 );
-            break;
-            case PS_TYPE_F32:
-            SORT_INDICES( F32 );
-            break;
-            case PS_TYPE_F64:
-            SORT_INDICES( F64 );
-            break;
-            default:
-            psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
-        }
-        
+    case PS_TYPE_U8:
+        SORT_INDICES( U8 );
+        break;
+    case PS_TYPE_U16:
+        SORT_INDICES( U16 );
+        break;
+    case PS_TYPE_U32:
+        SORT_INDICES( U32 );
+        break;
+    case PS_TYPE_U64:
+        SORT_INDICES( U64 );
+        break;
+    case PS_TYPE_S8:
+        SORT_INDICES( S8 );
+        break;
+    case PS_TYPE_S16:
+        SORT_INDICES( S16 );
+        break;
+    case PS_TYPE_S32:
+        SORT_INDICES( S32 );
+        break;
+    case PS_TYPE_S64:
+        SORT_INDICES( S64 );
+        break;
+    case PS_TYPE_F32:
+        SORT_INDICES( F32 );
+        break;
+    case PS_TYPE_F64:
+        SORT_INDICES( F64 );
+        break;
+    default:
+        psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
+    }
+
     // Free temp memory
     psFree( tmpVector );
-    
+
     return outVector;
 }
@@ -340,7 +341,7 @@
 {
     if ( psVec == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     psFree( psVec->data.V );
 }
Index: /trunk/psLib/src/mathtypes/psVector.h
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.h	(revision 1384)
+++ /trunk/psLib/src/mathtypes/psVector.h	(revision 1385)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 23:52:33 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psAbort.c
===================================================================
--- /trunk/psLib/src/sys/psAbort.c	(revision 1384)
+++ /trunk/psLib/src/sys/psAbort.c	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 01:17:20 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psError.c
===================================================================
--- /trunk/psLib/src/sys/psError.c	(revision 1384)
+++ /trunk/psLib/src/sys/psError.c	(revision 1385)
@@ -10,6 +10,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 01:17:20 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psLogMsg.c
===================================================================
--- /trunk/psLib/src/sys/psLogMsg.c	(revision 1384)
+++ /trunk/psLib/src/sys/psLogMsg.c	(revision 1385)
@@ -11,6 +11,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 20:22:37 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -132,16 +132,17 @@
         psError(__func__,"The location, %s, for protocol 'dest' is invalid.",location);
         return 1;
-    } else if (strcmp(protocol,"file") == 0) {
-        FILE* file = fopen(location,"w");
-        if (file == NULL) {
-            psError(__func__,"Could not open file '%s' for output.",location);
-            return 1;
-        }
-        if (logDest != NULL && logDest != stderr && logDest != stdout) {
-            fclose(logDest);
-        }
-        logDest = file;
-        return 0;
-    }
+    } else
+        if (strcmp(protocol,"file") == 0) {
+            FILE* file = fopen(location,"w");
+            if (file == NULL) {
+                psError(__func__,"Could not open file '%s' for output.",location);
+                return 1;
+            }
+            if (logDest != NULL && logDest != stderr && logDest != stdout) {
+                fclose(logDest);
+            }
+            logDest = file;
+            return 0;
+        }
 
     psError(__func__,"Do not know how to handle the protocol '%s'.",protocol);
@@ -336,7 +337,8 @@
     if (head_ptr > head) {
         *head_ptr++ = '|';
-    } else if (!logMsg) { // no output desired
-        return;
-    }
+    } else
+        if (!logMsg) { // no output desired
+            return;
+        }
     *head_ptr = '\0';
 
Index: /trunk/psLib/src/sys/psLogMsg.h
===================================================================
--- /trunk/psLib/src/sys/psLogMsg.h	(revision 1384)
+++ /trunk/psLib/src/sys/psLogMsg.h	(revision 1385)
@@ -11,6 +11,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 20:22:37 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psMemory.c
===================================================================
--- /trunk/psLib/src/sys/psMemory.c	(revision 1384)
+++ /trunk/psLib/src/sys/psMemory.c	(revision 1385)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-07-31 02:28:10 $
+*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -47,5 +47,5 @@
         NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
     };
-    
+
 #ifdef PS_MEM_DEBUG
 static psMemBlock* deadBlockList;    // a place to put dead memBlocks in debug mode.
@@ -62,18 +62,18 @@
 {
     void * ptr = NULL;
-    
+
     pthread_mutex_lock( &recycleMemBlockListMutex );
     int level = recycleBins - 1;
     while ( level >= 0 && ptr == NULL ) {
-            while ( recycleMemBlockList[ level ] != NULL && ptr == NULL ) {
-                    psMemBlock * old = recycleMemBlockList[ level ];
-                    recycleMemBlockList[ level ] = recycleMemBlockList[ level ] ->nextBlock;
-                    free( old );
-                    ptr = malloc( size );
-                }
-            level--;
-        }
+        while ( recycleMemBlockList[ level ] != NULL && ptr == NULL ) {
+            psMemBlock * old = recycleMemBlockList[ level ];
+            recycleMemBlockList[ level ] = recycleMemBlockList[ level ] ->nextBlock;
+            free( old );
+            ptr = malloc( size );
+        }
+        level--;
+    }
     pthread_mutex_unlock( &recycleMemBlockListMutex );
-    
+
     return ptr;
 }
@@ -84,11 +84,11 @@
 {
     psMemExhaustedCallback old = memExhaustedCallback;
-    
+
     if ( func != NULL ) {
-            memExhaustedCallback = func;
-        } else {
-            memExhaustedCallback = memExhaustedCallbackDefault;
-        }
-        
+        memExhaustedCallback = func;
+    } else {
+        memExhaustedCallback = memExhaustedCallbackDefault;
+    }
+
     return old;
 }
@@ -98,12 +98,12 @@
 {
     if ( ptr->refCounter < 1 ) {
-            psError( __func__,
-                     "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
-                     ptr->id, ptr->file, ptr->lineno, file, lineno );
-        }
-        
+        psError( __func__,
+                 "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
+                 ptr->id, ptr->file, ptr->lineno, file, lineno );
+    }
+
     if ( lineno > 0 ) {
-            psAbort( __func__, "Detected a problem in the memory system at %s:%d", file, lineno );
-        }
+        psAbort( __func__, "Detected a problem in the memory system at %s:%d", file, lineno );
+    }
 }
 static psMemProblemCallback memProblemCallback = memProblemCallbackDefault;
@@ -112,11 +112,11 @@
 {
     psMemProblemCallback old = memProblemCallback;
-    
+
     if ( func != NULL ) {
-            memProblemCallback = func;
-        } else {
-            memProblemCallback = memProblemCallbackDefault;
-        }
-        
+        memProblemCallback = func;
+    } else {
+        memProblemCallback = memProblemCallbackDefault;
+    }
+
     return old;
 }
@@ -133,5 +133,5 @@
     psMemoryId old = p_psMemAllocateID;
     p_psMemAllocateID = id;
-    
+
     return old;
 }
@@ -141,5 +141,5 @@
     psMemoryId old = p_psMemFreeID;
     p_psMemFreeID = id;
-    
+
     return old;
 }
@@ -154,5 +154,5 @@
 {
     static psMemoryId incr = 0;  // "p_psMemAllocateID += incr"
-    
+
     return incr;
 }
@@ -161,5 +161,5 @@
 {
     static psMemoryId incr = 0;  // "p_psMemFreeID += incr"
-    
+
     return incr;
 }
@@ -174,11 +174,11 @@
 {
     psMemFreeCallback old = memAllocateCallback;
-    
+
     if ( func != NULL ) {
-            memAllocateCallback = func;
-        } else {
-            memAllocateCallback = memAllocateCallbackDefault;
-        }
-        
+        memAllocateCallback = func;
+    } else {
+        memAllocateCallback = memAllocateCallbackDefault;
+    }
+
     return old;
 }
@@ -187,11 +187,11 @@
 {
     psMemFreeCallback old = memFreeCallback;
-    
+
     if ( func != NULL ) {
-            memFreeCallback = func;
-        } else {
-            memFreeCallback = memFreeCallbackDefault;
-        }
-        
+        memFreeCallback = func;
+    } else {
+        memFreeCallback = memFreeCallbackDefault;
+    }
+
     return old;
 }
@@ -206,5 +206,5 @@
     id = memid + 1;
     pthread_mutex_unlock( &memIdMutex );
-    
+
     return id;
 }
@@ -220,28 +220,28 @@
     // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     // we shouldn't call such things as p_psAlloc/p_psFree here.
-    
+
     if ( m == NULL ) {
-            psError( funcName, "Memory Corruption: NULL memory block found." );
-            return 1;
-        }
-        
+        psError( funcName, "Memory Corruption: NULL memory block found." );
+        return 1;
+    }
+
     if ( m->refCounter == 0 ) {
-            // using an unreferenced block of memory, are you?
-            psError( __func__, "Memory Corruption: memory block %ld was freed but still used.",
-                     m->id );
-            return 1;
-        }
-        
+        // using an unreferenced block of memory, are you?
+        psError( __func__, "Memory Corruption: memory block %ld was freed but still used.",
+                 m->id );
+        return 1;
+    }
+
     if ( m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC ) {
-            psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)",
-                     m->id );
-            return 1;
-        }
+        psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)",
+                 m->id );
+        return 1;
+    }
     if ( *( void** ) ( ( int8_t* ) ( m + 1 ) + m->userMemorySize ) != P_PS_MEMMAGIC ) {
-            psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)",
-                     m->id );
-            return 1;
-        }
-        
+        psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)",
+                 m->id );
+        return 1;
+    }
+
     return 0;
 }
@@ -250,23 +250,23 @@
 {
     int nbad = 0;                       // number of bad blocks
-    
+
     // get exclusive access to the memBlock list to avoid it changing on us while we use it.
     pthread_mutex_lock( &memBlockListMutex );
-    
+
     for ( psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock ) {
-            if ( checkMemBlock( iter, __func__ ) ) {
-                    nbad++;
-                    
-                    memProblemCallback( iter, __func__, __LINE__ );
-                    
-                    if ( abort_on_error ) {
-                            // release the lock on the memblock list
-                            pthread_mutex_unlock( &memBlockListMutex );
-                            psAbort( __func__, "Detected memory corruption" );
-                            return nbad;
-                        }
-                }
-        }
-        
+        if ( checkMemBlock( iter, __func__ ) ) {
+            nbad++;
+
+            memProblemCallback( iter, __func__, __LINE__ );
+
+            if ( abort_on_error ) {
+                // release the lock on the memblock list
+                pthread_mutex_unlock( &memBlockListMutex );
+                psAbort( __func__, "Detected memory corruption" );
+                return nbad;
+            }
+        }
+    }
+
     // release the lock on the memblock list
     pthread_mutex_unlock( &memBlockListMutex );
@@ -278,54 +278,54 @@
 
     psMemBlock * ptr = NULL;
-    
+
     // memory is of the size I want to bother recycling?
     if ( size < P_PS_LARGE_BLOCK_SIZE ) {
-            // find the bin we need.
-            int level = 0;
-            while ( size > recycleBinSize[ level ] ) {
-                    level++;
+        // find the bin we need.
+        int level = 0;
+        while ( size > recycleBinSize[ level ] ) {
+            level++;
+        }
+        // Are we in one of the bins
+        if ( level < recycleBins ) {
+
+            size = recycleBinSize[ level ];  // round-up size to next sized bin.
+
+            pthread_mutex_lock( &recycleMemBlockListMutex );
+
+            if ( recycleMemBlockList[ level ] != NULL ) {
+                ptr = recycleMemBlockList[ level ];
+                recycleMemBlockList[ level ] = ptr->nextBlock;
+                if ( recycleMemBlockList[ level ] != NULL ) {
+                    recycleMemBlockList[ level ] ->previousBlock = NULL;
                 }
-            // Are we in one of the bins
-            if ( level < recycleBins ) {
-            
-                    size = recycleBinSize[ level ];  // round-up size to next sized bin.
-                    
-                    pthread_mutex_lock( &recycleMemBlockListMutex );
-                    
-                    if ( recycleMemBlockList[ level ] != NULL ) {
-                            ptr = recycleMemBlockList[ level ];
-                            recycleMemBlockList[ level ] = ptr->nextBlock;
-                            if ( recycleMemBlockList[ level ] != NULL ) {
-                                    recycleMemBlockList[ level ] ->previousBlock = NULL;
-                                }
-                            size = ptr->userMemorySize;
-                        }
-                        
-                    pthread_mutex_unlock( &recycleMemBlockListMutex );
-                }
-        }
-        
+                size = ptr->userMemorySize;
+            }
+
+            pthread_mutex_unlock( &recycleMemBlockListMutex );
+        }
+    }
+
     if ( ptr == NULL ) {
-            ptr = malloc( sizeof( psMemBlock ) + size + sizeof( void* ) );
-            
+        ptr = malloc( sizeof( psMemBlock ) + size + sizeof( void* ) );
+
+        if ( ptr == NULL ) {
+            ptr = memExhaustedCallback( size );
             if ( ptr == NULL ) {
-                    ptr = memExhaustedCallback( size );
-                    if ( ptr == NULL ) {
-                            psAbort( __func__, "Failed to allocate %u bytes at %s:%d",
-                                     size, file, lineno );
-                        }
-                }
-                
-            ptr->startblock = P_PS_MEMMAGIC;
-            ptr->endblock = P_PS_MEMMAGIC;
-            ptr->userMemorySize = size;
-            pthread_mutex_init( &ptr->refCounterMutex, NULL );
-        }
-        
+                psAbort( __func__, "Failed to allocate %u bytes at %s:%d",
+                         size, file, lineno );
+            }
+        }
+
+        ptr->startblock = P_PS_MEMMAGIC;
+        ptr->endblock = P_PS_MEMMAGIC;
+        ptr->userMemorySize = size;
+        pthread_mutex_init( &ptr->refCounterMutex, NULL );
+    }
+
     // increment the memory id safely.
     pthread_mutex_lock( &memBlockListMutex );
     *( psMemoryId* ) & ptr->id = ++memid;
     pthread_mutex_unlock( &memBlockListMutex );
-    
+
     ptr->file = file;
     ptr->freeFcn = NULL;
@@ -333,24 +333,24 @@
     *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
     ptr->previousBlock = NULL;
-    
+
     ptr->refCounter = 1;                // one user so far
-    
+
     // need exclusive access of the memory block list now...
     pthread_mutex_lock( &memBlockListMutex );
-    
+
     // insert the new block to the front of the memBlock linked-list
     ptr->nextBlock = lastMemBlockAllocated;
     if ( ptr->nextBlock != NULL ) {
-            ptr->nextBlock->previousBlock = ptr;
-        }
+        ptr->nextBlock->previousBlock = ptr;
+    }
     lastMemBlockAllocated = ptr;
-    
+
     pthread_mutex_unlock( &memBlockListMutex );
-    
+
     //  Did the user ask to be informed about this allocation?
     if ( ptr->id == p_psMemAllocateID ) {
-            p_psMemAllocateID += memAllocateCallback( ptr );
-        }
-        
+        p_psMemAllocateID += memAllocateCallback( ptr );
+    }
+
     // And return the user the memory that they allocated
     return ptr + 1;   // user memory
@@ -360,50 +360,50 @@
 {
     if ( vptr == NULL ) {
-            return p_psAlloc( size, file, lineno );
-        } else {
-            psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-            bool isBlockLast = false;
-            
-            if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-                    memProblemCallback( ptr, file, lineno );
-                    psAbort( file, "Realloc detected a memory corruption (id %ld @ %s:%d).",
-                             ptr->id, ptr->file, ptr->lineno );
-                }
-                
-            pthread_mutex_lock( &memBlockListMutex );
-            
-            isBlockLast = ( ptr == lastMemBlockAllocated );
-            
-            ptr = ( psMemBlock* ) realloc( ptr, sizeof( psMemBlock ) + size + sizeof( void* ) );
-            
-            if ( ptr == NULL ) {
-                    psAbort( __func__, "Failed to reallocate %ld bytes at %s:%d",
-                             size, file, lineno );
-                }
-                
-            ptr->userMemorySize = size;
-            *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
-            
-            if ( isBlockLast ) {
-                    lastMemBlockAllocated = ptr;
-                }
-                
-            // the block location may have changed, so fix the linked list addresses.
-            if ( ptr->nextBlock != NULL ) {
-                    ptr->nextBlock->previousBlock = ptr;
-                }
-            if ( ptr->previousBlock != NULL ) {
-                    ptr->previousBlock->nextBlock = ptr;
-                }
-                
-            pthread_mutex_unlock( &memBlockListMutex );
-            
-            //  Did the user ask to be informed about this allocation?
-            if ( ptr->id == p_psMemAllocateID ) {
-                    p_psMemAllocateID += memAllocateCallback( ptr );
-                }
-                
-            return ptr + 1;   // usr memory
-        }
+        return p_psAlloc( size, file, lineno );
+    } else {
+        psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
+        bool isBlockLast = false;
+
+        if ( checkMemBlock( ptr, __func__ ) != 0 ) {
+            memProblemCallback( ptr, file, lineno );
+            psAbort( file, "Realloc detected a memory corruption (id %ld @ %s:%d).",
+                     ptr->id, ptr->file, ptr->lineno );
+        }
+
+        pthread_mutex_lock( &memBlockListMutex );
+
+        isBlockLast = ( ptr == lastMemBlockAllocated );
+
+        ptr = ( psMemBlock* ) realloc( ptr, sizeof( psMemBlock ) + size + sizeof( void* ) );
+
+        if ( ptr == NULL ) {
+            psAbort( __func__, "Failed to reallocate %ld bytes at %s:%d",
+                     size, file, lineno );
+        }
+
+        ptr->userMemorySize = size;
+        *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
+
+        if ( isBlockLast ) {
+            lastMemBlockAllocated = ptr;
+        }
+
+        // the block location may have changed, so fix the linked list addresses.
+        if ( ptr->nextBlock != NULL ) {
+            ptr->nextBlock->previousBlock = ptr;
+        }
+        if ( ptr->previousBlock != NULL ) {
+            ptr->previousBlock->nextBlock = ptr;
+        }
+
+        pthread_mutex_unlock( &memBlockListMutex );
+
+        //  Did the user ask to be informed about this allocation?
+        if ( ptr->id == p_psMemAllocateID ) {
+            p_psMemAllocateID += memAllocateCallback( ptr );
+        }
+
+        return ptr + 1;   // usr memory
+    }
 }
 
@@ -421,41 +421,41 @@
     int j = 0;
     psMemBlock* topBlock = lastMemBlockAllocated;
-    
+
     pthread_mutex_lock( &memBlockListMutex );
-    
+
     for ( psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock ) {
-            if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
-                    nleak++;
-                    
-                    if ( fd != NULL ) {
-                            if ( nleak == 1 ) {
-                                    fprintf( fd, "   %20s:line ID\n", "file" );
-                                }
-                                
-                            fprintf( fd, "   %20s:%-4d %ld\n", iter->file, iter->lineno, iter->id );
-                        }
+        if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
+            nleak++;
+
+            if ( fd != NULL ) {
+                if ( nleak == 1 ) {
+                    fprintf( fd, "   %20s:line ID\n", "file" );
                 }
-        }
-        
+
+                fprintf( fd, "   %20s:%-4d %ld\n", iter->file, iter->lineno, iter->id );
+            }
+        }
+    }
+
     pthread_mutex_unlock( &memBlockListMutex );
-    
+
     if ( nleak == 0 || arr == NULL ) {
-            return nleak;
-        }
-        
+        return nleak;
+    }
+
     *arr = p_psAlloc( nleak * sizeof( psMemBlock ), __FILE__, __LINE__ );
     pthread_mutex_lock( &memBlockListMutex );
-    
+
     for ( psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock ) {
-            if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
-                    ( *arr ) [ j++ ] = iter;
-                    if ( j == nleak ) { // found them all
-                            break;
-                        }
-                }
-        }
-        
+        if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
+            ( *arr ) [ j++ ] = iter;
+            if ( j == nleak ) { // found them all
+                break;
+            }
+        }
+    }
+
     pthread_mutex_unlock( &memBlockListMutex );
-    
+
     return nleak;
 }
@@ -463,5 +463,5 @@
 /*
  * Reference counting APIs
- */ 
+ */
 // return refCounter
 psReferenceCount psMemGetRefCounter( void *vptr )
@@ -469,19 +469,19 @@
     psMemBlock * ptr;
     unsigned int refCount;
-    
+
     if ( vptr == NULL ) {
-            return 0;
-        }
-        
+        return 0;
+    }
+
     ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, __func__, __LINE__ );
-        }
-        
+        memProblemCallback( ptr, __func__, __LINE__ );
+    }
+
     pthread_mutex_lock( &ptr->refCounterMutex );
     refCount = ptr->refCounter;
     pthread_mutex_unlock( &ptr->refCounterMutex );
-    
+
     return refCount;
 }
@@ -490,19 +490,19 @@
 {
     psMemBlock * ptr;
-    
+
     if ( vptr == NULL ) {
-            return vptr;
-        }
-        
+        return vptr;
+    }
+
     ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) ) {
-            memProblemCallback( ptr, file, lineno );
-        }
-        
+        memProblemCallback( ptr, file, lineno );
+    }
+
     pthread_mutex_lock( &ptr->refCounterMutex );
     ptr->refCounter++;
     pthread_mutex_unlock( &ptr->refCounterMutex );
-    
+
     return vptr;
 }
@@ -512,90 +512,90 @@
 {
     if ( vptr == NULL ) {
-            return NULL;
-        }
-        
+        return NULL;
+    }
+
     psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, file, lineno );
-            return NULL;
-        }
-        
+        memProblemCallback( ptr, file, lineno );
+        return NULL;
+    }
+
     pthread_mutex_lock( &ptr->refCounterMutex );
-    
+
     if ( ptr->refCounter > 1 ) {
-            /// XXX - Probably should have another mutex here.
-            ptr->refCounter--;          // multiple references, just decrement the count.
-            pthread_mutex_unlock( &ptr->refCounterMutex );
-            
+        /// XXX - Probably should have another mutex here.
+        ptr->refCounter--;          // multiple references, just decrement the count.
+        pthread_mutex_unlock( &ptr->refCounterMutex );
+
+    } else {
+        pthread_mutex_unlock( &ptr->refCounterMutex );
+
+        // Did the user ask to be informed about this deallocation?
+        if ( ptr->id == p_psMemFreeID ) {
+            p_psMemFreeID += memFreeCallback( ptr );
+        }
+
+        if ( ptr->freeFcn != NULL ) {
+            ptr->freeFcn( vptr );
+        }
+
+        pthread_mutex_lock( &memBlockListMutex );
+
+        // cut the memBlock out of the memBlock list
+        if ( ptr->nextBlock != NULL ) {
+            ptr->nextBlock->previousBlock = ptr->previousBlock;
+        }
+        if ( ptr->previousBlock != NULL ) {
+            ptr->previousBlock->nextBlock = ptr->nextBlock;
+        }
+        if ( lastMemBlockAllocated == ptr ) {
+            lastMemBlockAllocated = ptr->nextBlock;
+        }
+
+        pthread_mutex_unlock( &memBlockListMutex );
+
+
+        // do we need to recycle?
+        if ( ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE ) {
+
+            int level = 1;
+            while ( ptr->userMemorySize >= recycleBinSize[ level ] ) {
+                level++;
+            }
+            level--;
+
+            ptr->refCounter = 0;
+            ptr->previousBlock = NULL;
+
+            pthread_mutex_lock( &recycleMemBlockListMutex );
+            ptr->nextBlock = recycleMemBlockList[ level ];
+            if ( recycleMemBlockList[ level ] != NULL ) {
+                recycleMemBlockList[ level ] ->previousBlock = ptr;
+            }
+            recycleMemBlockList[ level ] = ptr;
+            pthread_mutex_unlock( &recycleMemBlockListMutex );
+
         } else {
-            pthread_mutex_unlock( &ptr->refCounterMutex );
-            
-            // Did the user ask to be informed about this deallocation?
-            if ( ptr->id == p_psMemFreeID ) {
-                    p_psMemFreeID += memFreeCallback( ptr );
-                }
-                
-            if ( ptr->freeFcn != NULL ) {
-                    ptr->freeFcn( vptr );
-                }
-                
-            pthread_mutex_lock( &memBlockListMutex );
-            
-            // cut the memBlock out of the memBlock list
-            if ( ptr->nextBlock != NULL ) {
-                    ptr->nextBlock->previousBlock = ptr->previousBlock;
-                }
-            if ( ptr->previousBlock != NULL ) {
-                    ptr->previousBlock->nextBlock = ptr->nextBlock;
-                }
-            if ( lastMemBlockAllocated == ptr ) {
-                    lastMemBlockAllocated = ptr->nextBlock;
-                }
-                
-            pthread_mutex_unlock( &memBlockListMutex );
-            
-            
-            // do we need to recycle?
-            if ( ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE ) {
-            
-                    int level = 1;
-                    while ( ptr->userMemorySize >= recycleBinSize[ level ] ) {
-                            level++;
-                        }
-                    level--;
-                    
-                    ptr->refCounter = 0;
-                    ptr->previousBlock = NULL;
-                    
-                    pthread_mutex_lock( &recycleMemBlockListMutex );
-                    ptr->nextBlock = recycleMemBlockList[ level ];
-                    if ( recycleMemBlockList[ level ] != NULL ) {
-                            recycleMemBlockList[ level ] ->previousBlock = ptr;
-                        }
-                    recycleMemBlockList[ level ] = ptr;
-                    pthread_mutex_unlock( &recycleMemBlockListMutex );
-                    
-                } else {
-                    // memory is larger than I want to recycle.
-                    #ifdef PS_MEM_DEBUG
-                    ( void ) p_psRealloc( vptr, 0, file, lineno );
-                    ptr->previousBlock = NULL;
-                    ptr->nextBlock = deadBlockList;
-                    if ( deadBlockList != NULL ) {
-                            deadBlockList->previous = ptr;
-                        }
-                    deadBlockList = ptr;
-                    #else
-                    
-                    pthread_mutex_destroy( &ptr->refCounterMutex );
-                    free( ptr );
-                    #endif
-                    
-                }
-                
-            vptr = NULL;    // since we freed it, make sure we return NULL.
-        }
-        
+            // memory is larger than I want to recycle.
+            #ifdef PS_MEM_DEBUG
+            ( void ) p_psRealloc( vptr, 0, file, lineno );
+            ptr->previousBlock = NULL;
+            ptr->nextBlock = deadBlockList;
+            if ( deadBlockList != NULL ) {
+                deadBlockList->previous = ptr;
+            }
+            deadBlockList = ptr;
+            #else
+
+            pthread_mutex_destroy( &ptr->refCounterMutex );
+            free( ptr );
+            #endif
+
+        }
+
+        vptr = NULL;    // since we freed it, make sure we return NULL.
+    }
+
     return vptr;
 }
@@ -604,28 +604,28 @@
 {
     if ( vptr == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, __func__, __LINE__ );
-        }
-        
+        memProblemCallback( ptr, __func__, __LINE__ );
+    }
+
     ptr->freeFcn = freeFcn;
-    
+
 }
 psFreeFcn p_psMemGetDeallocator( void* vptr )
 {
     if ( vptr == NULL ) {
-            return NULL;
-        }
-        
+        return NULL;
+    }
+
     psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, __func__, __LINE__ );
-        }
-        
+        memProblemCallback( ptr, __func__, __LINE__ );
+    }
+
     return ptr->freeFcn;
 }
Index: /trunk/psLib/src/sys/psMemory.h
===================================================================
--- /trunk/psLib/src/sys/psMemory.h	(revision 1384)
+++ /trunk/psLib/src/sys/psMemory.h	(revision 1385)
@@ -14,6 +14,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 23:52:34 $
+ *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psString.c
===================================================================
--- /trunk/psLib/src/sys/psString.c	(revision 1384)
+++ /trunk/psLib/src/sys/psString.c	(revision 1385)
@@ -8,6 +8,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-10 23:37:36 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psTrace.c
===================================================================
--- /trunk/psLib/src/sys/psTrace.c	(revision 1384)
+++ /trunk/psLib/src/sys/psTrace.c	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 01:09:12 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psType.h
===================================================================
--- /trunk/psLib/src/sys/psType.h	(revision 1384)
+++ /trunk/psLib/src/sys/psType.h	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-07-31 02:28:10 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -142,8 +142,8 @@
  */
 typedef struct
-    {
-        psElemType type;    ///< Primitive type.
-        psDimen dimen;      ///< Dimensionality.
-    }
+{
+    psElemType type;    ///< Primitive type.
+    psDimen dimen;      ///< Dimensionality.
+}
 psType;
 
Index: /trunk/psLib/src/sysUtils/psAbort.c
===================================================================
--- /trunk/psLib/src/sysUtils/psAbort.c	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psAbort.c	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 01:17:20 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psError.c
===================================================================
--- /trunk/psLib/src/sysUtils/psError.c	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psError.c	(revision 1385)
@@ -10,6 +10,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 01:17:20 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psHash.c
===================================================================
--- /trunk/psLib/src/sysUtils/psHash.c	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psHash.c	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 01:21:33 $
+*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,6 +28,6 @@
 static void hashBucketFree( psHashBucket *bucket );
 static void *doHashWork( psHash* table, const char* key, void* data, bool remove
-                       )
-;
+                           )
+    ;
 static void hashFree( psHash *table );
 
@@ -45,27 +45,27 @@
     psList *myLinkList = NULL;  // The output data structure
     psHashBucket *ptr = NULL;           // Used to step thru linked list.
-    
+
     if ( table == NULL ) {
-            return NULL;
-        }
-        
+        return NULL;
+    }
+
     // Create the linked list
     myLinkList = psListAlloc( NULL );
-    
+
     // Loop through every bucket in the hash table.  If that bucket is not
     // NULL, then add the bucket's key to the linked list.
     for ( i = 0;i < table->nbucket;i++ ) {
-            if ( table->buckets[ i ] != NULL ) {
-                    // Since a bucket contains a linked list of keys/data, we must
-                    // step trough each key in that linked list:
-                    
-                    ptr = table->buckets[ i ];
-                    while ( ptr != NULL ) {
-                            psListAdd( myLinkList, ptr->key, PS_LIST_HEAD );
-                            ptr = ptr->next;
-                        }
-                }
+        if ( table->buckets[ i ] != NULL ) {
+            // Since a bucket contains a linked list of keys/data, we must
+            // step trough each key in that linked list:
+
+            ptr = table->buckets[ i ];
+            while ( ptr != NULL ) {
+                psListAdd( myLinkList, ptr->key, PS_LIST_HEAD );
+                ptr = ptr->next;
+            }
         }
-        
+    }
+
     // Return the linked list
     return ( myLinkList );
@@ -89,23 +89,23 @@
 {
     if ( key == NULL ) {
-            psAbort( __func__, "psHashBucket() called with NULL key." );
-        }
-        
+        psAbort( __func__, "psHashBucket() called with NULL key." );
+    }
+
     // Allocate memory for the new hash bucket.
     psHashBucket *bucket = psAlloc( sizeof( psHashBucket ) );
     p_psMemSetDeallocator( bucket, ( psFreeFcn ) hashBucketFree );
-    
+
     // Initialize the bucket.
     bucket->key = psStringCopy( key );
-    
+
     if ( data == NULL ) {
-            // NOTE: Should we flag a warning message?
-            bucket->data = NULL;
-        } else {
-            bucket->data = psMemIncrRefCounter( data );
-        }
-        
+        // NOTE: Should we flag a warning message?
+        bucket->data = NULL;
+    } else {
+        bucket->data = psMemIncrRefCounter( data );
+    }
+
     bucket->next = next;
-    
+
     return bucket;
 }
@@ -123,13 +123,13 @@
 {
     if ( bucket == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     // A bucket is actually a linked list of buckets.  We recursively step
     // through that linked list, free each bucket.
     psFree( bucket->next );
-    
+
     psFree( bucket->key );
-    
+
     psFree( bucket->data );
 }
@@ -150,17 +150,17 @@
     psHash *table = psAlloc( sizeof( psHash ) );
     p_psMemSetDeallocator( table, ( psFreeFcn ) hashFree );
-    
+
     // Allocate memory for the buckets.
     table->buckets = psAlloc( nbucket * sizeof( psHashBucket * ) );
     table->nbucket = nbucket;
-    
+
     psTrace( "utils.hash", 1, "Creating %d-element hash table\n", nbucket );
-    
+
     // Initialize all buckets to NULL.
     for ( i = 0; i < nbucket; i++ )
-        {
-            table->buckets[ i ] = NULL;
-        }
-        
+    {
+        table->buckets[ i ] = NULL;
+    }
+
     // Return the new hash table.
     return table;
@@ -182,19 +182,19 @@
 {
     int i = 0;                          // Loop index variable.
-    
+
     if ( table == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     // Loop through each bucket in the hash table.  If that bucket is not
     // NULL, then free the bucket via a function call to hashBucketFree();
     for ( i = 0; i < table->nbucket; i++ ) {
-    
-            // A bucket is composed of a linked list of buckets.
-            if ( table->buckets[ i ] != NULL ) {
-                    psFree( table->buckets[ i ] );
-                }
+
+        // A bucket is composed of a linked list of buckets.
+        if ( table->buckets[ i ] != NULL ) {
+            psFree( table->buckets[ i ] );
         }
-        
+    }
+
     // Free the bucket structure, then the hash table.
     psFree( table->buckets );
@@ -221,5 +221,5 @@
   *****************************************************************************/
 static void *doHashWork( psHash *table, const char *key, void *data, bool remove
-                       )
+                           )
 {
     long int hash = 1;                  // This will contain an integer value
@@ -229,13 +229,13 @@
     psHashBucket *optr = NULL;          // "original pointer": used to step
     // thru the linked list for a bucket.
-    
+
     // The following condition should never be true, since this is a private
     // function, but I'm checking it anyway since future coders might change
     // the way this procedure is called.
     if ( ( table == NULL ) || ( key == NULL ) ) {
-    
-            psAbort( __func__, "psHashRemove() called with NULL key or table." );
-        }
-        
+
+        psAbort( __func__, "psHashRemove() called with NULL key or table." );
+    }
+
     // NOTE: This is the originally supplied hash function.
     //    for (int i = 0, len = strlen(key); i < len; i++) {
@@ -243,99 +243,99 @@
     //    }
     //    hash &= (table->nbucket - 1);
-    
+
     // This hash algorithm is from Sedgewick.  NOTE: must reread to ensure that
     // the size of the hash table is not required to be a prime number.
     tmpchar = ( char * ) key;
     for ( hash = 0; *tmpchar != '\0'; tmpchar++ ) {
-            hash = ( 64 * hash + *tmpchar ) % ( table->nbucket );
-        }
-        
+        hash = ( 64 * hash + *tmpchar ) % ( table->nbucket );
+    }
+
     // NOTE: This should not be necessary, but for now, I'm checking bounds
     // anyway.
     if ( ( hash < 0 ) || ( hash >= table->nbucket ) ) {
-            psAbort( __func__, "Internal hash function out of range (%d)", hash );
-        }
-        
+        psAbort( __func__, "Internal hash function out of range (%d)", hash );
+    }
+
     // ptr will have the correct hash bucket.
     ptr = table->buckets[ hash ];
-    
+
     // We know the correct hash bucket, now we need to know what to do.
     // If the data parameter is NULL, then, by definition, this is a retrieve
     // or a remove operation on the hash table.
-    
+
     if ( data == NULL ) {
-            if ( remove
+        if ( remove
                ) {
-                    // We search through the linked list for this bucket in
-                    // the hash table and look for an entry for this key.
-                    
+                // We search through the linked list for this bucket in
+                // the hash table and look for an entry for this key.
+
+                optr = ptr;
+                while ( ptr != NULL ) {
+                    // Dtermine if this entry holds the correct key.
+                    if ( strcmp( key, ptr->key ) == 0 ) {
+                        // The following lines of code are fairly standard ways
+                        // of removing an item from a single-linked list.
+
+                        void * data = ptr->data;
+                        optr->next = ptr->next;
+                        if ( ptr == table->buckets[ hash ] ) {
+                            table->buckets[ hash ] = ptr->next;
+                        }
+
+                        psFree( ptr );
+
+                        // By definition, the data associated with that key
+                        // must be returned, not freed.
+                        return data;
+                    }
                     optr = ptr;
-                    while ( ptr != NULL ) {
-                            // Dtermine if this entry holds the correct key.
-                            if ( strcmp( key, ptr->key ) == 0 ) {
-                                    // The following lines of code are fairly standard ways
-                                    // of removing an item from a single-linked list.
-                                    
-                                    void * data = ptr->data;
-                                    optr->next = ptr->next;
-                                    if ( ptr == table->buckets[ hash ] ) {
-                                            table->buckets[ hash ] = ptr->next;
-                                        }
-                                        
-                                    psFree( ptr );
-                                    
-                                    // By definition, the data associated with that key
-                                    // must be returned, not freed.
-                                    return data;
-                                }
-                            optr = ptr;
-                            ptr = ptr->next;
-                        }
-                    return NULL;   // not in hash
-                }
-            else {
-                    // If we get here, then a retrieve operation is requested.  So,
-                    // we step trough the linked list at this bucket, and return the
-                    // data once we find it, or return NULL if we don't.
-                    while ( ptr != NULL ) {
-                            if ( strcmp( key, ptr->key ) == 0 ) {
-                                    return ptr->data;
-                                }
-                            ptr = ptr->next;
-                        }
-                    return NULL;   // not in hash
-                }
-        } else {
-            // We get here if this procedure was called with non-NULL data.
-            // Therefore, we should insert that data into the hash table.
-            // First, we search through the linked list for this bucket in
-            // the hash table and look for a duplicate entry for this key.
-            
-            while ( ptr != NULL ) {
-                    if ( strcmp( key, ptr->key ) == 0 ) {
-                            // We have found this key in the hash table.
-                            
-                            psTrace( "utils.hash.insert", 3, "Replacing data for %s\n",
-                                     key );
-                                     
-                            // NOTE: I have changed this behavior from the originally
-                            // supplied code.  Formerly, if itemFree was NULL, then
-                            // the new data was not inserted into the hash table.
-                            
-                            psFree( ptr->data );
-                            
-                            ptr->data = psMemIncrRefCounter( data );
-                            return data;
-                        }
                     ptr = ptr->next;
                 }
-            // We did not found key in the linked list for this bucket of the hash
-            // table.  So, we insert this data at the head of that linked list.
-            
-            table->buckets[ hash ] = hashBucketAlloc( key,
-                                     data,
-                                     table->buckets[ hash ] );
-            return data;
+                return NULL;   // not in hash
+            }
+        else {
+            // If we get here, then a retrieve operation is requested.  So,
+            // we step trough the linked list at this bucket, and return the
+            // data once we find it, or return NULL if we don't.
+            while ( ptr != NULL ) {
+                if ( strcmp( key, ptr->key ) == 0 ) {
+                    return ptr->data;
+                }
+                ptr = ptr->next;
+            }
+            return NULL;   // not in hash
         }
+    } else {
+        // We get here if this procedure was called with non-NULL data.
+        // Therefore, we should insert that data into the hash table.
+        // First, we search through the linked list for this bucket in
+        // the hash table and look for a duplicate entry for this key.
+
+        while ( ptr != NULL ) {
+            if ( strcmp( key, ptr->key ) == 0 ) {
+                // We have found this key in the hash table.
+
+                psTrace( "utils.hash.insert", 3, "Replacing data for %s\n",
+                         key );
+
+                // NOTE: I have changed this behavior from the originally
+                // supplied code.  Formerly, if itemFree was NULL, then
+                // the new data was not inserted into the hash table.
+
+                psFree( ptr->data );
+
+                ptr->data = psMemIncrRefCounter( data );
+                return data;
+            }
+            ptr = ptr->next;
+        }
+        // We did not found key in the linked list for this bucket of the hash
+        // table.  So, we insert this data at the head of that linked list.
+
+        table->buckets[ hash ] = hashBucketAlloc( key,
+                                 data,
+                                 table->buckets[ hash ] );
+        return data;
+    }
 }
 
@@ -354,13 +354,13 @@
 {
     if ( table == NULL ) {
-            psAbort( __func__, "psHashInsert() called with NULL hash table." );
-        }
+        psAbort( __func__, "psHashInsert() called with NULL hash table." );
+    }
     if ( key == NULL ) {
-            psAbort( __func__, "psHashInsert() called with NULL key." );
-        }
+        psAbort( __func__, "psHashInsert() called with NULL key." );
+    }
     if ( data == NULL ) {
-            psAbort( __func__, "psHashLookup() called with NULL data." );
-        }
-        
+        psAbort( __func__, "psHashLookup() called with NULL data." );
+    }
+
     return ( doHashWork( table, key, data, 0 ) != NULL );
 }
@@ -381,11 +381,11 @@
 {
     if ( table == NULL ) {
-            psAbort( __func__, "psHashLookup() called with NULL hash table." );
-        }
+        psAbort( __func__, "psHashLookup() called with NULL hash table." );
+    }
     if ( key == NULL ) {
-            psAbort( __func__, "psHashLookup() called with NULL key." );
-        }
-        
-        
+        psAbort( __func__, "psHashLookup() called with NULL key." );
+    }
+
+
     return doHashWork( table, key, NULL, 0 );
 }
@@ -405,19 +405,19 @@
     void * data = NULL;
     bool retVal = false;
-    
+
     if ( table == NULL ) {
-            psAbort( __func__, "psHashRemove() called with NULL hash table." );
-        }
+        psAbort( __func__, "psHashRemove() called with NULL hash table." );
+    }
     if ( key == NULL ) {
-            psAbort( __func__, "psHashRemove() called with NULL key." );
-        }
-        
+        psAbort( __func__, "psHashRemove() called with NULL key." );
+    }
+
     data = doHashWork( table, key, NULL, 1 );
     if ( data != NULL ) {
-            psFree( data );
-            retVal = true;
-        } else {
-            retVal = false;
-        }
+        psFree( data );
+        retVal = true;
+    } else {
+        retVal = false;
+    }
     return retVal;
 }
Index: /trunk/psLib/src/sysUtils/psHash.h
===================================================================
--- /trunk/psLib/src/sysUtils/psHash.h	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psHash.h	(revision 1385)
@@ -10,6 +10,6 @@
  *  @author George Gusciora, MHPCC
  *   
- *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-27 23:09:23 $
+ *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psLogMsg.c
===================================================================
--- /trunk/psLib/src/sysUtils/psLogMsg.c	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psLogMsg.c	(revision 1385)
@@ -11,6 +11,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 20:22:37 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -132,16 +132,17 @@
         psError(__func__,"The location, %s, for protocol 'dest' is invalid.",location);
         return 1;
-    } else if (strcmp(protocol,"file") == 0) {
-        FILE* file = fopen(location,"w");
-        if (file == NULL) {
-            psError(__func__,"Could not open file '%s' for output.",location);
-            return 1;
-        }
-        if (logDest != NULL && logDest != stderr && logDest != stdout) {
-            fclose(logDest);
-        }
-        logDest = file;
-        return 0;
-    }
+    } else
+        if (strcmp(protocol,"file") == 0) {
+            FILE* file = fopen(location,"w");
+            if (file == NULL) {
+                psError(__func__,"Could not open file '%s' for output.",location);
+                return 1;
+            }
+            if (logDest != NULL && logDest != stderr && logDest != stdout) {
+                fclose(logDest);
+            }
+            logDest = file;
+            return 0;
+        }
 
     psError(__func__,"Do not know how to handle the protocol '%s'.",protocol);
@@ -336,7 +337,8 @@
     if (head_ptr > head) {
         *head_ptr++ = '|';
-    } else if (!logMsg) { // no output desired
-        return;
-    }
+    } else
+        if (!logMsg) { // no output desired
+            return;
+        }
     *head_ptr = '\0';
 
Index: /trunk/psLib/src/sysUtils/psLogMsg.h
===================================================================
--- /trunk/psLib/src/sysUtils/psLogMsg.h	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psLogMsg.h	(revision 1385)
@@ -11,6 +11,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 20:22:37 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psMemory.c
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.c	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psMemory.c	(revision 1385)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-07-31 02:28:10 $
+*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -47,5 +47,5 @@
         NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
     };
-    
+
 #ifdef PS_MEM_DEBUG
 static psMemBlock* deadBlockList;    // a place to put dead memBlocks in debug mode.
@@ -62,18 +62,18 @@
 {
     void * ptr = NULL;
-    
+
     pthread_mutex_lock( &recycleMemBlockListMutex );
     int level = recycleBins - 1;
     while ( level >= 0 && ptr == NULL ) {
-            while ( recycleMemBlockList[ level ] != NULL && ptr == NULL ) {
-                    psMemBlock * old = recycleMemBlockList[ level ];
-                    recycleMemBlockList[ level ] = recycleMemBlockList[ level ] ->nextBlock;
-                    free( old );
-                    ptr = malloc( size );
-                }
-            level--;
-        }
+        while ( recycleMemBlockList[ level ] != NULL && ptr == NULL ) {
+            psMemBlock * old = recycleMemBlockList[ level ];
+            recycleMemBlockList[ level ] = recycleMemBlockList[ level ] ->nextBlock;
+            free( old );
+            ptr = malloc( size );
+        }
+        level--;
+    }
     pthread_mutex_unlock( &recycleMemBlockListMutex );
-    
+
     return ptr;
 }
@@ -84,11 +84,11 @@
 {
     psMemExhaustedCallback old = memExhaustedCallback;
-    
+
     if ( func != NULL ) {
-            memExhaustedCallback = func;
-        } else {
-            memExhaustedCallback = memExhaustedCallbackDefault;
-        }
-        
+        memExhaustedCallback = func;
+    } else {
+        memExhaustedCallback = memExhaustedCallbackDefault;
+    }
+
     return old;
 }
@@ -98,12 +98,12 @@
 {
     if ( ptr->refCounter < 1 ) {
-            psError( __func__,
-                     "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
-                     ptr->id, ptr->file, ptr->lineno, file, lineno );
-        }
-        
+        psError( __func__,
+                 "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
+                 ptr->id, ptr->file, ptr->lineno, file, lineno );
+    }
+
     if ( lineno > 0 ) {
-            psAbort( __func__, "Detected a problem in the memory system at %s:%d", file, lineno );
-        }
+        psAbort( __func__, "Detected a problem in the memory system at %s:%d", file, lineno );
+    }
 }
 static psMemProblemCallback memProblemCallback = memProblemCallbackDefault;
@@ -112,11 +112,11 @@
 {
     psMemProblemCallback old = memProblemCallback;
-    
+
     if ( func != NULL ) {
-            memProblemCallback = func;
-        } else {
-            memProblemCallback = memProblemCallbackDefault;
-        }
-        
+        memProblemCallback = func;
+    } else {
+        memProblemCallback = memProblemCallbackDefault;
+    }
+
     return old;
 }
@@ -133,5 +133,5 @@
     psMemoryId old = p_psMemAllocateID;
     p_psMemAllocateID = id;
-    
+
     return old;
 }
@@ -141,5 +141,5 @@
     psMemoryId old = p_psMemFreeID;
     p_psMemFreeID = id;
-    
+
     return old;
 }
@@ -154,5 +154,5 @@
 {
     static psMemoryId incr = 0;  // "p_psMemAllocateID += incr"
-    
+
     return incr;
 }
@@ -161,5 +161,5 @@
 {
     static psMemoryId incr = 0;  // "p_psMemFreeID += incr"
-    
+
     return incr;
 }
@@ -174,11 +174,11 @@
 {
     psMemFreeCallback old = memAllocateCallback;
-    
+
     if ( func != NULL ) {
-            memAllocateCallback = func;
-        } else {
-            memAllocateCallback = memAllocateCallbackDefault;
-        }
-        
+        memAllocateCallback = func;
+    } else {
+        memAllocateCallback = memAllocateCallbackDefault;
+    }
+
     return old;
 }
@@ -187,11 +187,11 @@
 {
     psMemFreeCallback old = memFreeCallback;
-    
+
     if ( func != NULL ) {
-            memFreeCallback = func;
-        } else {
-            memFreeCallback = memFreeCallbackDefault;
-        }
-        
+        memFreeCallback = func;
+    } else {
+        memFreeCallback = memFreeCallbackDefault;
+    }
+
     return old;
 }
@@ -206,5 +206,5 @@
     id = memid + 1;
     pthread_mutex_unlock( &memIdMutex );
-    
+
     return id;
 }
@@ -220,28 +220,28 @@
     // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     // we shouldn't call such things as p_psAlloc/p_psFree here.
-    
+
     if ( m == NULL ) {
-            psError( funcName, "Memory Corruption: NULL memory block found." );
-            return 1;
-        }
-        
+        psError( funcName, "Memory Corruption: NULL memory block found." );
+        return 1;
+    }
+
     if ( m->refCounter == 0 ) {
-            // using an unreferenced block of memory, are you?
-            psError( __func__, "Memory Corruption: memory block %ld was freed but still used.",
-                     m->id );
-            return 1;
-        }
-        
+        // using an unreferenced block of memory, are you?
+        psError( __func__, "Memory Corruption: memory block %ld was freed but still used.",
+                 m->id );
+        return 1;
+    }
+
     if ( m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC ) {
-            psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)",
-                     m->id );
-            return 1;
-        }
+        psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)",
+                 m->id );
+        return 1;
+    }
     if ( *( void** ) ( ( int8_t* ) ( m + 1 ) + m->userMemorySize ) != P_PS_MEMMAGIC ) {
-            psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)",
-                     m->id );
-            return 1;
-        }
-        
+        psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)",
+                 m->id );
+        return 1;
+    }
+
     return 0;
 }
@@ -250,23 +250,23 @@
 {
     int nbad = 0;                       // number of bad blocks
-    
+
     // get exclusive access to the memBlock list to avoid it changing on us while we use it.
     pthread_mutex_lock( &memBlockListMutex );
-    
+
     for ( psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock ) {
-            if ( checkMemBlock( iter, __func__ ) ) {
-                    nbad++;
-                    
-                    memProblemCallback( iter, __func__, __LINE__ );
-                    
-                    if ( abort_on_error ) {
-                            // release the lock on the memblock list
-                            pthread_mutex_unlock( &memBlockListMutex );
-                            psAbort( __func__, "Detected memory corruption" );
-                            return nbad;
-                        }
-                }
-        }
-        
+        if ( checkMemBlock( iter, __func__ ) ) {
+            nbad++;
+
+            memProblemCallback( iter, __func__, __LINE__ );
+
+            if ( abort_on_error ) {
+                // release the lock on the memblock list
+                pthread_mutex_unlock( &memBlockListMutex );
+                psAbort( __func__, "Detected memory corruption" );
+                return nbad;
+            }
+        }
+    }
+
     // release the lock on the memblock list
     pthread_mutex_unlock( &memBlockListMutex );
@@ -278,54 +278,54 @@
 
     psMemBlock * ptr = NULL;
-    
+
     // memory is of the size I want to bother recycling?
     if ( size < P_PS_LARGE_BLOCK_SIZE ) {
-            // find the bin we need.
-            int level = 0;
-            while ( size > recycleBinSize[ level ] ) {
-                    level++;
+        // find the bin we need.
+        int level = 0;
+        while ( size > recycleBinSize[ level ] ) {
+            level++;
+        }
+        // Are we in one of the bins
+        if ( level < recycleBins ) {
+
+            size = recycleBinSize[ level ];  // round-up size to next sized bin.
+
+            pthread_mutex_lock( &recycleMemBlockListMutex );
+
+            if ( recycleMemBlockList[ level ] != NULL ) {
+                ptr = recycleMemBlockList[ level ];
+                recycleMemBlockList[ level ] = ptr->nextBlock;
+                if ( recycleMemBlockList[ level ] != NULL ) {
+                    recycleMemBlockList[ level ] ->previousBlock = NULL;
                 }
-            // Are we in one of the bins
-            if ( level < recycleBins ) {
-            
-                    size = recycleBinSize[ level ];  // round-up size to next sized bin.
-                    
-                    pthread_mutex_lock( &recycleMemBlockListMutex );
-                    
-                    if ( recycleMemBlockList[ level ] != NULL ) {
-                            ptr = recycleMemBlockList[ level ];
-                            recycleMemBlockList[ level ] = ptr->nextBlock;
-                            if ( recycleMemBlockList[ level ] != NULL ) {
-                                    recycleMemBlockList[ level ] ->previousBlock = NULL;
-                                }
-                            size = ptr->userMemorySize;
-                        }
-                        
-                    pthread_mutex_unlock( &recycleMemBlockListMutex );
-                }
-        }
-        
+                size = ptr->userMemorySize;
+            }
+
+            pthread_mutex_unlock( &recycleMemBlockListMutex );
+        }
+    }
+
     if ( ptr == NULL ) {
-            ptr = malloc( sizeof( psMemBlock ) + size + sizeof( void* ) );
-            
+        ptr = malloc( sizeof( psMemBlock ) + size + sizeof( void* ) );
+
+        if ( ptr == NULL ) {
+            ptr = memExhaustedCallback( size );
             if ( ptr == NULL ) {
-                    ptr = memExhaustedCallback( size );
-                    if ( ptr == NULL ) {
-                            psAbort( __func__, "Failed to allocate %u bytes at %s:%d",
-                                     size, file, lineno );
-                        }
-                }
-                
-            ptr->startblock = P_PS_MEMMAGIC;
-            ptr->endblock = P_PS_MEMMAGIC;
-            ptr->userMemorySize = size;
-            pthread_mutex_init( &ptr->refCounterMutex, NULL );
-        }
-        
+                psAbort( __func__, "Failed to allocate %u bytes at %s:%d",
+                         size, file, lineno );
+            }
+        }
+
+        ptr->startblock = P_PS_MEMMAGIC;
+        ptr->endblock = P_PS_MEMMAGIC;
+        ptr->userMemorySize = size;
+        pthread_mutex_init( &ptr->refCounterMutex, NULL );
+    }
+
     // increment the memory id safely.
     pthread_mutex_lock( &memBlockListMutex );
     *( psMemoryId* ) & ptr->id = ++memid;
     pthread_mutex_unlock( &memBlockListMutex );
-    
+
     ptr->file = file;
     ptr->freeFcn = NULL;
@@ -333,24 +333,24 @@
     *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
     ptr->previousBlock = NULL;
-    
+
     ptr->refCounter = 1;                // one user so far
-    
+
     // need exclusive access of the memory block list now...
     pthread_mutex_lock( &memBlockListMutex );
-    
+
     // insert the new block to the front of the memBlock linked-list
     ptr->nextBlock = lastMemBlockAllocated;
     if ( ptr->nextBlock != NULL ) {
-            ptr->nextBlock->previousBlock = ptr;
-        }
+        ptr->nextBlock->previousBlock = ptr;
+    }
     lastMemBlockAllocated = ptr;
-    
+
     pthread_mutex_unlock( &memBlockListMutex );
-    
+
     //  Did the user ask to be informed about this allocation?
     if ( ptr->id == p_psMemAllocateID ) {
-            p_psMemAllocateID += memAllocateCallback( ptr );
-        }
-        
+        p_psMemAllocateID += memAllocateCallback( ptr );
+    }
+
     // And return the user the memory that they allocated
     return ptr + 1;   // user memory
@@ -360,50 +360,50 @@
 {
     if ( vptr == NULL ) {
-            return p_psAlloc( size, file, lineno );
-        } else {
-            psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-            bool isBlockLast = false;
-            
-            if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-                    memProblemCallback( ptr, file, lineno );
-                    psAbort( file, "Realloc detected a memory corruption (id %ld @ %s:%d).",
-                             ptr->id, ptr->file, ptr->lineno );
-                }
-                
-            pthread_mutex_lock( &memBlockListMutex );
-            
-            isBlockLast = ( ptr == lastMemBlockAllocated );
-            
-            ptr = ( psMemBlock* ) realloc( ptr, sizeof( psMemBlock ) + size + sizeof( void* ) );
-            
-            if ( ptr == NULL ) {
-                    psAbort( __func__, "Failed to reallocate %ld bytes at %s:%d",
-                             size, file, lineno );
-                }
-                
-            ptr->userMemorySize = size;
-            *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
-            
-            if ( isBlockLast ) {
-                    lastMemBlockAllocated = ptr;
-                }
-                
-            // the block location may have changed, so fix the linked list addresses.
-            if ( ptr->nextBlock != NULL ) {
-                    ptr->nextBlock->previousBlock = ptr;
-                }
-            if ( ptr->previousBlock != NULL ) {
-                    ptr->previousBlock->nextBlock = ptr;
-                }
-                
-            pthread_mutex_unlock( &memBlockListMutex );
-            
-            //  Did the user ask to be informed about this allocation?
-            if ( ptr->id == p_psMemAllocateID ) {
-                    p_psMemAllocateID += memAllocateCallback( ptr );
-                }
-                
-            return ptr + 1;   // usr memory
-        }
+        return p_psAlloc( size, file, lineno );
+    } else {
+        psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
+        bool isBlockLast = false;
+
+        if ( checkMemBlock( ptr, __func__ ) != 0 ) {
+            memProblemCallback( ptr, file, lineno );
+            psAbort( file, "Realloc detected a memory corruption (id %ld @ %s:%d).",
+                     ptr->id, ptr->file, ptr->lineno );
+        }
+
+        pthread_mutex_lock( &memBlockListMutex );
+
+        isBlockLast = ( ptr == lastMemBlockAllocated );
+
+        ptr = ( psMemBlock* ) realloc( ptr, sizeof( psMemBlock ) + size + sizeof( void* ) );
+
+        if ( ptr == NULL ) {
+            psAbort( __func__, "Failed to reallocate %ld bytes at %s:%d",
+                     size, file, lineno );
+        }
+
+        ptr->userMemorySize = size;
+        *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
+
+        if ( isBlockLast ) {
+            lastMemBlockAllocated = ptr;
+        }
+
+        // the block location may have changed, so fix the linked list addresses.
+        if ( ptr->nextBlock != NULL ) {
+            ptr->nextBlock->previousBlock = ptr;
+        }
+        if ( ptr->previousBlock != NULL ) {
+            ptr->previousBlock->nextBlock = ptr;
+        }
+
+        pthread_mutex_unlock( &memBlockListMutex );
+
+        //  Did the user ask to be informed about this allocation?
+        if ( ptr->id == p_psMemAllocateID ) {
+            p_psMemAllocateID += memAllocateCallback( ptr );
+        }
+
+        return ptr + 1;   // usr memory
+    }
 }
 
@@ -421,41 +421,41 @@
     int j = 0;
     psMemBlock* topBlock = lastMemBlockAllocated;
-    
+
     pthread_mutex_lock( &memBlockListMutex );
-    
+
     for ( psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock ) {
-            if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
-                    nleak++;
-                    
-                    if ( fd != NULL ) {
-                            if ( nleak == 1 ) {
-                                    fprintf( fd, "   %20s:line ID\n", "file" );
-                                }
-                                
-                            fprintf( fd, "   %20s:%-4d %ld\n", iter->file, iter->lineno, iter->id );
-                        }
+        if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
+            nleak++;
+
+            if ( fd != NULL ) {
+                if ( nleak == 1 ) {
+                    fprintf( fd, "   %20s:line ID\n", "file" );
                 }
-        }
-        
+
+                fprintf( fd, "   %20s:%-4d %ld\n", iter->file, iter->lineno, iter->id );
+            }
+        }
+    }
+
     pthread_mutex_unlock( &memBlockListMutex );
-    
+
     if ( nleak == 0 || arr == NULL ) {
-            return nleak;
-        }
-        
+        return nleak;
+    }
+
     *arr = p_psAlloc( nleak * sizeof( psMemBlock ), __FILE__, __LINE__ );
     pthread_mutex_lock( &memBlockListMutex );
-    
+
     for ( psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock ) {
-            if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
-                    ( *arr ) [ j++ ] = iter;
-                    if ( j == nleak ) { // found them all
-                            break;
-                        }
-                }
-        }
-        
+        if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
+            ( *arr ) [ j++ ] = iter;
+            if ( j == nleak ) { // found them all
+                break;
+            }
+        }
+    }
+
     pthread_mutex_unlock( &memBlockListMutex );
-    
+
     return nleak;
 }
@@ -463,5 +463,5 @@
 /*
  * Reference counting APIs
- */ 
+ */
 // return refCounter
 psReferenceCount psMemGetRefCounter( void *vptr )
@@ -469,19 +469,19 @@
     psMemBlock * ptr;
     unsigned int refCount;
-    
+
     if ( vptr == NULL ) {
-            return 0;
-        }
-        
+        return 0;
+    }
+
     ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, __func__, __LINE__ );
-        }
-        
+        memProblemCallback( ptr, __func__, __LINE__ );
+    }
+
     pthread_mutex_lock( &ptr->refCounterMutex );
     refCount = ptr->refCounter;
     pthread_mutex_unlock( &ptr->refCounterMutex );
-    
+
     return refCount;
 }
@@ -490,19 +490,19 @@
 {
     psMemBlock * ptr;
-    
+
     if ( vptr == NULL ) {
-            return vptr;
-        }
-        
+        return vptr;
+    }
+
     ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) ) {
-            memProblemCallback( ptr, file, lineno );
-        }
-        
+        memProblemCallback( ptr, file, lineno );
+    }
+
     pthread_mutex_lock( &ptr->refCounterMutex );
     ptr->refCounter++;
     pthread_mutex_unlock( &ptr->refCounterMutex );
-    
+
     return vptr;
 }
@@ -512,90 +512,90 @@
 {
     if ( vptr == NULL ) {
-            return NULL;
-        }
-        
+        return NULL;
+    }
+
     psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, file, lineno );
-            return NULL;
-        }
-        
+        memProblemCallback( ptr, file, lineno );
+        return NULL;
+    }
+
     pthread_mutex_lock( &ptr->refCounterMutex );
-    
+
     if ( ptr->refCounter > 1 ) {
-            /// XXX - Probably should have another mutex here.
-            ptr->refCounter--;          // multiple references, just decrement the count.
-            pthread_mutex_unlock( &ptr->refCounterMutex );
-            
+        /// XXX - Probably should have another mutex here.
+        ptr->refCounter--;          // multiple references, just decrement the count.
+        pthread_mutex_unlock( &ptr->refCounterMutex );
+
+    } else {
+        pthread_mutex_unlock( &ptr->refCounterMutex );
+
+        // Did the user ask to be informed about this deallocation?
+        if ( ptr->id == p_psMemFreeID ) {
+            p_psMemFreeID += memFreeCallback( ptr );
+        }
+
+        if ( ptr->freeFcn != NULL ) {
+            ptr->freeFcn( vptr );
+        }
+
+        pthread_mutex_lock( &memBlockListMutex );
+
+        // cut the memBlock out of the memBlock list
+        if ( ptr->nextBlock != NULL ) {
+            ptr->nextBlock->previousBlock = ptr->previousBlock;
+        }
+        if ( ptr->previousBlock != NULL ) {
+            ptr->previousBlock->nextBlock = ptr->nextBlock;
+        }
+        if ( lastMemBlockAllocated == ptr ) {
+            lastMemBlockAllocated = ptr->nextBlock;
+        }
+
+        pthread_mutex_unlock( &memBlockListMutex );
+
+
+        // do we need to recycle?
+        if ( ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE ) {
+
+            int level = 1;
+            while ( ptr->userMemorySize >= recycleBinSize[ level ] ) {
+                level++;
+            }
+            level--;
+
+            ptr->refCounter = 0;
+            ptr->previousBlock = NULL;
+
+            pthread_mutex_lock( &recycleMemBlockListMutex );
+            ptr->nextBlock = recycleMemBlockList[ level ];
+            if ( recycleMemBlockList[ level ] != NULL ) {
+                recycleMemBlockList[ level ] ->previousBlock = ptr;
+            }
+            recycleMemBlockList[ level ] = ptr;
+            pthread_mutex_unlock( &recycleMemBlockListMutex );
+
         } else {
-            pthread_mutex_unlock( &ptr->refCounterMutex );
-            
-            // Did the user ask to be informed about this deallocation?
-            if ( ptr->id == p_psMemFreeID ) {
-                    p_psMemFreeID += memFreeCallback( ptr );
-                }
-                
-            if ( ptr->freeFcn != NULL ) {
-                    ptr->freeFcn( vptr );
-                }
-                
-            pthread_mutex_lock( &memBlockListMutex );
-            
-            // cut the memBlock out of the memBlock list
-            if ( ptr->nextBlock != NULL ) {
-                    ptr->nextBlock->previousBlock = ptr->previousBlock;
-                }
-            if ( ptr->previousBlock != NULL ) {
-                    ptr->previousBlock->nextBlock = ptr->nextBlock;
-                }
-            if ( lastMemBlockAllocated == ptr ) {
-                    lastMemBlockAllocated = ptr->nextBlock;
-                }
-                
-            pthread_mutex_unlock( &memBlockListMutex );
-            
-            
-            // do we need to recycle?
-            if ( ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE ) {
-            
-                    int level = 1;
-                    while ( ptr->userMemorySize >= recycleBinSize[ level ] ) {
-                            level++;
-                        }
-                    level--;
-                    
-                    ptr->refCounter = 0;
-                    ptr->previousBlock = NULL;
-                    
-                    pthread_mutex_lock( &recycleMemBlockListMutex );
-                    ptr->nextBlock = recycleMemBlockList[ level ];
-                    if ( recycleMemBlockList[ level ] != NULL ) {
-                            recycleMemBlockList[ level ] ->previousBlock = ptr;
-                        }
-                    recycleMemBlockList[ level ] = ptr;
-                    pthread_mutex_unlock( &recycleMemBlockListMutex );
-                    
-                } else {
-                    // memory is larger than I want to recycle.
-                    #ifdef PS_MEM_DEBUG
-                    ( void ) p_psRealloc( vptr, 0, file, lineno );
-                    ptr->previousBlock = NULL;
-                    ptr->nextBlock = deadBlockList;
-                    if ( deadBlockList != NULL ) {
-                            deadBlockList->previous = ptr;
-                        }
-                    deadBlockList = ptr;
-                    #else
-                    
-                    pthread_mutex_destroy( &ptr->refCounterMutex );
-                    free( ptr );
-                    #endif
-                    
-                }
-                
-            vptr = NULL;    // since we freed it, make sure we return NULL.
-        }
-        
+            // memory is larger than I want to recycle.
+            #ifdef PS_MEM_DEBUG
+            ( void ) p_psRealloc( vptr, 0, file, lineno );
+            ptr->previousBlock = NULL;
+            ptr->nextBlock = deadBlockList;
+            if ( deadBlockList != NULL ) {
+                deadBlockList->previous = ptr;
+            }
+            deadBlockList = ptr;
+            #else
+
+            pthread_mutex_destroy( &ptr->refCounterMutex );
+            free( ptr );
+            #endif
+
+        }
+
+        vptr = NULL;    // since we freed it, make sure we return NULL.
+    }
+
     return vptr;
 }
@@ -604,28 +604,28 @@
 {
     if ( vptr == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, __func__, __LINE__ );
-        }
-        
+        memProblemCallback( ptr, __func__, __LINE__ );
+    }
+
     ptr->freeFcn = freeFcn;
-    
+
 }
 psFreeFcn p_psMemGetDeallocator( void* vptr )
 {
     if ( vptr == NULL ) {
-            return NULL;
-        }
-        
+        return NULL;
+    }
+
     psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-    
+
     if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, __func__, __LINE__ );
-        }
-        
+        memProblemCallback( ptr, __func__, __LINE__ );
+    }
+
     return ptr->freeFcn;
 }
Index: /trunk/psLib/src/sysUtils/psMemory.h
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.h	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psMemory.h	(revision 1385)
@@ -14,6 +14,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 23:52:34 $
+ *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psString.c
===================================================================
--- /trunk/psLib/src/sysUtils/psString.c	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psString.c	(revision 1385)
@@ -8,6 +8,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-10 23:37:36 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psTrace.c
===================================================================
--- /trunk/psLib/src/sysUtils/psTrace.c	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psTrace.c	(revision 1385)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-30 01:09:12 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psType.h
===================================================================
--- /trunk/psLib/src/sysUtils/psType.h	(revision 1384)
+++ /trunk/psLib/src/sysUtils/psType.h	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-07-31 02:28:10 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -142,8 +142,8 @@
  */
 typedef struct
-    {
-        psElemType type;    ///< Primitive type.
-        psDimen dimen;      ///< Dimensionality.
-    }
+{
+    psElemType type;    ///< Primitive type.
+    psDimen dimen;      ///< Dimensionality.
+}
 psType;
 
Index: /trunk/psLib/src/types/psArray.c
===================================================================
--- /trunk/psLib/src/types/psArray.c	(revision 1384)
+++ /trunk/psLib/src/types/psArray.c	(revision 1385)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -67,16 +67,17 @@
         psError(__func__, "Null input vector\n");
         return NULL;
-    } else if(in->nalloc != nalloc) {                    // No need to realloc to same size
-        if(nalloc < in->n) {
-            for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
-                psFree(in->data[i]);
+    } else
+        if(in->nalloc != nalloc) {                    // No need to realloc to same size
+            if(nalloc < in->n) {
+                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
+                    psFree(in->data[i]);
+                }
+                in->n = nalloc;
             }
-            in->n = nalloc;
+
+            // Realloc after decrementation to avoid accessing freed array elements
+            in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
+            in->nalloc = nalloc;
         }
-
-        // Realloc after decrementation to avoid accessing freed array elements
-        in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
-        in->nalloc = nalloc;
-    }
 
     return in;
Index: /trunk/psLib/src/types/psBitSet.c
===================================================================
--- /trunk/psLib/src/types/psBitSet.c	(revision 1384)
+++ /trunk/psLib/src/types/psBitSet.c	(revision 1385)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-01 21:48:11 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -126,11 +126,13 @@
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return inBitSet;
-    } else if(bit < 0) {
-        psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
-        return inBitSet;
-    } else if(bit > inBitSet->n*8-1) {
-        psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
-        return inBitSet;
-    }
+    } else
+        if(bit < 0) {
+            psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
+            return inBitSet;
+        } else
+            if(bit > inBitSet->n*8-1) {
+                psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
+                return inBitSet;
+            }
 
     // Variable byte is the byte in the array that contains the bit to be set
@@ -148,11 +150,13 @@
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return 0;
-    } else if(bit < 0) {
-        psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
-        return 0;
-    } else if(bit > inBitSet->n*8-1) {
-        psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
-        return 0;
-    }
+    } else
+        if(bit < 0) {
+            psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
+            return 0;
+        } else
+            if(bit > inBitSet->n*8-1) {
+                psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
+                return 0;
+            }
 
     // Variable byte is the byte in the array that contains the bit to be tested
Index: /trunk/psLib/src/types/psList.c
===================================================================
--- /trunk/psLib/src/types/psList.c	(revision 1384)
+++ /trunk/psLib/src/types/psList.c	(revision 1385)
@@ -6,6 +6,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-04 23:37:39 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -349,9 +349,10 @@
     if (list->iter == ITER_INIT_HEAD) {
         return list->head;
-    } else if (list->iter == ITER_INIT_TAIL) {
-        return list->tail;
-    } else {
-        return list->iter;
-    }
+    } else
+        if (list->iter == ITER_INIT_TAIL) {
+            return list->tail;
+        } else {
+            return list->iter;
+        }
 }
 
@@ -360,9 +361,10 @@
     if (list->iter == ITER_INIT_HEAD) {
         return 0;
-    } else if (list->iter == ITER_INIT_TAIL) {
-        return list->size-1;
-    } else {
-        return list->iterIndex;
-    }
+    } else
+        if (list->iter == ITER_INIT_TAIL) {
+            return list->size-1;
+        } else {
+            return list->iterIndex;
+        }
 }
 
Index: /trunk/psLib/src/types/psMetadata.c
===================================================================
--- /trunk/psLib/src/types/psMetadata.c	(revision 1384)
+++ /trunk/psLib/src/types/psMetadata.c	(revision 1385)
@@ -11,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 21:05:24 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -65,15 +65,15 @@
 {
     psMetadataType type;
-    
+
     type = metadataItem->type;
-    
+
     if ( metadataItem == NULL ) {
-            return ;
-        }
-        
+        return ;
+    }
+
     psFree( metadataItem->name );
     psFree( metadataItem->comment );
     psFree( metadataItem->items );
-    
+
     if ( type == PS_META_STR ||
             type == PS_META_IMG ||
@@ -82,6 +82,6 @@
             type == PS_META_ASTROM ||
             type == PS_META_UNKNOWN ) {
-            psFree( metadataItem->data.V );
-        }
+        psFree( metadataItem->data.V );
+    }
 }
 
@@ -89,6 +89,6 @@
 {
     if ( metadata == NULL ) {
-            return ;
-        }
+        return ;
+    }
     psFree( metadata->list );
     psFree( metadata->table );
@@ -103,14 +103,14 @@
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
-    
+
     // Get the variable list parameters to pass to allocation function
     va_start( argPtr, comment );
-    
+
     // Call metadata item allocation
     metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
-    
+
     // Clean up stack after variable arguement has been used
     va_end( argPtr );
-    
+
     return metadataItem;
 }
@@ -119,67 +119,67 @@
 {
     psMetadataItem * metadataItem = NULL;
-    
+
     if ( name == NULL ) {
-            psError( __func__, "Null value for string not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null value for string not allowed" );
+        return NULL;
+    }
+
     // Allocate metadata item
     metadataItem = ( psMetadataItem * ) psAlloc( sizeof( psMetadataItem ) );
     if ( metadataItem == NULL ) {
-            psAbort( __func__, "Failed to allocate memory" );
-        }
-        
+        psAbort( __func__, "Failed to allocate memory" );
+    }
+
     // Set deallocator
     p_psMemSetDeallocator( metadataItem, ( psFreeFcn ) metadataItemFree );
-    
+
     // Allocate and set metadata item comment
     metadataItem->comment = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
     if ( comment == NULL ) {
-            // Per SDRS, null isn't allowed, must use "" instead
-            strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
-        } else {
-            strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
-        }
-        
+        // Per SDRS, null isn't allowed, must use "" instead
+        strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
+    } else {
+        strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
+    }
+
     // Set metadata item unique id
     *( int* ) ( &metadataItem->id ) = ++metadataId;
-    
+
     // Set metadata item type
     metadataItem->type = type;
-    
+
     // Set metadata item value
     switch ( type ) {
-            case PS_META_BOOL:
-            metadataItem->data.B = ( bool ) va_arg( argPtr, int );
-            break;
-            case PS_META_S32:
-            metadataItem->data.S32 = va_arg( argPtr, psS32 );
-            break;
-            case PS_META_F32:
-            metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
-            break;
-            case PS_META_F64:
-            metadataItem->data.F64 = va_arg( argPtr, psF64 );
-            break;
-            case PS_META_STR:
-            metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
-            break;
-            case PS_META_IMG:
-            case PS_META_JPEG:
-            case PS_META_PNG:
-            case PS_META_ASTROM:
-            case PS_META_UNKNOWN:
-            default:
-            psError( __func__, "Invalid psMetadataType: %d", type );
-        }
-        
+    case PS_META_BOOL:
+        metadataItem->data.B = ( bool ) va_arg( argPtr, int );
+        break;
+    case PS_META_S32:
+        metadataItem->data.S32 = va_arg( argPtr, psS32 );
+        break;
+    case PS_META_F32:
+        metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
+        break;
+    case PS_META_F64:
+        metadataItem->data.F64 = va_arg( argPtr, psF64 );
+        break;
+    case PS_META_STR:
+        metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
+        break;
+    case PS_META_IMG:
+    case PS_META_JPEG:
+    case PS_META_PNG:
+    case PS_META_ASTROM:
+    case PS_META_UNKNOWN:
+    default:
+        psError( __func__, "Invalid psMetadataType: %d", type );
+    }
+
     // Allocate and set metadata item name
     metadataItem->name = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
     vsprintf( metadataItem->name, name, argPtr );
-    
+
     // Allocate metadata items with same name.
     metadataItem->items = psListAlloc( NULL );
-    
+
     return metadataItem;
 }
@@ -190,28 +190,28 @@
     psHash *table = NULL;
     psMetadata *metadata = NULL;
-    
+
     // Allocate metadata
     metadata = ( psMetadata * ) psAlloc( sizeof( psMetadata ) );
     if ( metadata == NULL ) {
-            psAbort( __func__, "Failed to allocate metadata" );
-        }
-        
+        psAbort( __func__, "Failed to allocate metadata" );
+    }
+
     // Set deallocator
     p_psMemSetDeallocator( metadata, ( psFreeFcn ) metadataFree );
-    
+
     // Allocate metadata's internal containers
     list = ( psList * ) psListAlloc( NULL );
     if ( list == NULL ) {
-            psAbort( __func__, "Failed to allocate list" );
-        }
-        
+        psAbort( __func__, "Failed to allocate list" );
+    }
+
     table = ( psHash * ) psHashAlloc( 10 );
     if ( table == NULL ) {
-            psAbort( __func__, "Failed to allocate table" );
-        }
-        
+        psAbort( __func__, "Failed to allocate table" );
+    }
+
     metadata->list = list;
     metadata->table = table;
-    
+
     return metadata;
 }
@@ -224,48 +224,49 @@
     psMetadataItem *value = NULL;
     psMetadataType type = PS_META_ITEM_SET;
-    
+
     if ( md == NULL ) {
-            psError( __func__, "Null metadata collection not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata collection not allowed" );
+        return false;
+    }
+
     if ( metadataItem == NULL ) {
-            psError( __func__, "Null metadata item not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata item not allowed" );
+        return false;
+    }
+
     type = metadataItem->type;
-    
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return false;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return false;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     key = metadataItem->name;
     if ( key == NULL ) {
-            psError( __func__, "Null key item not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null key item not allowed" );
+        return false;
+    }
+
     // Check if key is already in table
     value = ( psMetadataItem* ) psHashLookup( mdTable, key );
     if ( value != NULL && type != PS_META_ITEM_SET ) {
-    
-            // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
-            // add the new metadata item to hash as a child of the existing metadata item folder node.
-            if ( !psListAdd( value->items, metadataItem, where ) ) {
-                    psError( __func__, "Couldn't add metadata item to items list. Name: %s",
-                             metadataItem->name );
-                    return false;
-                }
-        } else if ( value != NULL ) {
-        
+
+        // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
+        // add the new metadata item to hash as a child of the existing metadata item folder node.
+        if ( !psListAdd( value->items, metadataItem, where ) ) {
+            psError( __func__, "Couldn't add metadata item to items list. Name: %s",
+                     metadataItem->name );
+            return false;
+        }
+    } else
+        if ( value != NULL ) {
+
             // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
             // it will wipe out existing node.
@@ -274,20 +275,20 @@
             return false;
         } else {
-        
+
             // Duplicate key not found. Add new metadata item to metadata collection's hash
             if ( !psHashAdd( mdTable, key, metadataItem ) ) {
-                    psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
-                             metadataItem->name );
-                    return false;
-                }
-        }
-        
+                psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
+                         metadataItem->name );
+                return false;
+            }
+        }
+
     // Add all items to metadata collection's list, even if they have the same metadata item names
     if ( !psListAdd( md->list, metadataItem, where ) ) {
-            psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                     metadataItem->name );
-            return false;
-        }
-        
+        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                 metadataItem->name );
+        return false;
+    }
+
     return true;
 }
@@ -298,19 +299,19 @@
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
-    
+
     va_start( argPtr, comment );
     metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
     va_end( argPtr );
-    
+
     if ( !psMetadataAddItem( md, where, metadataItem ) ) {
-            psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                     metadataItem->name );
-            psFree( metadataItem );
-            return false;
-        }
-        
+        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                 metadataItem->name );
+        psFree( metadataItem );
+        return false;
+    }
+
     // Decrement reference count, since the metadata item is now in metadata collection and no longer needed here
     psMemDecrRefCounter( metadataItem );
-    
+
     return true;
 }
@@ -323,72 +324,72 @@
     psMetadataItem *entry = NULL;
     psMetadataItem *entryChild = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return false;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return false;
+    }
+
     // Select removal by key or index
     if ( key != NULL ) {
-    
-            // Remove by key name
-            entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-            if ( entry == NULL ) {
-                    psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
-                    return false;
-                }
-                
-            numChildren = entry->items->size;
-            if ( entry->type == PS_META_ITEM_SET && numChildren > 0 ) {
-            
-                    // Table entry has children. Entry and children must be removed from metadata collection's list
-                    psListSetIterator( mdList, PS_LIST_HEAD );
-                    entryChild = psListGetCurrent( mdList );
-                    while ( entryChild != NULL ) {
-                            if ( !psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN ) ) {
-                                    psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
-                                    return false;
-                                }
-                            entryChild = psListGetNext( entry->items );
-                        }
-                }
-                
-            // Remove entry from metadata collection's list
-            if ( !psListRemove( mdList, entry, PS_LIST_UNKNOWN ) ) {
+
+        // Remove by key name
+        entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
+        if ( entry == NULL ) {
+            psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
+            return false;
+        }
+
+        numChildren = entry->items->size;
+        if ( entry->type == PS_META_ITEM_SET && numChildren > 0 ) {
+
+            // Table entry has children. Entry and children must be removed from metadata collection's list
+            psListSetIterator( mdList, PS_LIST_HEAD );
+            entryChild = psListGetCurrent( mdList );
+            while ( entryChild != NULL ) {
+                if ( !psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN ) ) {
                     psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
                     return false;
                 }
-                
-            // Remove entry from metadata collection's table
-            if ( !psHashRemove( mdTable, key ) ) {
-                    psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
-                    return false;
-                }
-        } else {
-        
-            // Remove by index
-            entry = psListGet( mdList, where );
-            if ( entry == NULL ) {
-                    psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
-                    return false;
-                }
-                
-            key = entry->name;
-            if ( key == NULL ) {
-                    psError( __func__, "Null key name not allowed. Index: %d", where );
-                    return false;
-                }
-                
-            // Use recursive remove, now that key is known
-            psMetadataRemove( md, PS_LIST_UNKNOWN, key );
-        }
-        
+                entryChild = psListGetNext( entry->items );
+            }
+        }
+
+        // Remove entry from metadata collection's list
+        if ( !psListRemove( mdList, entry, PS_LIST_UNKNOWN ) ) {
+            psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+            return false;
+        }
+
+        // Remove entry from metadata collection's table
+        if ( !psHashRemove( mdTable, key ) ) {
+            psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
+            return false;
+        }
+    } else {
+
+        // Remove by index
+        entry = psListGet( mdList, where );
+        if ( entry == NULL ) {
+            psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
+            return false;
+        }
+
+        key = entry->name;
+        if ( key == NULL ) {
+            psError( __func__, "Null key name not allowed. Index: %d", where );
+            return false;
+        }
+
+        // Use recursive remove, now that key is known
+        psMetadataRemove( md, PS_LIST_UNKNOWN, key );
+    }
+
     return true;
 }
@@ -398,22 +399,22 @@
     psHash * mdTable = NULL;
     psMetadataItem *entry = NULL;
-    
+
     mdTable = md->table;
     if ( mdTable == NULL ) {
-            psError( __func__, "Null metadata table not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null metadata table not allowed" );
+        return NULL;
+    }
+
     if ( key == NULL ) {
-            psError( __func__, "Null key name not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null key name not allowed" );
+        return NULL;
+    }
+
     entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
     if ( entry == NULL ) {
-            psError( __func__, "Could not find metadata item with given key. Key: %s", key );
-            return NULL;
-        }
-        
+        psError( __func__, "Could not find metadata item with given key. Key: %s", key );
+        return NULL;
+    }
+
     return entry;
 }
@@ -423,17 +424,17 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     entry = ( psMetadataItem* ) psListGet( mdList, where );
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
-            return NULL;
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
+        return NULL;
+    }
+
     return entry;
 }
@@ -442,13 +443,13 @@
 {
     psList * mdList = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return false;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return false;
+    }
+
     psListSetIterator( mdList, where );
-    
+
     return true;
 }
@@ -458,33 +459,33 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     psListSetIterator( mdList, which );
     entry = psListGetCurrent( mdList );
     while ( entry != NULL ) {
-            if ( !strncmp( match, entry->name, strlen( match ) ) ) {
-            
-                    // Match found
-                    return entry;
-                }
-            entry = psListGetNext( mdList );
-        }
-        
+        if ( !strncmp( match, entry->name, strlen( match ) ) ) {
+
+            // Match found
+            return entry;
+        }
+        entry = psListGetNext( mdList );
+    }
+
     // Match not found
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    }
+
     return entry;
 }
@@ -494,33 +495,33 @@
     psList * mdList = NULL;
     psMetadataItem *entry = NULL;
-    
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
-    mdList = md->list;
-    if ( mdList == NULL ) {
-            psError( __func__, "Null metadata list not allowed" );
-            return NULL;
-        }
-        
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
+    mdList = md->list;
+    if ( mdList == NULL ) {
+        psError( __func__, "Null metadata list not allowed" );
+        return NULL;
+    }
+
     psListSetIterator( mdList, which );
     entry = psListGetCurrent( mdList );
     while ( entry != NULL ) {
-            if ( !strncmp( match, entry->name, strlen( match ) ) ) {
-            
-                    // Match found
-                    return entry;
-                }
-            entry = psListGetPrevious( mdList );
-        }
-        
+        if ( !strncmp( match, entry->name, strlen( match ) ) ) {
+
+            // Match found
+            return entry;
+        }
+        entry = psListGetPrevious( mdList );
+    }
+
     // Match not found
     if ( entry == NULL ) {
-            psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
-        }
-        
+        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    }
+
     return entry;
 }
@@ -529,47 +530,47 @@
 {
     psMetadataType type;
-    
+
     if ( fd == NULL ) {
-            psError( __func__, "Null file descriptor not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null file descriptor not allowed" );
+        return ;
+    }
+
     if ( format == NULL ) {
-            psError( __func__, "Null format not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null format not allowed" );
+        return ;
+    }
+
     if ( metadataItem == NULL ) {
-            psError( __func__, "Null metadata not allowed" );
-            return ;
-        }
-        
+        psError( __func__, "Null metadata not allowed" );
+        return ;
+    }
+
     type = metadataItem->type;
-    
+
     switch ( type ) {
-            case PS_META_BOOL:
-            fprintf( fd, format, metadataItem->data.B );
-            break;
-            case PS_META_S32:
-            fprintf( fd, format, metadataItem->data.S32 );
-            break;
-            case PS_META_F32:
-            fprintf( fd, format, metadataItem->data.F32 );
-            break;
-            case PS_META_F64:
-            fprintf( fd, format, metadataItem->data.F64 );
-            break;
-            case PS_META_STR:
-            fprintf( fd, format, metadataItem->data.V );
-            break;
-            case PS_META_ITEM_SET:
-            case PS_META_IMG:
-            case PS_META_JPEG:
-            case PS_META_PNG:
-            case PS_META_ASTROM:
-            case PS_META_UNKNOWN:
-            default:
-            psError( __func__, " Invalid psMetadataType to print: %d", type );
-        }
+    case PS_META_BOOL:
+        fprintf( fd, format, metadataItem->data.B );
+        break;
+    case PS_META_S32:
+        fprintf( fd, format, metadataItem->data.S32 );
+        break;
+    case PS_META_F32:
+        fprintf( fd, format, metadataItem->data.F32 );
+        break;
+    case PS_META_F64:
+        fprintf( fd, format, metadataItem->data.F64 );
+        break;
+    case PS_META_STR:
+        fprintf( fd, format, metadataItem->data.V );
+        break;
+    case PS_META_ITEM_SET:
+    case PS_META_IMG:
+    case PS_META_JPEG:
+    case PS_META_PNG:
+    case PS_META_ASTROM:
+    case PS_META_UNKNOWN:
+    default:
+        psError( __func__, " Invalid psMetadataType to print: %d", type );
+    }
 }
 
@@ -590,100 +591,102 @@
     int keyNum = 0;
     psMetadataType metadataItemType;
-    
+
     if ( fd == NULL ) {
-            psError( __func__, "Null FITS file descriptor not allowed" );
-            return NULL;
-        }
-        
+        psError( __func__, "Null FITS file descriptor not allowed" );
+        return NULL;
+    }
+
     if ( extname == NULL && extnum == 0 ) {
-            psError( __func__, "Null extname AND extnum = 0 not allowed" );
-            return NULL;
-        } else if ( extname && extnum ) {
+        psError( __func__, "Null extname AND extnum = 0 not allowed" );
+        return NULL;
+    } else
+        if ( extname && extnum ) {
             psError( __func__, "Both extname AND extnum arguments should not have values." );
             return NULL;
         }
-        
+
     // Allocate metadata if user didn't
     if ( output == NULL ) {
-            output = psMetadataAlloc();
-        }
-        
+        output = psMetadataAlloc();
+    }
+
     // Move to user designated HDU number or HDU name in FITS file. HDU numbers starts at one.
     if ( extname == NULL ) {
-            if ( fits_movabs_hdu( fd, extnum, &hduType, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while locating header: %s", fitsErr );
-                    status = 0;
-                    return output;
-                }
-        } else if ( extnum > 0 ) {
+        if ( fits_movabs_hdu( fd, extnum, &hduType, &status ) != 0 ) {
+            fits_get_errstatus( status, fitsErr );
+            psError( __func__, "FITS error while locating header: %s", fitsErr );
+            status = 0;
+            return output;
+        }
+    } else
+        if ( extnum > 0 ) {
             tempExtname = ( char* ) extname;
             if ( fits_movnam_hdu( fd, ANY_HDU, tempExtname, 0, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while locating header: %s", fitsErr );
-                    status = 0;
-                    return output;
-                }
-        }
-        
+                fits_get_errstatus( status, fitsErr );
+                psError( __func__, "FITS error while locating header: %s", fitsErr );
+                status = 0;
+                return output;
+            }
+        }
+
     // Get number of key names
     if ( fits_get_hdrpos( fd, &numKeys, &keyNum, &status ) != 0 ) {
+        fits_get_errstatus( status, fitsErr );
+        psError( __func__, "FITS error while reading keys: %s", fitsErr );
+        status = 0;
+        return output;
+    }
+
+    // Get each key name. Keywords start at one.
+    for ( i = 1; i <= numKeys; i++ ) {
+        if ( fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0 ) {
             fits_get_errstatus( status, fitsErr );
-            psError( __func__, "FITS error while reading keys: %s", fitsErr );
+            psError( __func__, "FITS error while reading key number %d: %s", i, fitsErr );
             status = 0;
             return output;
         }
-        
-    // Get each key name. Keywords start at one.
-    for ( i = 1; i <= numKeys; i++ ) {
-            if ( fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    psError( __func__, "FITS error while reading key number %d: %s", i, fitsErr );
-                    status = 0;
-                    return output;
-                }
-            if ( fits_get_keytype( keyValue, &keyType, &status ) != 0 ) {
-                    fits_get_errstatus( status, fitsErr );
-                    if ( status != VALUE_UNDEFINED ) {
-                            psError( __func__, "FITS error while determining key type: %s", fitsErr );
-                            status = 0;
-                            return output;
-                        } else {
-                            // Some keywords are still valid even though they don't have a type or value, like COMMENTS
-                            keyType = 'C';
-                            status = 0;
-                        }
-                }
-                
-            switch ( keyType ) {
-                    case 'I':
-                    metadataItemType = PS_META_S32;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atoi( keyValue ) );
-                    break;
-                    case 'F':
-                    metadataItemType = PS_META_F64;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atof( keyValue ) );
-                    break;
-                    case 'C':
-                    metadataItemType = PS_META_STR;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, keyValue );
-                    break;
-                    case 'L':
-                    metadataItemType = PS_META_BOOL;
-                    tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
-                    success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, tempBool );
-                    break;
-                    case 'U':
-                    case 'X':
-                    default:
-                    psError( __func__, "Invalid psMetadataType: %c", keyType );
-                    return output;
-                }
-                
-            if ( !success ) {
-                    psError( __func__, "Failed to add metadata item. Name: %s", keyName );
-                }
-        }
-        
+        if ( fits_get_keytype( keyValue, &keyType, &status ) != 0 ) {
+            fits_get_errstatus( status, fitsErr );
+            if ( status != VALUE_UNDEFINED ) {
+                psError( __func__, "FITS error while determining key type: %s", fitsErr );
+                status = 0;
+                return output;
+            } else {
+                // Some keywords are still valid even though they don't have a type or value, like COMMENTS
+                keyType = 'C';
+                status = 0;
+            }
+        }
+
+        switch ( keyType ) {
+        case 'I':
+            metadataItemType = PS_META_S32;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atoi( keyValue ) );
+            break;
+        case 'F':
+            metadataItemType = PS_META_F64;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, atof( keyValue ) );
+            break;
+        case 'C':
+            metadataItemType = PS_META_STR;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, keyValue );
+            break;
+        case 'L':
+            metadataItemType = PS_META_BOOL;
+            tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
+            success = psMetadataAdd( output, PS_LIST_HEAD, keyName, metadataItemType, keyComment, tempBool );
+            break;
+        case 'U':
+        case 'X':
+        default:
+            psError( __func__, "Invalid psMetadataType: %c", keyType );
+            return output;
+        }
+
+        if ( !success ) {
+            psError( __func__, "Failed to add metadata item. Name: %s", keyName );
+        }
+    }
+
     return output;
 }
Index: /trunk/psLib/src/types/psMetadata.h
===================================================================
--- /trunk/psLib/src/types/psMetadata.h	(revision 1384)
+++ /trunk/psLib/src/types/psMetadata.h	(revision 1385)
@@ -10,6 +10,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 22:11:09 $
+*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-04 23:37:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -59,19 +59,19 @@
  */
 typedef struct psMetadataItem
+{
+    const int id;                       ///< Unique ID for metadata item.
+    char *restrict name;                ///< Name of metadata item.
+    psMetadataType type;                ///< Type of metadata item.
+    union
     {
-        const int id;                       ///< Unique ID for metadata item.
-        char *restrict name;                ///< Name of metadata item.
-        psMetadataType type;                ///< Type of metadata item.
-        union
-            {
-                bool B;
-                psS32 S32;                  ///< Signed 32-bit integer data.
-                psF32 F32;                  ///< Single-precision float data.
-                psF64 F64;                  ///< Double-precision float data.
-                psPTR V;                    ///< Pointer to other type of data.
-            }data;                          ///< Union for data types.
-        char *comment;                      ///< Optional comment ("", not NULL).
-        psList *restrict items;             ///< List of psMetadataItems with same name.
-    }
+        bool B;
+        psS32 S32;                  ///< Signed 32-bit integer data.
+        psF32 F32;                  ///< Single-precision float data.
+        psF64 F64;                  ///< Double-precision float data.
+        psPTR V;                    ///< Pointer to other type of data.
+    }data;                          ///< Union for data types.
+    char *comment;                      ///< Optional comment ("", not NULL).
+    psList *restrict items;             ///< List of psMetadataItems with same name.
+}
 psMetadataItem;
 
@@ -83,8 +83,8 @@
  */
 typedef struct psMetadata
-    {
-        psList* restrict list;
-        psHash* restrict table;
-    }
+{
+    psList* restrict list;
+    psHash* restrict table;
+}
 psMetadata;
 
