Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 6483)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 6484)
@@ -10,6 +10,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.117 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-02-17 03:24:46 $
+*  @version $Revision: 1.118 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -760,7 +760,11 @@
     for (psS32 g = 0; g < numCoords; g++) {
         xIn->data.F64[g] = ((psPlane *) source->data[g])->x;
+        xIn->n++;
         yIn->data.F64[g] = ((psPlane *) source->data[g])->y;
+        yIn->n++;
         xOut->data.F64[g] = ((psPlane *) dest->data[g])->x;
+        xOut->n++;
         yOut->data.F64[g] = ((psPlane *) dest->data[g])->y;
+        yOut->n++;
     }
 
Index: /trunk/psLib/src/db/psDB.c
===================================================================
--- /trunk/psLib/src/db/psDB.c	(revision 6483)
+++ /trunk/psLib/src/db/psDB.c	(revision 6484)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-02 04:48:47 $
+ *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -381,39 +381,51 @@
 
     column = psVectorAlloc(stringColumn->n, type);
+    //    column->n = column->nalloc;
 
     // conversion functions are a portability issue
     switch (type) {
     case PS_TYPE_S8:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.S8, stringColumn, atoi, psS8, PS_TYPE_S8);
         break;
     case PS_TYPE_S16:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.S16, stringColumn, atoi, psS16, PS_TYPE_S16);
         break;
     case PS_TYPE_S32:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.S32, stringColumn, atoi, psS32, PS_TYPE_S32);
         break;
     case PS_TYPE_S64:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.S64, stringColumn, atoll, psS64, PS_TYPE_S64);
         break;
     case PS_TYPE_U8:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.U8, stringColumn, atoi, psU8, PS_TYPE_U8);
         break;
     case PS_TYPE_U16:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.U16, stringColumn, atoi, psU16, PS_TYPE_U16);
         break;
     case PS_TYPE_U32:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.U32, stringColumn, atoi, psU32, PS_TYPE_U32);
         break;
     case PS_TYPE_U64:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.U64, stringColumn, atoll, psU64, PS_TYPE_U64);
         break;
     case PS_TYPE_F32:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.F32, stringColumn, atof, psF32, PS_TYPE_F32);
         break;
     case PS_TYPE_F64:
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.F64, stringColumn, atof, psF64, PS_TYPE_F64);
         break;
     case PS_TYPE_C32:
         // this is a bogus SQL type
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.C32, stringColumn, atof, psC32, PS_TYPE_C32);
         break;
@@ -424,5 +436,13 @@
     case PS_TYPE_BOOL:
         // valid for psVector?
+        column->n = column->nalloc;
         PS_STR_ARRAY_TO_PTYPE(column->data.U8, stringColumn, atoi, psU8, PS_TYPE_U8);
+        break;
+    default:
+        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
+                "Invalid type specified in psDBSelectColumnNum.\n");
+        psFree(stringColumn);
+        psFree(column);
+        return NULL;
         break;
     }
Index: /trunk/psLib/src/fits/psFitsTable.c
===================================================================
--- /trunk/psLib/src/fits/psFitsTable.c	(revision 6483)
+++ /trunk/psLib/src/fits/psFitsTable.c	(revision 6484)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-17 03:24:46 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -526,4 +526,5 @@
 
     psVector* result = psVectorAlloc(numRows, convertFitsToPsType(typecode));
+    result->n = numRows;
 
     fits_read_col(fits->fd,
Index: /trunk/psLib/src/imageops/psImageGeomManip.c
===================================================================
--- /trunk/psLib/src/imageops/psImageGeomManip.c	(revision 6483)
+++ /trunk/psLib/src/imageops/psImageGeomManip.c	(revision 6484)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-08 01:03:35 $
+ *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -93,4 +93,5 @@
         }
         maskVec = psVectorAlloc(scale * scale, PS_TYPE_MASK);
+        maskVec->n = maskVec->nalloc;
         maskData = maskVec->data.PS_TYPE_MASK_DATA;
     }
Index: /trunk/psLib/src/imageops/psImagePixelExtract.c
===================================================================
--- /trunk/psLib/src/imageops/psImagePixelExtract.c	(revision 6483)
+++ /trunk/psLib/src/imageops/psImagePixelExtract.c	(revision 6484)
@@ -8,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-02 04:41:42 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -326,4 +326,5 @@
         // psStats.
         out = psVectorRecycle(out, numCols, PS_TYPE_F64);
+        out->n = numCols;
         if (coords != NULL) {
             coords = psPixelsRealloc(coords, numCols);
@@ -342,4 +343,6 @@
             maskVec = psVectorAlloc(numRows, mask->type.type);
         }
+        imgVec->n = imgVec->nalloc;
+        maskVec->n = maskVec->nalloc;
         #define PSIMAGE_CUT_VERTICAL(TYPE) \
     case PS_TYPE_##TYPE: { \
@@ -408,12 +411,9 @@
         imgVec = psAlloc(sizeof(psVector));
         imgVec->type = input->type;
-
         P_PSVECTOR_SET_NALLOC(imgVec,numCols);
-        imgVec->n = numCols;
         if (mask != NULL) {
             maskVec = psAlloc(sizeof(psVector));
             maskVec->type = mask->type;
             P_PSVECTOR_SET_NALLOC(maskVec,numCols);
-            maskVec->n = numCols;
         }
         // recycle output to make a proper sized/type output structure
@@ -421,4 +421,7 @@
         // psStats.
         out = psVectorRecycle(out, numRows, PS_TYPE_F64);
+        out->n = numRows;
+        imgVec->n = imgVec->nalloc;
+        maskVec->n = maskVec->nalloc;
         if (coords != NULL) {
             coords = psPixelsRealloc(coords, numRows);
Index: /trunk/psLib/src/math/psConstants.h
===================================================================
--- /trunk/psLib/src/math/psConstants.h	(revision 6483)
+++ /trunk/psLib/src/math/psConstants.h	(revision 6484)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.85 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-17 00:56:48 $
+ *  @version $Revision: 1.86 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -312,5 +312,5 @@
 if (VEC->n != SIZE) { \
     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
-            "psVector %s has size %d, should be %d." \
+            "psVector %s has size %d, should be %d.", \
             #VEC, VEC->n, SIZE); \
     return(RVAL); \
Index: /trunk/psLib/src/math/psMinimizeLMM.c
===================================================================
--- /trunk/psLib/src/math/psMinimizeLMM.c	(revision 6483)
+++ /trunk/psLib/src/math/psMinimizeLMM.c	(revision 6484)
@@ -10,6 +10,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-07 23:14:21 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -239,4 +239,5 @@
     psF64 ymodel;
     psVector *deriv = psVectorAlloc(params->n, PS_TYPE_F32);
+    deriv->n = deriv->nalloc;
 
     // zero alpha and beta for summing below
@@ -370,4 +371,7 @@
     psVector *Beta   = psVectorAlloc(params->n, PS_TYPE_F64);
     psVector *Params = psVectorAlloc(params->n, PS_TYPE_F32);
+    beta->n = beta->nalloc;
+    Beta->n = Beta->nalloc;
+    Params->n = Params->nalloc;
     psVector *dy     = NULL;
     psF64 Chisq = 0.0;
@@ -385,4 +389,7 @@
         param_min = psVectorAlloc(params->n, PS_TYPE_F32);
         param_max = psVectorAlloc(params->n, PS_TYPE_F32);
+        beta_lim->n = beta_lim->nalloc;
+        param_min->n = param_min->nalloc;
+        param_max->n = param_max->nalloc;
         for (int i = 0; i < params->n; i++) {
             beta_lim->data.F32[i] = covar->data.F64[0][i];
@@ -402,4 +409,5 @@
     } else {
         dy = psVectorAlloc(y->n, PS_TYPE_F32);
+        dy->n = dy->nalloc;
         psVectorInit(dy, 1.0);
     }
Index: /trunk/psLib/src/math/psMinimizePolyFit.c
===================================================================
--- /trunk/psLib/src/math/psMinimizePolyFit.c	(revision 6483)
+++ /trunk/psLib/src/math/psMinimizePolyFit.c	(revision 6484)
@@ -10,6 +10,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-02 21:09:07 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -44,8 +44,10 @@
     for (psS32 i = 0 ; i < SIZE ; i++) { \
         VEC->data.F64[i] = ((2.0 / ((psF64) (SIZE - 1))) * ((psF64) i)) - 1.0; \
+        VEC->n++; \
     }\
 } else if (TYPE == PS_TYPE_F32){ \
     for (psS32 i = 0 ; i < SIZE ; i++) { \
         VEC->data.F32[i] = ((2.0 / ((psF32) (SIZE - 1))) * ((psF32) i)) - 1.0; \
+        VEC->n++; \
     }\
 }\
@@ -87,6 +89,8 @@
     if (sums == NULL) {
         sums = psVectorAlloc(nSum, PS_TYPE_F64);
+        sums->n = sums->nalloc;
     } else if (nSum > sums->n) {
         sums = psVectorRealloc(sums, nSum);
+        sums->n = sums->nalloc;
     }
 
@@ -305,5 +309,5 @@
     linear equations which can be easily solved.  The resulting vector is the
     coefficients of the Chebyshev polys.
-    
+ 
     This method is significantly slower than the standard NR algorithm.  It
     was explicitly requested that we not use the NR algorithm.
@@ -371,4 +375,5 @@
         }
         B->data.F64[i] = ordPoly->coeff[i];
+        B->n++;
     }
 
@@ -534,4 +539,5 @@
     // Compute the B vector
     psVector *B = psVectorAlloc(NUM_POLY, PS_TYPE_F64);
+    B->n = B->nalloc;
     for (psS32 i = 0 ; i < NUM_POLY ; i++) {
         B->data.F64[i] = 0.0;
@@ -780,4 +786,5 @@
     A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64);
     B = psVectorAlloc(nTerm, PS_TYPE_F64);
+    B->n = B->nalloc;
     // Initialize data structures.
     if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) {
@@ -1045,4 +1052,5 @@
     psVector *fit   = NULL;
     psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64);
+    resid->n = resid->nalloc;
 
     // eventual expansion: user supplies one of various stats option pairs,
@@ -1205,4 +1213,5 @@
     A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64);
     B = psVectorAlloc(nTerm, PS_TYPE_F64);
+    B->n = B->nalloc;
     // Initialize data structures.
     if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) {
@@ -1462,4 +1471,5 @@
     }
     psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64);
+    resid->n = resid->nalloc;
 
     // eventual expansion: user supplies one of various stats option pairs,
@@ -1630,4 +1640,5 @@
     A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64);
     B = psVectorAlloc(nTerm, PS_TYPE_F64);
+    B->n = B->nalloc;
     // Initialize data structures.
     if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) {
@@ -2002,4 +2013,5 @@
     psVector *fit   = NULL;
     psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64);
+    resid->n = resid->nalloc;
 
     // eventual expansion: user supplies one of various stats option pairs,
@@ -2174,4 +2186,5 @@
     A = psImageAlloc(nTerm, nTerm, PS_TYPE_F64);
     B = psVectorAlloc(nTerm, PS_TYPE_F64);
+    B->n = B->nalloc;
     // Initialize data structures.
     if (!psImageInit(A, 0.0) || !psVectorInit(B, 0.0)) {
@@ -2596,4 +2609,5 @@
     psVector *fit   = NULL;
     psVector *resid = psVectorAlloc(f->n, PS_TYPE_F64);
+    resid->n = resid->nalloc;
 
     // eventual expansion: user supplies one of various stats option pairs,
Index: /trunk/psLib/src/math/psMinimizePowell.c
===================================================================
--- /trunk/psLib/src/math/psMinimizePowell.c	(revision 6483)
+++ /trunk/psLib/src/math/psMinimizePowell.c	(revision 6484)
@@ -11,6 +11,6 @@
  *  NOTE: XXX: The SDR is silent about data types.  F32 is implemented here.
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-18 00:56:44 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -525,6 +525,7 @@
         p_psMemSetPersistent(myParamMask, true);
         p_psMemSetPersistent(myParamMask->data.U8, true);
-        for (i=0;i<myParamMask->n;i++) {
+        for (i=0;i<myParamMask->nalloc;i++) {
             myParamMask->data.U8[i] = 0;
+            myParamMask->n++;
         }
     } else {
@@ -543,4 +544,5 @@
                 ((psVector *) (v->data[i]))->data.F32[j] = 0.0;
             }
+            ((psVector *)(v->data[i]))->n++;
         }
         v->n++;
@@ -550,4 +552,5 @@
     for (i=0;i<numDims;i++) {
         Q->data.F32[i] = params->data.F32[i];
+        Q->n++;
     }
 
@@ -595,4 +598,5 @@
             if (myParamMask->data.U8[i] == 0) {
                 u->data.F32[i] = Q->data.F32[i] - params->data.F32[i];
+                u->n++;
 
                 psTrace(__func__, 6, "u[i]=Q[i]-P[i] (%f = %f - %f)\n", u->data.F32[i],
@@ -602,4 +606,5 @@
             } else {
                 u->data.F32[i] = 0.0;
+                u->n++;
             }
         }
Index: /trunk/psLib/src/math/psPolynomial.c
===================================================================
--- /trunk/psLib/src/math/psPolynomial.c	(revision 6483)
+++ /trunk/psLib/src/math/psPolynomial.c	(revision 6484)
@@ -7,6 +7,6 @@
 *  polynomials.  It also contains a Gaussian functions.
 *
-*  @version $Revision: 1.143 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-02-17 00:56:48 $
+*  @version $Revision: 1.144 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -589,4 +589,5 @@
     for (unsigned int i = 0; i < Npts; i++) {
         gauss->data.F32[i] = mean + p_psRandomGaussian(r, sigma);
+        gauss->n++;
     }
     psFree(r);
@@ -802,4 +803,5 @@
         for (unsigned int i=0;i<x->n;i++) {
             tmp->data.F64[i] = psPolynomial1DEval(poly, x->data.F64[i]);
+            tmp->n++;
         }
         break;
@@ -808,4 +810,5 @@
         for (unsigned int i=0;i<x->n;i++) {
             tmp->data.F32[i] = psPolynomial1DEval(poly, x->data.F32[i]);
+            tmp->n++;
         }
         break;
@@ -869,4 +872,5 @@
         for (unsigned int i=0; i<vecLen; i++) {
             tmp->data.F32[i] = psPolynomial2DEval(poly,x->data.F32[i],y->data.F32[i]);
+            tmp->n++;
         }
         break;
@@ -883,4 +887,5 @@
         for (unsigned int i=0; i<vecLen; i++) {
             tmp->data.F64[i] = psPolynomial2DEval(poly,x->data.F64[i],y->data.F64[i]);
+            tmp->n++;
         }
         break;
@@ -944,35 +949,59 @@
     // Evaluate polynomial
     // XXX: Consult with IfA: is this how they want to handle multiple data types?
-    if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F32[i], y->data.F32[i], z->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F32[i], y->data.F32[i], z->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F32[i], y->data.F64[i], z->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F32[i], y->data.F64[i], z->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F64[i], y->data.F32[i], z->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F64[i], y->data.F32[i], z->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F64[i], y->data.F64[i], z->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F64[i], y->data.F64[i], z->data.F64[i]);
+    if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32)
+            && (z->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F32[i],
+                                                  y->data.F32[i], z->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F32[i],
+                                                  y->data.F32[i], z->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F32[i],
+                                                  y->data.F64[i], z->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F32[i],
+                                                  y->data.F64[i], z->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F64[i],
+                                                  y->data.F32[i], z->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F64[i],
+                                                  y->data.F32[i], z->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F64[i],
+                                                  y->data.F64[i], z->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial3DEval(poly, x->data.F64[i],
+                                                  y->data.F64[i], z->data.F64[i]);
+            tmp->n++;
         }
     }
@@ -1040,68 +1069,116 @@
     // Evaluate polynomial
     // XXX: Consult with IfA: is this how they want to handle multiple data types?
-    if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i], y->data.F32[i], z->data.F32[i], t->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i], y->data.F32[i], z->data.F32[i], t->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i], y->data.F32[i], z->data.F64[i], t->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i], y->data.F32[i], z->data.F64[i], t->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i], y->data.F64[i], z->data.F32[i], t->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i], y->data.F64[i], z->data.F32[i], t->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i], y->data.F64[i], z->data.F64[i], t->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i], y->data.F64[i], z->data.F64[i], t->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i], y->data.F32[i], z->data.F32[i], t->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i], y->data.F32[i], z->data.F32[i], t->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i], y->data.F32[i], z->data.F64[i], t->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32) && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i], y->data.F32[i], z->data.F64[i], t->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i], y->data.F64[i], z->data.F32[i], t->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i], y->data.F64[i], z->data.F32[i], t->data.F64[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F32)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i], y->data.F64[i], z->data.F64[i], t->data.F32[i]);
-        }
-    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64) && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F64)) {
-        for (unsigned int i = 0; i < vecLen; i++) {
-            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i], y->data.F64[i], z->data.F64[i],
+    if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32)
+            && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i],
+                                                  y->data.F32[i], z->data.F32[i], t->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i],
+                                                  y->data.F32[i], z->data.F32[i], t->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i],
+                                                  y->data.F32[i], z->data.F64[i], t->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i],
+                                                  y->data.F32[i], z->data.F64[i], t->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i],
+                                                  y->data.F64[i], z->data.F32[i], t->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i],
+                                                  y->data.F64[i], z->data.F32[i], t->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i],
+                                                  y->data.F64[i], z->data.F64[i], t->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F32) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F32[i],
+                                                  y->data.F64[i], z->data.F64[i], t->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i],
+                                                  y->data.F32[i], z->data.F32[i], t->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i],
+                                                  y->data.F32[i], z->data.F32[i], t->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i],
+                                                  y->data.F32[i], z->data.F64[i], t->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F32)
+               && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i],
+                                                  y->data.F32[i], z->data.F64[i], t->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i],
+                                                  y->data.F64[i], z->data.F32[i], t->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F32) && (t->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i],
+                                                  y->data.F64[i], z->data.F32[i], t->data.F64[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F32)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i],
+                                                  y->data.F64[i], z->data.F64[i], t->data.F32[i]);
+            tmp->n++;
+        }
+    } else if ((x->type.type == PS_TYPE_F64) && (y->type.type == PS_TYPE_F64)
+               && (z->type.type == PS_TYPE_F64) && (t->type.type == PS_TYPE_F64)) {
+        for (unsigned int i = 0; i < vecLen; i++) {
+            tmp->data.F64[i] = psPolynomial4DEval(poly, x->data.F64[i],
+                                                  y->data.F64[i], z->data.F64[i],
                                                   t->data.F64[i]);
+            tmp->n++;
         }
     }
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 6483)
+++ /trunk/psLib/src/math/psSpline.c	(revision 6484)
@@ -1,11 +1,11 @@
 /** @file psSpline.c
 *
-*  @brief Contains basic spline allocation, deallocation, fitting, 
+*  @brief Contains basic spline allocation, deallocation, fitting,
 *         and evaluation routines.
 *
 *  This file contains the routines that allocate, free, and evaluate splines.
 *
-*  @version $Revision: 1.136 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-02-17 00:56:48 $
+*  @version $Revision: 1.137 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -239,8 +239,10 @@
             for (psS32 i = 0 ; i < x->n ; i++) {
                 spline->knots->data.F32[i] = x->data.F32[i];
+                spline->knots->n++;
             }
         } else if (x->type.type == PS_TYPE_F64) {
             for (psS32 i = 0 ; i < x->n ; i++) {
                 spline->knots->data.F32[i] = (psF32) x->data.F64[i];
+                spline->knots->n++;
             }
         }
@@ -248,4 +250,5 @@
         for (psS32 i = 0 ; i < y->n ; i++) {
             spline->knots->data.F32[i] = (psF32) i;
+            spline->knots->n++;
         }
     }
@@ -412,8 +415,10 @@
         for (psS32 i=0;i<x->n;i++) {
             tmpVector->data.F32[i] = psSpline1DEval(spline, x->data.F32[i]);
+            tmpVector->n++;
         }
     } else if (x->type.type == PS_TYPE_F64) {
         for (psS32 i=0;i<x->n;i++) {
             tmpVector->data.F32[i] = psSpline1DEval(spline, (psF32) x->data.F64[i]);
+            tmpVector->n++;
         }
     }
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 6483)
+++ /trunk/psLib/src/math/psStats.c	(revision 6484)
@@ -16,6 +16,6 @@
  * use ->min and ->max (PS_STAT_USE_RANGE)
  *
- *  @version $Revision: 1.169 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-18 00:56:44 $
+ *  @version $Revision: 1.170 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -569,4 +569,5 @@
     // Allocate temporary vectors for the data.
     unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
+    unsortedVector->n = nValues;
 
     // Determine if we must only use data points within a min/max range.
@@ -657,4 +658,5 @@
     psS32 numBins = histogram->nums->n;
     psVector *smooth = psVectorAlloc(numBins, PS_TYPE_F32);
+    smooth->n = smooth->nalloc;
     psS32 jMin = 0;
     psS32 jMax = 0;
@@ -783,4 +785,5 @@
     // Allocate temporary vectors for the data.
     unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
+    unsortedVector->n = unsortedVector->nalloc;
 
     if (stats->options & PS_STAT_USE_RANGE) {
@@ -1037,4 +1040,5 @@
     // However, we do no want to modify the original mask vector.
     tmpMask = psVectorAlloc(myVector->n, PS_TYPE_U8);
+    tmpMask->n = tmpMask->nalloc;
 
     // If we were called with a mask vector, then initialize the temporary
@@ -1198,4 +1202,6 @@
     psVector *x = psVectorAlloc(3, PS_TYPE_F64);
     psVector *y = psVectorAlloc(3, PS_TYPE_F64);
+    x->n = 3;
+    y->n = 3;
     psF32 tmpFloat = 0.0f;
 
@@ -1313,4 +1319,5 @@
     if (deriv == NULL) {
         deriv = psVectorAlloc(2, PS_TYPE_F32);
+        deriv->n = 2;
     } else {
         PS_ASSERT_VECTOR_SIZE(deriv, 2, NAN);
@@ -1365,4 +1372,5 @@
     psS32 rcBool = false;
     psVector *tmpMaskVec = psVectorAlloc(myVector->n, PS_TYPE_U8);
+    tmpMaskVec->n = tmpMaskVec->nalloc;
     if (maskVector != NULL) {
         for (psS32 i = 0 ; i < myVector->n ; i++) {
@@ -1850,4 +1858,5 @@
         psArray *x = psArrayAlloc((1 + (binMax - binMin)));
         psS32 j = 0;
+        y->n = y->nalloc;
 
         for (psS32 i = binMin ; i <= binMax ; i++) {
@@ -1856,4 +1865,5 @@
             x->n++;
             ((psVector *) x->data[j])->data.F32[0] = PS_BIN_MIDPOINT(newHistogram, i);
+            ((psVector *) x->data[j])->n++;
             j++;
         }
@@ -1886,4 +1896,5 @@
         psMinimization *min = psMinimizationAlloc(100, 0.01);
         psVector *params = psVectorAlloc(2, PS_TYPE_F32);
+        params->n = params->nalloc;
         // Initial guess for the mean ([0]) and standard dev.
         params->data.F32[0] = stats->robustMedian;
@@ -2049,6 +2060,7 @@
     // Allocate the bins, and initialize them to zero.
     newHist->nums = psVectorAlloc(n, PS_TYPE_F32);
-    for (i = 0; i < newHist->nums->n; i++) {
+    for (i = 0; i < newHist->nums->nalloc; i++) {
         newHist->nums->data.F32[i] = 0.0;
+        newHist->nums->n++;
     }
 
@@ -2094,6 +2106,7 @@
     // then there are N-1 bins.
     newHist->nums = psVectorAlloc((bounds->n) - 1, PS_TYPE_F32);
-    for (i = 0; i < newHist->nums->n; i++) {
+    for (i = 0; i < newHist->nums->nalloc; i++) {
         newHist->nums->data.F32[i] = 0.0;
+        newHist->nums->n++;
     }
 
@@ -2366,4 +2379,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32)in->data.S8[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_S16) {
@@ -2371,4 +2385,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32) in->data.S16[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_S32) {
@@ -2376,4 +2391,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32)in->data.S32[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_S64) {
@@ -2381,4 +2397,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32)in->data.S64[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_U8) {
@@ -2386,4 +2403,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32)in->data.U8[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_U16) {
@@ -2391,4 +2409,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32)in->data.U16[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_U32) {
@@ -2396,4 +2415,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32)in->data.U32[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_U64) {
@@ -2401,4 +2421,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32)in->data.U64[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_F64) {
@@ -2406,4 +2427,5 @@
         for (i = 0; i < in->n; i++) {
             tmp->data.F32[i] = (psF32)in->data.F64[i];
+            tmp->n++;
         }
     } else if (in->type.type == PS_TYPE_F32) {
@@ -2463,7 +2485,12 @@
     inF32 = p_psConvertToF32((psVector *) in);
     if (inF32 == NULL) {
-        inF32 = (psVector *) in;
-        mustFreeVectorIn = 0;
-    }
+        //        printf("\n\ninF32 is NULL\n\n");
+        //        inF32 = (psVector *) in;
+        //        mustFreeVectorIn = 0;
+        inF32 = psVectorCopy(inF32, in, PS_TYPE_F32);
+        inF32->n = inF32->nalloc;
+        mustFreeVectorIn = 1;
+    }
+    //    else printf("\ninF32 has n=%ld, nalloc=%ld\n", inF32->n, inF32->nalloc);
     errorsF32 = p_psConvertToF32((psVector *) errors);
     if (errorsF32 == NULL) {
@@ -2471,5 +2498,6 @@
         mustFreeVectorErrors = 0;
     }
-
+    //    inF32->n = inF32->nalloc;
+    //    errorsF32->n = errorsF32->nalloc;
     if ((stats->options & PS_STAT_USE_RANGE) && (stats->min >= stats->max)) {
         PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(stats->max, stats->min, stats);
Index: /trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.c	(revision 6483)
+++ /trunk/psLib/src/mathtypes/psVector.c	(revision 6484)
@@ -9,6 +9,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-01-28 01:12:14 $
+*  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -88,5 +88,6 @@
     psVec->type.type = type;
     P_PSVECTOR_SET_NALLOC(psVec,nalloc);
-    psVec->n = nalloc;
+    //    psVec->n = nalloc;
+    psVec->n = 0;
 
     // Create vector data array
@@ -205,4 +206,5 @@
 
     output = psVectorRecycle(output, nElements, type);
+    output->n = nElements;
 
     #define PSVECTOR_COPY(INTYPE,OUTTYPE) { \
@@ -754,4 +756,5 @@
     int nBin = (upper - lower) / delta; \
     psVector *vec = psVectorRecycle(input, nBin, PS_TYPE_##TYPE); \
+    vec->n = nBin; \
     for (int i = 0; i < nBin; i++) \
     { \
Index: /trunk/psLib/src/types/psArray.c
===================================================================
--- /trunk/psLib/src/types/psArray.c	(revision 6483)
+++ /trunk/psLib/src/types/psArray.c	(revision 6484)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-02-17 03:24:46 $
+ *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -64,8 +64,8 @@
 
     P_PSARRAY_SET_NALLOC(psArr,nalloc);
-    psArr->n = 0;
-    //    psArr->n = nalloc;
+    psArr->n = 0;  //set the initial number of elements in use to 0
     // Create vector data array
     psArr->data = psAlloc(nalloc * sizeof(psPtr));
+    memset(psArr->data, 0, sizeof(void*) * nalloc);  //set the initial values of data to NULL
 
     return psArr;
@@ -86,6 +86,10 @@
         }
         // Realloc after decrementation to avoid accessing freed array elements
+        long n = in->n;
         in->data = psRealloc(in->data, nalloc * sizeof(psPtr));
         P_PSARRAY_SET_NALLOC(in,nalloc);
+        for (long m = n; m < nalloc; m++) { //if array is grown, set grown data to NULL
+            in->data[m] = NULL;
+        }
     }
 
Index: /trunk/psLib/src/types/psLookupTable.c
===================================================================
--- /trunk/psLib/src/types/psLookupTable.c	(revision 6483)
+++ /trunk/psLib/src/types/psLookupTable.c	(revision 6484)
@@ -7,6 +7,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-02-17 03:24:46 $
+*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -600,4 +600,5 @@
     // Check if array is sorted on the index column
     psVector* sortedIndex = psVectorAlloc(numRows,PS_TYPE_U32);
+    sortedIndex->n = numRows;
     sortedIndex = psVectorSortIndex(sortedIndex,indexColumnVector);
     for(psS32 i = 0; i < numRows; i++ ) {
@@ -615,4 +616,5 @@
             psS32 type = ((psVector*)(vectors->data[j]))->type.type;
             newValueArray->data[j] = psVectorAlloc(numRows,type);
+            ((psVector*)(newValueArray->data[j]))->n = numRows;
             newValueArray->n++;
         }
Index: /trunk/psLib/src/types/psMetadataConfig.c
===================================================================
--- /trunk/psLib/src/types/psMetadataConfig.c	(revision 6483)
+++ /trunk/psLib/src/types/psMetadataConfig.c	(revision 6484)
@@ -10,6 +10,6 @@
 *  @author Eric Van Alst, MHPCC
 *
-*  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-01-25 22:33:41 $
+*  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -363,5 +363,5 @@
                         elemType);
             }
-
+            vec->n++;
             while(*end==' ' || *end==',') {
                 end++;
Index: /trunk/psLib/test/db/verified/tst_psDB.stderr
===================================================================
--- /trunk/psLib/test/db/verified/tst_psDB.stderr	(revision 6483)
+++ /trunk/psLib/test/db/verified/tst_psDB.stderr	(revision 6484)
@@ -146,4 +146,6 @@
 <DATE><TIME>|<HOST>|E|psVectorAlloc (FILE:LINENO)
     Input psVector is an unsupported type (0x0).
+<DATE><TIME>|<HOST>|E|psDBSelectColumnNum (FILE:LINENO)
+    Invalid type specified in psDBSelectColumnNum.
 
 ---> TESTPOINT PASSED (psDB{dbSelectColumnNum} | tst_psDB.c)
Index: /trunk/psLib/test/fits/tst_psFits.c
===================================================================
--- /trunk/psLib/test/fits/tst_psFits.c	(revision 6483)
+++ /trunk/psLib/test/fits/tst_psFits.c	(revision 6484)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-02-17 03:24:46 $
+*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -198,4 +198,5 @@
         for (int x=0; x < 4; x++) {
             vec->data.S32[x] = x*10+row;
+            vec->n++;
         }
         psMetadataAdd(header,PS_LIST_TAIL, "MYVEC",
Index: /trunk/psLib/test/imageops/tst_psImageConvolve.c
===================================================================
--- /trunk/psLib/test/imageops/tst_psImageConvolve.c	(revision 6483)
+++ /trunk/psLib/test/imageops/tst_psImageConvolve.c	(revision 6484)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-13 02:47:00 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-02-24 23:43:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -129,6 +129,9 @@
     for (psS32 i = 0; i < size; i++) {
         xVec->data.U32[i] = x[i];
+        xVec->n++;
         yVec->data.U32[i] = y[i];
+        yVec->n++;
         tVec->data.U32[i] = t[i];
+        tVec->n++;
     }
 
@@ -186,6 +189,9 @@
     for (psS32 i = 0; i < size; i++) {
         xVec->data.S16[i] = x[i];
+        xVec->n++;
         yVec->data.S16[i] = y[i];
+        yVec->n++;
         tVec->data.S16[i] = t[i];
+        tVec->n++;
     }
 
@@ -242,7 +248,11 @@
 
     for (psS32 i = 0; i < size; i++) {
-        xVec->data.F32[i] = x[i]+0.1;
+        //        xVec->data.F32[i] = x[i]+0.1;
+        //        xVec->n++;
+        psVectorSet(xVec, i, x[i]+0.1);
         yVec->data.F32[i] = y[i]+0.2;
+        yVec->n++;
         tVec->data.F32[i] = t[i]+0.3;
+        tVec->n++;
     }
 
Index: /trunk/psLib/test/imageops/tst_psImagePixelExtract.c
===================================================================
--- /trunk/psLib/test/imageops/tst_psImagePixelExtract.c	(revision 6483)
+++ /trunk/psLib/test/imageops/tst_psImagePixelExtract.c	(revision 6484)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-02-02 04:41:45 $
+*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -532,4 +532,5 @@
     for (psS32 i=0; i < 10; i++) {
         radii->data.F32[i] = 10+i*10;
+        radii->n++;
     }
 
Index: /trunk/psLib/test/imageops/verified/tst_psImagePixelExtract.stderr
===================================================================
--- /trunk/psLib/test/imageops/verified/tst_psImagePixelExtract.stderr	(revision 6483)
+++ /trunk/psLib/test/imageops/verified/tst_psImagePixelExtract.stderr	(revision 6484)
@@ -138,5 +138,5 @@
     Following should be an error.
 <DATE><TIME>|<HOST>|E|psImageRadialCut (FILE:LINENO)
-    Input radii vector size, 1, can not be less than 2.
+    Input radii vector size, 0, can not be less than 2.
 <DATE><TIME>|<HOST>|I|testImageRadialCut
     Following should be an error.
Index: /trunk/psLib/test/math/tst_psMinimizeLMM.c
===================================================================
--- /trunk/psLib/test/math/tst_psMinimizeLMM.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psMinimizeLMM.c	(revision 6484)
@@ -61,4 +61,7 @@
     myCoords->n = NUM_DATA_POINTS;
     psVector *y = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F32);
+    myParams->n = NUM_PARAMS;
+    myDerivs->n = NUM_PARAMS;
+    y->n = NUM_DATA_POINTS;
 
     for (psS32 i=0;i<NUM_DATA_POINTS;i++) {
@@ -66,4 +69,5 @@
         ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
         ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
+        ((psVector *) (myCoords->data[i]))->n = 2;
         psTrace(__func__, 5, "x[%d] is vector (%f, %f)\n", i, ((psVector *) (myCoords->data[i]))->data.F32[0],
                 ((psVector *) (myCoords->data[i]))->data.F32[1]);
Index: /trunk/psLib/test/math/tst_psMinimizePowell.c
===================================================================
--- /trunk/psLib/test/math/tst_psMinimizePowell.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psMinimizePowell.c	(revision 6484)
@@ -81,4 +81,6 @@
     myParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
     myParamMask = psVectorAlloc(NUM_PARAMS, PS_TYPE_U8);
+    myParams->n = NUM_PARAMS;
+    myParamMask->n = NUM_PARAMS;
     min = psMinimizationAlloc(100, 0.01);
 
@@ -164,4 +166,5 @@
         ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
         ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
+        ((psVector *) (myCoords->data[i]))->n = 2;
     }
     for (i=0;i<NUM_PARAMS;i++) {
@@ -169,4 +172,5 @@
         myParams->data.F32[i] = 0.0;
         myParams->data.F32[i] = (float) i;
+        myParams->n++;
     }
 
@@ -239,4 +243,5 @@
         ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
         ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
+        ((psVector *) (myCoords->data[i]))->n++;
     }
     for (i=0;i<NUM_PARAMS;i++) {
@@ -245,4 +250,6 @@
         myParams->data.F32[i] = (float) i;
         myParamMask->data.U8[i] = 0;
+        myParams->n++;
+        myParamMask->n++;
     }
 
Index: /trunk/psLib/test/math/tst_psPolyFit1D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolyFit1D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psPolyFit1D.c	(revision 6484)
@@ -99,4 +99,5 @@
         printf(" using a psF32 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_F32);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.F32[i] = (psF32) i;
@@ -111,4 +112,5 @@
         printf(" using a psS32 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_S32);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.S32[i] = (psS32) i;
@@ -123,4 +125,5 @@
         printf(" using a psF64 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_F64);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.F64[i] = (psF64) i;
@@ -139,4 +142,5 @@
         printf(" using a psF32 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_F32);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.F32[i] = setData((psF32) i);
@@ -159,4 +163,5 @@
         printf(" using a psS32 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_S32);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.S32[i] = (psS32) setData((psF32) i);
@@ -179,4 +184,5 @@
         printf(" using a psF64 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_F64);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.F64[i] = (psF64) setData((psF32) i);
@@ -203,4 +209,5 @@
         printf(" using a psF32 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_F32);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.F32[i] = YERR;
@@ -211,4 +218,5 @@
         printf(" using a psS32 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_S32);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.S32[i] = (psS32) YERR;
@@ -219,4 +227,5 @@
         printf(" using a psF64 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_F64);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.F64[i] = YERR;
@@ -231,4 +240,5 @@
         printf(" using a psU8 mask vector\n");
         mask = psVectorAlloc(numData, PS_TYPE_U8);
+        mask->n = numData;
         for (psS32 i=0;i<numData;i++) {
             mask->data.U8[i] = 0;
@@ -239,4 +249,5 @@
         printf(" using a psS32 mask vector\n");
         mask = psVectorAlloc(numData, PS_TYPE_S32);
+        mask->n = numData;
         for (psS32 i=0;i<numData;i++) {
             mask->data.S32[i] = 0;
Index: /trunk/psLib/test/math/tst_psPolyFit2D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolyFit2D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psPolyFit2D.c	(revision 6484)
@@ -100,4 +100,5 @@
         printf(" using a psF32 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_F32);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.F32[i] = (psF32) i;
@@ -108,4 +109,5 @@
         printf(" using a psS32 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_S32);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.S32[i] = (psS32) i;
@@ -116,4 +118,5 @@
         printf(" using a psF64 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_F64);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.F64[i] = (psF64) i;
@@ -129,4 +132,5 @@
         printf(" using a psF32 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_F32);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.F32[i] = (psF32) i;
@@ -137,4 +141,5 @@
         printf(" using a psS32 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_S32);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.S32[i] = (psS32) i;
@@ -145,4 +150,5 @@
         printf(" using a psF64 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_F64);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.F64[i] = (psF64) i;
@@ -157,4 +163,5 @@
         printf(" using a psF32 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_F32);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.F32[i] = setData((psF32) i, (psF32) i);
@@ -177,4 +184,5 @@
         printf(" using a psS32 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_S32);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.S32[i] = (psS32) setData((psF32) i, (psF32) i);
@@ -197,4 +205,5 @@
         printf(" using a psF64 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_F64);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.F64[i] = (psF64) setData((psF32) i, (psF32) i);
@@ -221,4 +230,5 @@
         printf(" using a psF32 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_F32);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.F32[i] = YERR;
@@ -237,4 +247,5 @@
         printf(" using a psF64 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_F64);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.F64[i] = YERR;
@@ -249,4 +260,5 @@
         printf(" using a psU8 mask vector\n");
         mask = psVectorAlloc(numData, PS_TYPE_U8);
+        mask->n = numData;
         for (psS32 i=0;i<numData;i++) {
             mask->data.U8[i] = 0;
@@ -257,4 +269,5 @@
         printf(" using a psS32 mask vector\n");
         mask = psVectorAlloc(numData, PS_TYPE_S32);
+        mask->n = numData;
         for (psS32 i=0;i<numData;i++) {
             mask->data.S32[i] = 0;
Index: /trunk/psLib/test/math/tst_psPolyFit3D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolyFit3D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psPolyFit3D.c	(revision 6484)
@@ -117,4 +117,5 @@
         printf(" using a psF32 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_F32);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.F32[i] = (psF32) i;
@@ -125,4 +126,5 @@
         printf(" using a psS32 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_S32);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.S32[i] = (psS32) i;
@@ -133,4 +135,5 @@
         printf(" using a psF64 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_F64);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.F64[i] = (psF64) i;
@@ -146,4 +149,5 @@
         printf(" using a psF32 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_F32);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.F32[i] = (psF32) i;
@@ -154,4 +158,5 @@
         printf(" using a psS32 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_S32);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.S32[i] = (psS32) i;
@@ -162,4 +167,5 @@
         printf(" using a psF64 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_F64);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.F64[i] = (psF64) i;
@@ -174,4 +180,5 @@
         printf(" using a psF32 z vector\n");
         z = psVectorAlloc(numData, PS_TYPE_F32);
+        z->n = numData;
         for (psS32 i=0;i<numData;i++) {
             z->data.F32[i] = (psF32) i;
@@ -182,4 +189,5 @@
         printf(" using a psS32 z vector\n");
         z = psVectorAlloc(numData, PS_TYPE_S32);
+        z->n = numData;
         for (psS32 i=0;i<numData;i++) {
             z->data.S32[i] = (psS32) i;
@@ -190,4 +198,5 @@
         printf(" using a psF64 z vector\n");
         z = psVectorAlloc(numData, PS_TYPE_F64);
+        z->n = numData;
         for (psS32 i=0;i<numData;i++) {
             z->data.F64[i] = (psF64) i;
@@ -203,4 +212,5 @@
         printf(" using a psF32 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_F32);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.F32[i] = setData((psF32) i, (psF32) i, (psF32) i);
@@ -223,4 +233,5 @@
         printf(" using a psS32 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_S32);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.S32[i] = (psS32) setData((psF32) i, (psF32) i, (psF32) i);
@@ -243,4 +254,5 @@
         printf(" using a psF64 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_F64);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.F64[i] = (psF64) setData((psF32) i, (psF32) i, (psF32) i);
@@ -267,4 +279,5 @@
         printf(" using a psF32 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_F32);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.F32[i] = YERR;
@@ -275,4 +288,5 @@
         printf(" using a psS32 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_S32);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.S32[i] = (psS32) YERR;
@@ -283,4 +297,5 @@
         printf(" using a psF64 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_F64);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.F64[i] = YERR;
@@ -295,4 +310,5 @@
         printf(" using a psU8 mask vector\n");
         mask = psVectorAlloc(numData, PS_TYPE_U8);
+        mask->n = numData;
         for (psS32 i=0;i<numData;i++) {
             mask->data.U8[i] = 0;
@@ -303,4 +319,5 @@
         printf(" using a psS32 mask vector\n");
         mask = psVectorAlloc(numData, PS_TYPE_S32);
+        mask->n = numData;
         for (psS32 i=0;i<numData;i++) {
             mask->data.S32[i] = 0;
Index: /trunk/psLib/test/math/tst_psPolyFit4D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolyFit4D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psPolyFit4D.c	(revision 6484)
@@ -130,4 +130,5 @@
         printf(" using a psF32 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_F32);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.F32[i] = (psF32) i;
@@ -138,4 +139,5 @@
         printf(" using a psS32 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_S32);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.S32[i] = (psS32) i;
@@ -146,4 +148,5 @@
         printf(" using a psF64 x vector\n");
         x = psVectorAlloc(numData, PS_TYPE_F64);
+        x->n = numData;
         for (psS32 i=0;i<numData;i++) {
             x->data.F64[i] = (psF64) i;
@@ -159,4 +162,5 @@
         printf(" using a psF32 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_F32);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.F32[i] = (psF32) i;
@@ -167,4 +171,5 @@
         printf(" using a psS32 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_S32);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.S32[i] = (psS32) i;
@@ -175,4 +180,5 @@
         printf(" using a psF64 y vector\n");
         y = psVectorAlloc(numData, PS_TYPE_F64);
+        y->n = numData;
         for (psS32 i=0;i<numData;i++) {
             y->data.F64[i] = (psF64) i;
@@ -187,4 +193,5 @@
         printf(" using a psF32 z vector\n");
         z = psVectorAlloc(numData, PS_TYPE_F32);
+        z->n = numData;
         for (psS32 i=0;i<numData;i++) {
             z->data.F32[i] = (psF32) i;
@@ -195,4 +202,5 @@
         printf(" using a psS32 z vector\n");
         z = psVectorAlloc(numData, PS_TYPE_S32);
+        z->n = numData;
         for (psS32 i=0;i<numData;i++) {
             z->data.S32[i] = (psS32) i;
@@ -203,4 +211,5 @@
         printf(" using a psF64 z vector\n");
         z = psVectorAlloc(numData, PS_TYPE_F64);
+        z->n = numData;
         for (psS32 i=0;i<numData;i++) {
             z->data.F64[i] = (psF64) i;
@@ -215,4 +224,5 @@
         printf(" using a psF32 t vector\n");
         t = psVectorAlloc(numData, PS_TYPE_F32);
+        t->n = numData;
         for (psS32 i=0;i<numData;i++) {
             t->data.F32[i] = (psF32) i;
@@ -223,4 +233,5 @@
         printf(" using a psS32 t vector\n");
         t = psVectorAlloc(numData, PS_TYPE_S32);
+        t->n = numData;
         for (psS32 i=0;i<numData;i++) {
             t->data.S32[i] = (psS32) i;
@@ -231,4 +242,5 @@
         printf(" using a psF64 t vector\n");
         t = psVectorAlloc(numData, PS_TYPE_F64);
+        t->n = numData;
         for (psS32 i=0;i<numData;i++) {
             t->data.F64[i] = (psF64) i;
@@ -244,4 +256,5 @@
         printf(" using a psF32 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_F32);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.F32[i] = setData((psF32) i, (psF32) i, (psF32) i, (psF32) i);
@@ -264,4 +277,5 @@
         printf(" using a psS32 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_S32);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.S32[i] = (psS32) setData((psF32) i, (psF32) i, (psF32) i, (psF32) i);
@@ -284,4 +298,5 @@
         printf(" using a psF64 f vector\n");
         f = psVectorAlloc(numData, PS_TYPE_F64);
+        f->n = numData;
         for (psS32 i=0;i<numData;i++) {
             f->data.F64[i] = (psF64) setData((psF32) i, (psF32) i, (psF32) i, (psF32) i);
@@ -308,4 +323,5 @@
         printf(" using a psF32 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_F32);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.F32[i] = YERR;
@@ -316,4 +332,5 @@
         printf(" using a psS32 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_S32);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.S32[i] = (psS32) YERR;
@@ -324,4 +341,5 @@
         printf(" using a psF64 fErr vector\n");
         fErr = psVectorAlloc(numData, PS_TYPE_F64);
+        fErr->n = numData;
         for (psS32 i=0;i<numData;i++) {
             fErr->data.F64[i] = YERR;
@@ -336,4 +354,5 @@
         printf(" using a psU8 mask vector\n");
         mask = psVectorAlloc(numData, PS_TYPE_U8);
+        mask->n = numData;
         for (psS32 i=0;i<numData;i++) {
             mask->data.U8[i] = 0;
@@ -344,4 +363,5 @@
         printf(" using a psS32 mask vector\n");
         mask = psVectorAlloc(numData, PS_TYPE_S32);
+        mask->n = numData;
         for (psS32 i=0;i<numData;i++) {
             mask->data.S32[i] = 0;
Index: /trunk/psLib/test/math/tst_psPolynomialEval1D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolynomialEval1D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psPolynomialEval1D.c	(revision 6484)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.1 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-02-02 21:05:51 $
+*  @version  $Revision: 1.2 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2006-02-24 23:43:15 $
 *
 *  XXX: Probably should test single- and multi-dimensional polynomials in
@@ -11,5 +11,5 @@
 *
 *  XXX: define ORDERS, not TERMS
-* 
+*
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -124,4 +124,6 @@
         inputOrd->data.F64[i] = poly1DXValue[i];
         inputCheb->data.F64[i] = poly1DXChebValue[i];
+        inputOrd->n++;
+        inputCheb->n++;
     }
 
Index: /trunk/psLib/test/math/tst_psPolynomialEval2D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolynomialEval2D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psPolynomialEval2D.c	(revision 6484)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.1 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-02-02 21:05:51 $
+*  @version  $Revision: 1.2 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2006-02-24 23:43:15 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -157,4 +157,8 @@
         inputChebX->data.F64[i] = poly2DXYChebValue[i][0];
         inputChebY->data.F64[i] = poly2DXYChebValue[i][1];
+        inputOrdX->n++;
+        inputOrdY->n++;
+        inputChebX->n++;
+        inputChebY->n++;
     }
 
Index: /trunk/psLib/test/math/tst_psPolynomialEval3D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolynomialEval3D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psPolynomialEval3D.c	(revision 6484)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.1 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-02-02 21:05:51 $
+*  @version  $Revision: 1.2 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2006-02-24 23:43:15 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -220,4 +220,10 @@
         inputChebY->data.F64[i] = Dpoly3DXYZChebValue[i][1];
         inputChebZ->data.F64[i] = Dpoly3DXYZChebValue[i][2];
+        inputOrdX->n++;
+        inputOrdY->n++;
+        inputOrdZ->n++;
+        inputChebX->n++;
+        inputChebY->n++;
+        inputChebZ->n++;
     }
 
Index: /trunk/psLib/test/math/tst_psPolynomialEval4D.c
===================================================================
--- /trunk/psLib/test/math/tst_psPolynomialEval4D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psPolynomialEval4D.c	(revision 6484)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.1 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-02-02 21:05:51 $
+*  @version  $Revision: 1.2 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2006-02-24 23:43:15 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -470,4 +470,12 @@
         inputChebY->data.F64[i] = Dpoly4DWXYZChebValue[i][2];
         inputChebZ->data.F64[i] = Dpoly4DWXYZChebValue[i][3];
+        inputOrdW->n++;
+        inputOrdX->n++;
+        inputOrdY->n++;
+        inputOrdZ->n++;
+        inputChebW->n++;
+        inputChebX->n++;
+        inputChebY->n++;
+        inputChebZ->n++;
     }
 
Index: /trunk/psLib/test/math/tst_psRandom.c
===================================================================
--- /trunk/psLib/test/math/tst_psRandom.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psRandom.c	(revision 6484)
@@ -122,4 +122,5 @@
     psRandom *myRNG = NULL;
     psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans->n = rans->nalloc;
     psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
 
@@ -167,4 +168,5 @@
     psRandom *myRNG = NULL;
     psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans->n = rans->nalloc;
     psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
 
@@ -214,4 +216,5 @@
     psRandom *myRNG = NULL;
     psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans->n = rans->nalloc;
     psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
 
@@ -259,6 +262,9 @@
     psRandom *myRNG = NULL;
     psVector *rans00 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans00->n = rans00->nalloc;
     psVector *rans01 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans01->n = rans01->nalloc;
     psVector *rans02 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans02->n = rans02->nalloc;
 
     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
@@ -314,6 +320,9 @@
     psRandom *myRNG = NULL;
     psVector *rans00 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans00->n = rans00->nalloc;
     psVector *rans01 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans01->n = rans01->nalloc;
     psVector *rans02 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans02->n = rans02->nalloc;
 
     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
@@ -357,6 +366,9 @@
     psRandom *myRNG = NULL;
     psVector *rans00 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans00->n = rans00->nalloc;
     psVector *rans01 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans01->n = rans01->nalloc;
     psVector *rans02 = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
+    rans02->n = rans02->nalloc;
 
     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
Index: /trunk/psLib/test/math/tst_psSpline1D.c
===================================================================
--- /trunk/psLib/test/math/tst_psSpline1D.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psSpline1D.c	(revision 6484)
@@ -13,6 +13,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-01-27 20:08:58 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-02-24 23:43:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -28,7 +28,7 @@
 // {testFunction, testpointNumber, description, expected rc, boolean-ignore this test}
 testDescription tests[] = {
-                              {psSplineAllocTest,      0000, "(TEST A) psSplineAllocTest",      true, false},
-                              {psSplineEvalTest,       0000, "(TEST B) psSplineEvalTest",       true, false},
-                              {psSplineEvalVectorTest, 0000, "(TEST C) psSplineEvalVectorTest", true, false},
+                              {psSplineAllocTest, 665, "(TEST A) psSplineAllocTest",true, false},
+                              {psSplineEvalTest, 666, "(TEST B) psSplineEvalTest",true, false},
+                              {psSplineEvalVectorTest,667,"(TEST C) psSplineEvalVectorTest",true,false},
                               {NULL}
                           };
@@ -199,4 +199,8 @@
     yF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
     yF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
+    xF32->n = NumSplines+1;
+    xF64->n = NumSplines+1;
+    yF32->n = NumSplines+1;
+    yF64->n = NumSplines+1;
 
     for (psS32 i=0;i<NumSplines+1;i++) {
@@ -274,4 +278,8 @@
     yF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
     yF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
+    xF32->n = NumSplines+1;
+    xF64->n = NumSplines+1;
+    yF32->n = NumSplines+1;
+    yF64->n = NumSplines+1;
 
     for (psS32 i=0;i<NumSplines+1;i++) {
@@ -384,4 +392,8 @@
     yF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
     yF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
+    xF32->n = NumSplines+1;
+    xF64->n = NumSplines+1;
+    yF32->n = NumSplines+1;
+    yF64->n = NumSplines+1;
 
     for (psS32 i=0;i<NumSplines+1;i++) {
@@ -459,4 +471,8 @@
     yF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
     yF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
+    xF32->n = NumSplines+1;
+    xF64->n = NumSplines+1;
+    yF32->n = NumSplines+1;
+    yF64->n = NumSplines+1;
 
     for (psS32 i=0;i<NumSplines+1;i++) {
@@ -559,4 +575,8 @@
     yF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
     yF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
+    xF32->n = NumSplines+1;
+    xF64->n = NumSplines+1;
+    yF32->n = NumSplines+1;
+    yF64->n = NumSplines+1;
 
     for (psS32 i=0;i<NumSplines+1;i++) {
@@ -634,4 +654,8 @@
     yF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
     yF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
+    xF32->n = NumSplines+1;
+    xF64->n = NumSplines+1;
+    yF32->n = NumSplines+1;
+    yF64->n = NumSplines+1;
 
     for (psS32 i=0;i<NumSplines+1;i++) {
@@ -757,4 +781,9 @@
     psVector *yF32Test = NULL;
     psVector *xF64Test = psVectorAlloc(NumSplines, PS_TYPE_F64);
+    xF32->n = NumSplines+1;
+    yF32->n = NumSplines+1;
+    xF32Test->n = NumSplines;
+    xF64Test->n = NumSplines;
+
 
     for (psS32 i=0;i<NumSplines+1;i++) {
Index: /trunk/psLib/test/math/tst_psStats07.c
===================================================================
--- /trunk/psLib/test/math/tst_psStats07.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psStats07.c	(revision 6484)
@@ -72,4 +72,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.F32[i] = gaussVector->data.F32[i];
+            in->n++;
         }
 
@@ -86,4 +87,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.F64[i] = (psF64) gaussVector->data.F32[i];
+            in->n++;
         }
 
@@ -100,4 +102,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.S8[i] = (psS8) gaussVector->data.F32[i];
+            in->n++;
         }
 
@@ -114,4 +117,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.U16[i] = (psU16) gaussVector->data.F32[i];
+            in->n++;
         }
 
@@ -128,4 +132,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.S32[i] = (psS32) gaussVector->data.F32[i];
+            in->n++;
         }
 
@@ -138,4 +143,5 @@
     psFree(gaussVector);
 
+    //    in->n = in->nalloc;
     if (flags & TST_ERRORS_NULL) {
         printf("        using a NULL errors vector\n");
@@ -147,4 +153,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.F32[i] = ERRORS;
+            errors->n++;
         }
 
@@ -161,4 +168,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.F64[i] = ERRORS;
+            errors->n++;
         }
 
@@ -175,4 +183,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.S8[i] = (psS8) ERRORS;
+            errors->n++;
         }
 
@@ -189,4 +198,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.U16[i] = (psU16) ERRORS;
+            errors->n++;
         }
 
@@ -203,4 +213,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.S32[i] = (psS32) ERRORS;
+            errors->n++;
         }
 
@@ -222,4 +233,5 @@
         for (psS32 i=0;i<numData;i++) {
             mask->data.U8[i] = (psU8) 0;
+            mask->n++;
         }
 
@@ -236,4 +248,5 @@
         for (psS32 i=0;i<numData;i++) {
             mask->data.S32[i] = (psS32) 0;
+            mask->n++;
         }
 
Index: /trunk/psLib/test/math/tst_psStats09.c
===================================================================
--- /trunk/psLib/test/math/tst_psStats09.c	(revision 6483)
+++ /trunk/psLib/test/math/tst_psStats09.c	(revision 6484)
@@ -68,4 +68,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.F32[i] = (psF32) i;
+            in->n++;
         }
 
@@ -82,4 +83,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.F64[i] = (psF64) i;
+            in->n++;
         }
 
@@ -96,4 +98,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.S8[i] = (psS8) i;
+            in->n++;
         }
 
@@ -110,4 +113,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.U16[i] = (psU16) i;
+            in->n++;
         }
 
@@ -124,4 +128,5 @@
         for (psS32 i=0;i<numData;i++) {
             in->data.S32[i] = (psS32) i;
+            in->n++;
         }
 
@@ -142,4 +147,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.F32[i] = ERRORS;
+            errors->n++;
         }
 
@@ -156,4 +162,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.F64[i] = ERRORS;
+            errors->n++;
         }
 
@@ -170,4 +177,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.S8[i] = (psS8) ERRORS;
+            errors->n++;
         }
 
@@ -184,4 +192,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.U16[i] = (psU16) ERRORS;
+            errors->n++;
         }
 
@@ -198,4 +207,5 @@
         for (psS32 i=0;i<numData;i++) {
             errors->data.S32[i] = (psS32) ERRORS;
+            errors->n++;
         }
 
@@ -217,4 +227,5 @@
         for (psS32 i=0;i<numData;i++) {
             mask->data.U8[i] = (psU8) 0;
+            mask->n++;
         }
 
@@ -231,4 +242,5 @@
         for (psS32 i=0;i<numData;i++) {
             mask->data.S32[i] = (psS32) 0;
+            mask->n++;
         }
 
Index: /trunk/psLib/test/mathtypes/tst_psVector.c
===================================================================
--- /trunk/psLib/test/mathtypes/tst_psVector.c	(revision 6483)
+++ /trunk/psLib/test/mathtypes/tst_psVector.c	(revision 6484)
@@ -14,6 +14,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2006-02-08 00:00:36 $
+ *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-02-24 23:43:16 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -70,5 +70,5 @@
         return 1;
     }
-    if (psVec->n != psVec->nalloc) {
+    if (psVec->n != 0) {
         fprintf(stderr,"Vector population = %ld\n", psVec->n);
         return 2;
@@ -126,4 +126,5 @@
     for(psS32 i = 0; i < 5; i++) {
         psVec->data.S32[i] = i*10;
+        psVec->n++;
     }
 
@@ -202,4 +203,5 @@
     }
 
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     psVector* vecBogus = psVectorRealloc(NULL, 6);
     if (vecBogus != NULL) {
@@ -319,5 +321,7 @@
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U8 Case \n");
     }
-    if ( !psVectorInit(in2, PS_MAX_U64) ) {
+
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
+    if ( psVectorInit(in2, PS_MAX_U64) ) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U16 Case \n");
     }
@@ -328,5 +332,7 @@
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U64 Case \n");
     }
-    if ( !psVectorInit(in5, PS_MAX_S16 ) ) {
+
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
+    if ( psVectorInit(in5, PS_MAX_S16 ) ) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  S8 Case \n");
     }
@@ -463,16 +469,22 @@
     vec->n = 0;
 
-    if ( !psVectorSet(vec, 0, 10) )
+    if ( !psVectorSet(vec, 0, 10) ) {
         fprintf(stderr, "VectorSet failed to set S32 at position 0\n");
-    if ( psVectorSet(vec, 10, 10) )
+    }
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
+    if ( psVectorSet(vec, 10, 10) ) {
         fprintf(stderr, "VectorSet Improperly set S32 at out of range position\n");
-    if ( !psVectorSet(vec, 1, 4) )
+    }
+    if ( !psVectorSet(vec, 1, 4) ) {
         fprintf(stderr, "VectorSet Failed to set S32 at position 1\n");
-    if ( (psS32)psVectorGet(vec, 0) != 10 )
+    }
+    if ( (psS32)psVectorGet(vec, 0) != 10 ) {
         fprintf(stderr,
                 "VectorGet Failed to return the correct S32 from position 0\n");
-    if ( (psS32)psVectorGet(vec, -1) != 4 )
+    }
+    if ( (psS32)psVectorGet(vec, -1) != 4 ) {
         fprintf(stderr,
                 "VectorGet Failed to return the correct S32 from tail using -1\n");
+    }
 
     psFree(vec);
@@ -485,6 +497,7 @@
     long numPix2 = 0;
     psVector *vec = NULL;
+
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     numPix = psVectorCountPixelMask(vec, 1);
-
     if (numPix != -1) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, false,
@@ -507,4 +520,8 @@
     vec2->data.U8[3] = 1;
     vec2->data.U8[4] = 0;
+    vec->n = 5;
+    vec2->n = 5;
+
+    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     numPix = psVectorCountPixelMask(vec, 1);
     numPix2 = psVectorCountPixelMask(vec2, 1);
Index: /trunk/psLib/test/mathtypes/tst_psVectorSort_02.c
===================================================================
--- /trunk/psLib/test/mathtypes/tst_psVectorSort_02.c	(revision 6483)
+++ /trunk/psLib/test/mathtypes/tst_psVectorSort_02.c	(revision 6484)
@@ -14,6 +14,6 @@
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-07-13 02:47:00 $
+ *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-02-24 23:43:16 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -98,6 +98,8 @@
     for(psS32 m=0; m<5; m++) {
         in->data.U8[m]= 20-m;
+        in->n++;
     }
     out = psVectorAlloc(3,PS_TYPE_U32);
+    out->n = 3;
     out = psVectorSortIndex(out,in);
     if(out->n != 5) {
@@ -151,4 +153,6 @@
     in = psVectorAlloc(5,PS_TYPE_U8);
     out = psVectorAlloc(5,PS_TYPE_U32);
+    in->n = 5;
+    out->n = 5;
     tempVect = out;
     in->type.type = PS_TYPE_BOOL;
Index: /trunk/psLib/test/mathtypes/verified/tst_psVector.stderr
===================================================================
--- /trunk/psLib/test/mathtypes/verified/tst_psVector.stderr	(revision 6483)
+++ /trunk/psLib/test/mathtypes/verified/tst_psVector.stderr	(revision 6484)
@@ -18,4 +18,6 @@
 \**********************************************************************************/
 
+<HOST>|I|testVectorRealloc
+    Following should generate error message
 <HOST>|E|psVectorRealloc (FILE:LINENO)
     psVectorRealloc must a given a non-NULL psVector to resize.  Desired datatype unknown.
@@ -38,12 +40,12 @@
 \**********************************************************************************/
 
+<HOST>|I|testVectorInit
+    Following should generate error message
 <HOST>|E|psVectorInit (FILE:LINENO)
     Error:  U16 Value out of Range.
-<HOST>|E|testVectorInit (FILE:LINENO)
-    VectorInit failed.  U16 Case 
+<HOST>|I|testVectorInit
+    Following should generate error message
 <HOST>|E|psVectorInit (FILE:LINENO)
     Error:  S8 Value out of Range.
-<HOST>|E|testVectorInit (FILE:LINENO)
-    VectorInit failed.  S8 Case 
 
 ---> TESTPOINT PASSED (psVector{psVectorInit} | tst_psVector.c)
@@ -82,4 +84,6 @@
 \**********************************************************************************/
 
+<HOST>|I|testVectorGetSet
+    Following should generate error message
 <HOST>|E|psVectorSet (FILE:LINENO)
     Invalid position.  Number too large
@@ -93,6 +97,10 @@
 \**********************************************************************************/
 
+<HOST>|I|testVectorCountPixelMask
+    Following should generate error message
 <HOST>|E|psVectorCountPixelMask (FILE:LINENO)
     The input psVector can not be NULL.
+<HOST>|I|testVectorCountPixelMask
+    Following should generate error message
 <HOST>|E|psVectorCountPixelMask (FILE:LINENO)
     psVector type does not match the specified psMaskType!
Index: /trunk/psLib/test/types/tst_psLookupTable_01.c
===================================================================
--- /trunk/psLib/test/types/tst_psLookupTable_01.c	(revision 6483)
+++ /trunk/psLib/test/types/tst_psLookupTable_01.c	(revision 6484)
@@ -12,6 +12,6 @@
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-01-26 21:10:22 $
+*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2006-02-24 23:43:16 $
 *
 *  Copyright 2004-5 Maui High Performance Computing Center, University of Hawaii
@@ -191,5 +191,5 @@
                               {testLookupTableAlloc,817,"psLookupTableAlloc",0,false},
                               {testVectorsReadFromFile,999,"psVectorsReadFromFile",0,false},
-                              {testLookupTableImport,999,"psLookupTableImport",0,false},
+                              {testLookupTableImport,666,"psLookupTableImport",0,false},
                               {testLookupTableRead,998,"psLookupTableRead",0,false},
                               {testLookupTableInterpolate,997,"psLookupTableInterpolate",0,false},
Index: /trunk/psLib/test/types/tst_psMetadataIO.c
===================================================================
--- /trunk/psLib/test/types/tst_psMetadataIO.c	(revision 6483)
+++ /trunk/psLib/test/types/tst_psMetadataIO.c	(revision 6484)
@@ -13,6 +13,6 @@
  *  @author  Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-09-26 21:13:33 $
+ *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-02-24 23:43:16 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -32,10 +32,10 @@
 
 testDescription tests[] = {
-                              {testMetadataParseConfig,000,"psMetadataConfigParse",0,false},
-                              {testMetadataParseConfig1,000,"psMetadataConfigParse",0,false},
-                              {testMetadataParseConfig2,000,"psMetadataConfigParse",0,false},
-                              {testMetadataParseConfig3,000,"psMetadataConfigParse",0,false},
-                              {testMetadataParseConfig4,000,"psMetadataConfigParse",0,false},
-                              {testMetadataPrint,000,"psMetadataPrint",0,false},
+                              {testMetadataParseConfig,0,"psMetadataConfigParse",0,false},
+                              {testMetadataParseConfig1,1,"psMetadataConfigParse1",0,false},
+                              {testMetadataParseConfig2,2,"psMetadataConfigParse2",0,false},
+                              {testMetadataParseConfig3,3,"psMetadataConfigParse3",0,false},
+                              {testMetadataParseConfig4,4,"psMetadataConfigParse4",0,false},
+                              {testMetadataPrint,666,"psMetadataPrint",0,false},
                               {NULL}
                           };
Index: /trunk/psLib/test/types/verified/tst_psMetadataIO.stderr
===================================================================
--- /trunk/psLib/test/types/verified/tst_psMetadataIO.stderr	(revision 6483)
+++ /trunk/psLib/test/types/verified/tst_psMetadataIO.stderr	(revision 6484)
@@ -10,5 +10,5 @@
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psMetadataIO.c                                         *
-*            TestPoint: psMetadataConfigParse{psMetadataConfigParse}               *
+*            TestPoint: psMetadataConfigParse{psMetadataConfigParse1}              *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
@@ -65,9 +65,9 @@
     Unallowable operation: filename is NULL.
 
----> TESTPOINT PASSED (psMetadataConfigParse{psMetadataConfigParse} | tst_psMetadataIO.c)
+---> TESTPOINT PASSED (psMetadataConfigParse{psMetadataConfigParse1} | tst_psMetadataIO.c)
 
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psMetadataIO.c                                         *
-*            TestPoint: psMetadataConfigParse{psMetadataConfigParse}               *
+*            TestPoint: psMetadataConfigParse{psMetadataConfigParse2}              *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
@@ -80,18 +80,18 @@
     Failed to add metadata item to metadata collection list.
 
----> TESTPOINT PASSED (psMetadataConfigParse{psMetadataConfigParse} | tst_psMetadataIO.c)
+---> TESTPOINT PASSED (psMetadataConfigParse{psMetadataConfigParse2} | tst_psMetadataIO.c)
 
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psMetadataIO.c                                         *
-*            TestPoint: psMetadataConfigParse{psMetadataConfigParse}               *
+*            TestPoint: psMetadataConfigParse{psMetadataConfigParse3}              *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
 
 
----> TESTPOINT PASSED (psMetadataConfigParse{psMetadataConfigParse} | tst_psMetadataIO.c)
+---> TESTPOINT PASSED (psMetadataConfigParse{psMetadataConfigParse3} | tst_psMetadataIO.c)
 
 /***************************** TESTPOINT ******************************************\
 *             TestFile: tst_psMetadataIO.c                                         *
-*            TestPoint: psMetadataConfigParse{psMetadataConfigParse}               *
+*            TestPoint: psMetadataConfigParse{psMetadataConfigParse4}              *
 *             TestType: Positive                                                   *
 \**********************************************************************************/
@@ -112,5 +112,5 @@
     Metadata type 'CELL6', found on line 31 of test5.config, is invalid.
 
----> TESTPOINT PASSED (psMetadataConfigParse{psMetadataConfigParse} | tst_psMetadataIO.c)
+---> TESTPOINT PASSED (psMetadataConfigParse{psMetadataConfigParse4} | tst_psMetadataIO.c)
 
 /***************************** TESTPOINT ******************************************\
