Index: trunk/psLib/test/astro/tap_psCoord.c
===================================================================
--- trunk/psLib/test/astro/tap_psCoord.c	(revision 42336)
+++ trunk/psLib/test/astro/tap_psCoord.c	(revision 42822)
@@ -48,5 +48,5 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *myPT = psPlaneTransformAlloc(ORDER_X, ORDER_Y);
+        psPlaneTransform *myPT = psPlaneTransformAlloc(ORDER_X, ORDER_Y, PS_POLYNOMIAL_ORD);
         ok(myPT != NULL, "psPlaneTransformAlloc() returned non-NULL");
         skip_start(myPT == NULL, 4, "Skipping tests because psPlaneTransformAlloc() returned NULL");
@@ -59,9 +59,9 @@
         // Attempt to specify negative x order and verify NULL returned and
         // errror message generated
-        myPT = psPlaneTransformAlloc(-1, 1);
+        myPT = psPlaneTransformAlloc(-1, 1, PS_POLYNOMIAL_ORD);
         ok(myPT == NULL, "psPlaneTransformAlloc(-1, 1) returned NULL");
         psFree(myPT);
 
-        myPT = psPlaneTransformAlloc(1, -1);
+        myPT = psPlaneTransformAlloc(1, -1, PS_POLYNOMIAL_ORD);
         ok(myPT == NULL, "psPlaneTransformAlloc(1, -1) returned NULL");
         psFree(myPT);
@@ -110,5 +110,5 @@
         ok(in != NULL, "psPlaneAlloc() returned non-NULL");
         skip_start(in == NULL, 2, "Skipping tests because psPlaneAlloc() returned NULL");
-        psPlaneTransform* pt = psPlaneTransformAlloc(2,2);
+        psPlaneTransform* pt = psPlaneTransformAlloc(2, 2, PS_POLYNOMIAL_ORD);
         ok(pt != NULL, "psPlaneTransformAlloc() returned non-NULL");
         skip_start(pt == NULL, 1, "Skipping tests because psPlaneTransformAlloc() returned NULL");
@@ -169,5 +169,5 @@
         psMemId id = psMemGetId();
         psPlane *in = psPlaneAlloc();
-        psPlaneTransform *pt = psPlaneTransformAlloc(2,2);
+        psPlaneTransform *pt = psPlaneTransformAlloc(2, 2, PS_POLYNOMIAL_ORD);
         psFree(pt->x);
         pt->x = NULL;
@@ -184,5 +184,5 @@
         psMemId id = psMemGetId();
         psPlane* in = psPlaneAlloc();
-        psPlaneTransform* pt = psPlaneTransformAlloc(2,2);
+        psPlaneTransform* pt = psPlaneTransformAlloc(2,2, PS_POLYNOMIAL_ORD);
         psFree(pt->y);
         pt->y = NULL;
@@ -198,5 +198,5 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform* pt = psPlaneTransformAlloc(2,2);
+        psPlaneTransform* pt = psPlaneTransformAlloc(2,2, PS_POLYNOMIAL_ORD);
         psPlane *tmpPL = psPlaneTransformApply(NULL, pt, NULL);
         ok(tmpPL == NULL, "psPlaneTransformApply(NULL, pt, NULL) did not return NULL");
@@ -314,5 +314,5 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *trans = psPlaneTransformAlloc(1, 3);
+        psPlaneTransform *trans = psPlaneTransformAlloc(1, 3, PS_POLYNOMIAL_ORD);
         psPixels *output = psPixelsTransform(NULL, NULL, trans);
         ok(output == NULL, "psPixelsTransform(NULL, NULL, trans) returned NULL");
@@ -342,5 +342,5 @@
         input->data[1].x = 1.0;
         input->data[1].y = 6.0;
-        psPlaneTransform *trans = psPlaneTransformAlloc(1, 3);
+        psPlaneTransform *trans = psPlaneTransformAlloc(1, 3, PS_POLYNOMIAL_ORD);
         trans->x->coeff[0][0] = 0;
         trans->x->coeff[1][0] = 1.0;
Index: trunk/psLib/test/astro/tap_psCoord02.c
===================================================================
--- trunk/psLib/test/astro/tap_psCoord02.c	(revision 42336)
+++ trunk/psLib/test/astro/tap_psCoord02.c	(revision 42822)
@@ -189,6 +189,6 @@
                                     for (psS32 t2yy = 0 ; t2yy < TST04_T2_Y_Y ; t2yy++) {
                                         //printf("(%d %d %d %d %d %d %d %d)\n", t1xx, t1xy, t1yx, t1yy, t2xx, t2xy, t2yx, t2yy);
-                                        psPlaneTransform *trans1 = psPlaneTransformAlloc(PS_MAX(t1xx, t1yx), PS_MAX(t1xy, t1yy));
-                                        psPlaneTransform *trans2 = psPlaneTransformAlloc(PS_MAX(t2xx, t2yx), PS_MAX(t2xy, t2yy));
+                                        psPlaneTransform *trans1 = psPlaneTransformAlloc(PS_MAX(t1xx, t1yx), PS_MAX(t1xy, t1yy), PS_POLYNOMIAL_ORD);
+                                        psPlaneTransform *trans2 = psPlaneTransformAlloc(PS_MAX(t2xx, t2yx), PS_MAX(t2xy, t2yy), PS_POLYNOMIAL_ORD);
                                         psPlaneTransform *trans3 = NULL;
                                         setCoeffs(trans1, trans2);
@@ -228,5 +228,5 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *trans2 = psPlaneTransformAlloc(2, 2);
+        psPlaneTransform *trans2 = psPlaneTransformAlloc(2, 2, PS_POLYNOMIAL_ORD);
         psPlaneTransform *trans3 = psPlaneTransformCombine(NULL, NULL, trans2, psRegionSet(0,0,0,0), 10);
         ok(trans3 == NULL, "psPlaneTransformCombine() returned NULL with NULL trans1 input");
@@ -241,5 +241,5 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *trans1 = psPlaneTransformAlloc(2, 2);
+        psPlaneTransform *trans1 = psPlaneTransformAlloc(2, 2, PS_POLYNOMIAL_ORD);
         psPlaneTransform *trans3 = psPlaneTransformCombine(NULL, trans1, NULL, psRegionSet(0,0,0,0), 10);
         ok(trans3 == NULL, "psPlaneTransformCombine() returned NULL with NULL trans2 input");
@@ -281,5 +281,5 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *trans = psPlaneTransformAlloc(TST05_X_POLY_ORDER, TST05_Y_POLY_ORDER);
+        psPlaneTransform *trans = psPlaneTransformAlloc(TST05_X_POLY_ORDER, TST05_Y_POLY_ORDER, PS_POLYNOMIAL_ORD);
         psArray *dst = psArrayAlloc((int) TST05_NUM_DATA);
         ok(!psPlaneTransformFit(trans, NULL, dst, 100, 100.0), "psPlaneTransformFit() returned FALSE with NULL src psArray");
@@ -295,5 +295,5 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *trans = psPlaneTransformAlloc(TST05_X_POLY_ORDER, TST05_Y_POLY_ORDER);
+        psPlaneTransform *trans = psPlaneTransformAlloc(TST05_X_POLY_ORDER, TST05_Y_POLY_ORDER, PS_POLYNOMIAL_ORD);
         psArray *src = psArrayAlloc((int) TST05_NUM_DATA);
         ok(!psPlaneTransformFit(trans, src, NULL, 100, 100.0), "psPlaneTransformFit() returned FALSE with NULL dst psArray");
@@ -309,6 +309,6 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *trans = psPlaneTransformAlloc(TST05_X_POLY_ORDER, TST05_Y_POLY_ORDER);
-        psPlaneTransform *transInit = psPlaneTransformAlloc(TST05_X_POLY_ORDER, TST05_Y_POLY_ORDER);
+        psPlaneTransform *trans = psPlaneTransformAlloc(TST05_X_POLY_ORDER, TST05_Y_POLY_ORDER, PS_POLYNOMIAL_ORD);
+        psPlaneTransform *transInit = psPlaneTransformAlloc(TST05_X_POLY_ORDER, TST05_Y_POLY_ORDER, PS_POLYNOMIAL_ORD);
         psArray *src = psArrayAlloc((int) TST05_NUM_DATA);
         psArray *dst = psArrayAlloc((int) TST05_NUM_DATA);
@@ -403,5 +403,5 @@
         psMemId id = psMemGetId();
         psRegion myRegion = psRegionSet(1.0, 5.0, 1.0, 5.0);
-        psPlaneTransform *transInverse = psPlaneTransformInvert(NULL, NULL, myRegion, 10);
+        psPlaneTransform *transInverse = psPlaneTransformInvert(NULL, NULL, myRegion, 10, 2);
         ok(transInverse == NULL, "psPlaneTransformInvert() returned NULL with NULL trans");
         psFree(transInverse);
@@ -416,7 +416,7 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *trans = psPlaneTransformAlloc(1, 1);
+        psPlaneTransform *trans = psPlaneTransformAlloc(1, 1, PS_POLYNOMIAL_ORD);
         psRegion myRegion = psRegionSet(1.0, 5.0, 1.0, 5.0);
-        psPlaneTransform *transInverse = psPlaneTransformInvert(NULL, trans, myRegion, 0);
+        psPlaneTransform *transInverse = psPlaneTransformInvert(NULL, trans, myRegion, 0, 2);
         ok(transInverse == NULL, "psPlaneTransformInvert() returned NULL with zero nSamples");
         psFree(trans);
@@ -434,5 +434,5 @@
         psMemId id = psMemGetId();
         bool errorFlag = false;
-        psPlaneTransform *trans = psPlaneTransformAlloc(1, 1);
+        psPlaneTransform *trans = psPlaneTransformAlloc(1, 1, PS_POLYNOMIAL_ORD);
         psPlaneTransform *transInverse = NULL;
         psRegion myRegion = psRegionSet(1.0, 5.0, 1.0, 5.0);
@@ -473,5 +473,5 @@
             }
 
-            transInverse = psPlaneTransformInvert(NULL, trans, myRegion, 10);
+            transInverse = psPlaneTransformInvert(NULL, trans, myRegion, 10, 2);
             if (transInverse == NULL) {
                 diag("TEST ERROR: psPlaneTransformInvert() returned a NULL psPlaneTransform.\n");
@@ -514,5 +514,5 @@
     {
         psMemId id = psMemGetId();
-        psPlaneTransform *trans = psPlaneTransformAlloc(1, 3);
+        psPlaneTransform *trans = psPlaneTransformAlloc(1, 3, PS_POLYNOMIAL_ORD);
         psPlane *deriv = psPlaneTransformDeriv(NULL, trans, NULL);
         ok(deriv == NULL, "psPlaneTransformDeriv(NULL, trans, NULL) returned NULL");
@@ -532,5 +532,5 @@
         coord->x = 3.0;
         coord->y = 1.0;
-        trans = psPlaneTransformAlloc(1, 3);
+        trans = psPlaneTransformAlloc(1, 3, PS_POLYNOMIAL_ORD);
         //Set Polynomials.  f(x) = x, f(y) = 0.5*y^2  -->  f'(x) = 1, f'(y) = y
         //So for 1,1  -> f'(1) = 1, f'(1) = 1
Index: trunk/psLib/test/fits/tap_psFits.c
===================================================================
--- trunk/psLib/test/fits/tap_psFits.c	(revision 42336)
+++ trunk/psLib/test/fits/tap_psFits.c	(revision 42822)
@@ -717,5 +717,5 @@
             ok(vecItem != NULL, "Retrieved psVector metadata item from file (row=%d)", row);
 
-            ok(vecItem->type.type == PS_DATA_S32 &&
+            ok(vecItem->type.type == PS_TYPE_S32 &&
                vecItem->data.S32[0] == row &&
                vecItem->data.S32[3] == row+30,
Index: trunk/psLib/test/imageops/Makefile.am
===================================================================
--- trunk/psLib/test/imageops/Makefile.am	(revision 42336)
+++ trunk/psLib/test/imageops/Makefile.am	(revision 42822)
@@ -18,5 +18,4 @@
 	tap_psImageSmooth \
 	tap_psImageSmoothMask_Threaded \
-	tap_psImageSmooth_PreAlloc \
 	tap_psImageStructManip \
 	tap_psImageConvolve \
@@ -32,4 +31,5 @@
 	tap_psImageCovariance
 
+# 	tap_psImageSmooth_PreAlloc
 #	tap_psImageShiftKernel
 #	tap_psImageInterpolate
Index: trunk/psLib/test/imageops/convolutionBench.c
===================================================================
--- trunk/psLib/test/imageops/convolutionBench.c	(revision 42336)
+++ trunk/psLib/test/imageops/convolutionBench.c	(revision 42822)
@@ -56,5 +56,5 @@
     }
 
-    char size[16];
+    char size[32];
     sprintf(size, "%dx%d", imageCols, imageRows);
     printf("%15s", size);
Index: trunk/psLib/test/imageops/tap_psImageGeomManip.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageGeomManip.c	(revision 42336)
+++ trunk/psLib/test/imageops/tap_psImageGeomManip.c	(revision 42822)
@@ -528,6 +528,4 @@
 
         psImage *in;
-        psImage *out;
-        psImage *out2;
         psS32 rows = 64;
         psS32 cols = 64;
@@ -544,5 +542,5 @@
         // Verify the returned psImage structure pointer is NULL and program
         // execution doesn't stop, if input parameter input is NULL.
-        out2 = psImageRoll(NULL,NULL,0,0);
+        psImage *out2 = psImageRoll(NULL,NULL,0,0);
         if (out2 != NULL) {
             psError(PS_ERR_UNKNOWN, true,"psImageRoll did not return NULL though input image was NULL!?");
@@ -551,7 +549,7 @@
 
         psFree(in);
-        psFree(out);
-
-        #define testRollType(DATATYPE) \
+        psFree(out2);
+
+#define testRollType(DATATYPE) { 			   \
         in = psImageAlloc(rows1,cols1,PS_TYPE_##DATATYPE); \
         \
@@ -564,5 +562,5 @@
         \
         errorFlag = false; \
-        out = psImageRoll(NULL,in,rows1/4,cols1/4); \
+        psImage *out = psImageRoll(NULL,in,rows1/4,cols1/4);	\
         for (psS32 row=0;row<rows1;row++) { \
             ps##DATATYPE *inRow = in->data.DATATYPE[(row+rows1/4)%rows1]; \
@@ -579,5 +577,5 @@
         psFree(in); \
         psFree(out); \
-        ok(!errorFlag, "psImageRoll() produced the correct data values");
+        ok(!errorFlag, "psImageRoll() produced the correct data values"); }
 
         testRollType(U8);
@@ -636,5 +634,4 @@
         system("mkdir temp");
         psS32 index = 0;
-        psBool fail = false;
         psF32 radianRot;
 
@@ -711,5 +708,4 @@
                 diag("verified psF32 image failed to be read (%d deg. rotation)", rot);
                 errorFlag = true;
-                fail = true;
             } else {
                 if(fTruth->numRows != fOut->numRows || fTruth->numCols != fOut->numCols) {
@@ -788,5 +784,4 @@
                      "(%d deg. rotation) BILINEAR",rot);
                 errorFlag = true;
-                fail = true;
             } else {
                 if (sBiTruth->numRows != sBiOut->numRows ||
Index: trunk/psLib/test/imageops/tap_psImageInterpolate3.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageInterpolate3.c	(revision 42336)
+++ trunk/psLib/test/imageops/tap_psImageInterpolate3.c	(revision 42822)
@@ -74,12 +74,15 @@
 	// point (1) : center of center pixel
         interpOK = psImageInterpolate(&imageVal, NULL, NULL, xCenter + 0.5, yCenter + 0.5, interp);
+	ok (interpOK == PS_INTERPOLATE_STATUS_GOOD, "ok pixel");
 	pt1->data.F32[i] = imageVal;
 
 	// point (2) : edge of center pixel
         interpOK = psImageInterpolate(&imageVal, NULL, NULL, xCenter + 0.5, yCenter, interp);
+	ok (interpOK == PS_INTERPOLATE_STATUS_GOOD, "ok pixel");
 	pt2->data.F32[i] = imageVal;
 
 	// point (3) : corner of center pixel
         interpOK = psImageInterpolate(&imageVal, NULL, NULL, xCenter, yCenter, interp);
+	ok (interpOK == PS_INTERPOLATE_STATUS_GOOD, "ok pixel");
 	pt3->data.F32[i] = imageVal;
 
@@ -102,4 +105,5 @@
 
         interpOK = psImageInterpolate(&imageVal, &varianceVal, NULL, xCenter + 0.5, yCenter + 0.5, interp);
+	ok (interpOK == PS_INTERPOLATE_STATUS_GOOD, "ok pixel");
 	psStatsInit(stats);
 	psVectorStats(stats, pt1, NULL, NULL, 0);
@@ -107,4 +111,5 @@
 	
         interpOK = psImageInterpolate(&imageVal, &varianceVal, NULL, xCenter + 0.5, yCenter, interp);
+	ok (interpOK == PS_INTERPOLATE_STATUS_GOOD, "ok pixel");
 	psStatsInit(stats);
 	psVectorStats(stats, pt2, NULL, NULL, 0);
@@ -112,4 +117,5 @@
 	
         interpOK = psImageInterpolate(&imageVal, &varianceVal, NULL, xCenter, yCenter, interp);
+	ok (interpOK == PS_INTERPOLATE_STATUS_GOOD, "ok pixel");
 	psStatsInit(stats);
 	psVectorStats(stats, pt3, NULL, NULL, 0);
Index: trunk/psLib/test/imageops/tap_psImageMapFit.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageMapFit.c	(revision 42336)
+++ trunk/psLib/test/imageops/tap_psImageMapFit.c	(revision 42822)
@@ -79,5 +79,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -153,5 +155,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -235,5 +239,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -318,5 +324,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -384,5 +392,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -445,5 +455,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -526,5 +538,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -595,5 +609,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -686,5 +702,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -753,5 +771,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
@@ -814,5 +834,7 @@
 
 	// fit the data to the map
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
 
 	psImage *model = psImageAlloc(field->numCols, field->numRows, PS_TYPE_F32);
Index: trunk/psLib/test/imageops/tap_psImageMapFit2.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageMapFit2.c	(revision 42336)
+++ trunk/psLib/test/imageops/tap_psImageMapFit2.c	(revision 42822)
@@ -61,5 +61,8 @@
 
 	// fit the data to the map
-	psImageMapFit (map, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
+	// psImageMapFit (map, x, y, f, NULL);
 
 	psImage *field = psImageAlloc(1000, 1000, PS_TYPE_F32);
@@ -124,5 +127,5 @@
 	for (int ix = 0; ix < 1000; ix += 20) {
 	    for (int iy = 0; iy < 1000; iy += 20) {
-		x->data.F32[x->n] = ix + 0,5;
+		x->data.F32[x->n] = ix + 0.5;
 		y->data.F32[y->n] = iy + 0.5;
 		f->data.F32[f->n] = PS_SQR(x->data.F32[x->n]) + PS_SQR(y->data.F32[x->n]);
@@ -141,5 +144,8 @@
 	// XXX this function needs to correct for the mean superpixel position 
 	// which is sampled...
-	psImageMapFit (map, NULL, 0, x, y, f, NULL);
+	bool status;
+	psImageMapFit (&status, map, NULL, 0, x, y, f, NULL);
+	ok (status, "ok fit");
+	// psImageMapFit (map, NULL, 0, x, y, f, NULL);
 	psFree (binning);
 
Index: trunk/psLib/test/imageops/tap_psImageMaskOps.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageMaskOps.c	(revision 42336)
+++ trunk/psLib/test/imageops/tap_psImageMaskOps.c	(revision 42822)
@@ -121,5 +121,5 @@
         }
         psImageMaskRegion(img, reg, "=", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -149,5 +149,5 @@
         maskVal = 0xf;
         psImageMaskRegion(img, reg, "&", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -177,5 +177,5 @@
         maskVal = 0xf;
         psImageMaskRegion(img, reg, "^", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -250,5 +250,5 @@
         }
         psImageKeepRegion(img, reg, "=", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -278,5 +278,5 @@
         maskVal = 0xf;
         psImageKeepRegion(img, reg, "&", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -306,5 +306,5 @@
         maskVal = 0xf;
         psImageKeepRegion(img, reg, "^", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -381,5 +381,5 @@
         }
         psImageMaskCircle(img, (psF64) x, (psF64) y, (psF64) radius, "=", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -409,5 +409,5 @@
         maskVal = 0xf;
         psImageMaskCircle(img, (psF64) x, (psF64) y, (psF64) radius, "&", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -437,5 +437,5 @@
         maskVal = 0xf;
         psImageMaskCircle(img, (psF64) x, (psF64) y, (psF64) radius, "^", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -504,5 +504,5 @@
         }
         psImageKeepCircle(img, (psF64) x, (psF64) y, (psF64) radius, "=", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -532,5 +532,5 @@
         maskVal = 0xf;
         psImageKeepCircle(img, (psF64) x, (psF64) y, (psF64) radius, "&", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
@@ -560,5 +560,5 @@
         maskVal = 0xf;
         psImageKeepCircle(img, (psF64) x, (psF64) y, (psF64) radius, "^", maskVal);
-        psBool errorFlag = false;
+        errorFlag = false;
         for (int i = 0 ; i < numRows ; i++) {
             for (int j = 0 ; j < numCols ; j++) {
Index: trunk/psLib/test/jpeg/tap_psImageJpeg.c
===================================================================
--- trunk/psLib/test/jpeg/tap_psImageJpeg.c	(revision 42336)
+++ trunk/psLib/test/jpeg/tap_psImageJpeg.c	(revision 42822)
@@ -82,8 +82,8 @@
 
     // add elements to bDraw buffer
-    bDrawSetBuffer(bdbuf);
+    // XXX deprecated: bDrawSetBuffer(bdbuf);
     bDrawColor red = KapaColorByName("red");
-    bDrawSetStyle (red, 1, 0);
-    bDrawCircle(40.0, 20.0, 3.0);
+    bDrawSetStyle (bdbuf, red, 1, 0, 1.0);
+    bDrawCircle(bdbuf, 40.0, 20.0, 3.0);
 
     options->min = ZMIN;
Index: trunk/psLib/test/math/Makefile.am
===================================================================
--- trunk/psLib/test/math/Makefile.am	(revision 42336)
+++ trunk/psLib/test/math/Makefile.am	(revision 42822)
@@ -23,8 +23,4 @@
 	tap_psMatrix07 \
 	tap_psMatrix08 \
-	tap_psPolyFit1D \
-	tap_psPolyFit2D \
-	tap_psPolyFit3D \
-	tap_psPolyFit4D \
 	tap_psPolynomial \
 	tap_psPolynomialEval1D \
@@ -33,4 +29,10 @@
 	tap_psPolynomialEval4D \
 	tap_psPolynomialUtils_Derivatives \
+	tap_psPolyFit1D \
+	tap_psPolyFit2D \
+	tap_psPolyFit3D \
+	tap_psPolyFit4D \
+	tap_psPolyFit_IRLS_1D \
+	tap_psPolyFit_IRLS_2D \
 	tap_psSparse \
 	tap_psStats00 \
Index: trunk/psLib/test/math/tap_psMatrix08.c
===================================================================
--- trunk/psLib/test/math/tap_psMatrix08.c	(revision 42336)
+++ trunk/psLib/test/math/tap_psMatrix08.c	(revision 42822)
@@ -20,4 +20,26 @@
 psS32 main( psS32 argc, char* argv[] )
 {
+    fprintf (stderr, "path: %s\n", argv[0]);
+
+    char imApath[1024];
+    char imBpath[1024];
+    char topPath[1024];
+    char *libpath = strstr (argv[0], ".libs/");
+    if (!libpath) {
+	fprintf (stderr, "ERROR: cannot find input data\n");
+	exit (2);
+    }
+
+    // if (strncmp(argv[0], ".libs/", 6))
+    int nTopPath = libpath - argv[0]; // 
+    if (nTopPath) {
+	ps_strncpy_nowarn (topPath, argv[0], nTopPath); topPath[nTopPath] = 0;
+	ps_snprintf_nowarn (imApath, 1024, "%s/%s", topPath, "data/Agj.fits");
+	ps_snprintf_nowarn (imBpath, 1024, "%s/%s", topPath, "data/Bgj.fits");
+    } else {
+	ps_snprintf_nowarn (imApath, 1024, "%s", "data/Agj.fits");
+	ps_snprintf_nowarn (imBpath, 1024, "%s", "data/Bgj.fits");
+    }
+
     plan_tests(23);
     // psTraceSetLevel("psLib.math.psMatrixGJSolve", 4);
@@ -32,5 +54,5 @@
 	// XXX this is an ill-conditioned matrix.  LU Decomposition does not inform us that it is ill-conditioned.  
 	// the result solves the equation, but what are the errors on the values?
-	fits = psFitsOpen ("data/Agj.fits", "r");
+	fits = psFitsOpen (imApath, "r");
         ok(fits, "opened test image Agj.fits");
 
@@ -43,5 +65,5 @@
 	psFitsClose (fits);
 
-	fits = psFitsOpen ("data/Bgj.fits", "r");
+	fits = psFitsOpen (imBpath, "r");
         ok(fits, "opened test image Bgj.fits");
 
@@ -98,5 +120,5 @@
 
 	// we have a specific ill-conditioned matrix in Agj.fits. psMatrixGJSolve detects this and reports a failure.
-	fits = psFitsOpen ("data/Agj.fits", "r");
+	fits = psFitsOpen (imApath, "r");
         ok(fits, "opened test image Agj.fits");
 
@@ -106,5 +128,5 @@
 	psFitsClose (fits);
 
-	fits = psFitsOpen ("data/Bgj.fits", "r");
+	fits = psFitsOpen (imBpath, "r");
         ok(fits, "opened test image Bgj.fits");
 
@@ -147,5 +169,5 @@
 
 	// we have a specific ill-conditioned matrix in Agj.fits. psMatrixGJSolve detects this and reports a failure.
-	fits = psFitsOpen ("data/Agj.fits", "r");
+	fits = psFitsOpen (imApath, "r");
         ok(fits, "opened test image Agj.fits");
 
@@ -158,5 +180,5 @@
 	psFitsClose (fits);
 
-	fits = psFitsOpen ("data/Bgj.fits", "r");
+	fits = psFitsOpen (imBpath, "r");
         ok(fits, "opened test image Bgj.fits");
 
Index: trunk/psLib/test/math/tap_psMinimizeLMM.c
===================================================================
--- trunk/psLib/test/math/tap_psMinimizeLMM.c	(revision 42336)
+++ trunk/psLib/test/math/tap_psMinimizeLMM.c	(revision 42822)
@@ -53,5 +53,6 @@
 
 #define NUM_ITER 10
-#define TOL  20.0
+#define MIN_TOL  20.0
+#define MAX_TOL  40.0
 psS32 main(psS32 argc, char* argv[])
 {
@@ -64,9 +65,10 @@
     {
         psMemId id = psMemGetId();
-        psMinimization *tmp = psMinimizationAlloc(NUM_ITER, TOL);
+        psMinimization *tmp = psMinimizationAlloc(NUM_ITER, MIN_TOL, MAX_TOL);
         ok(tmp != NULL, "psMinimizationAlloc() returned non-NULL");
         skip_start(tmp == NULL, 5, "Skipping tests because psMinimizationAlloc() failed");
         ok(tmp->maxIter == NUM_ITER, "psMinimizationAlloc() properly set ->maxIter");
-        ok(tmp->tol == TOL, "psMinimizationAlloc() properly set ->tol");
+        ok(tmp->minTol == MIN_TOL, "psMinimizationAlloc() properly set ->tol");
+        ok(tmp->maxTol == MAX_TOL, "psMinimizationAlloc() properly set ->tol");
         ok(tmp->value == 0.0, "psMinimizationAlloc() properly set ->value");
         ok(tmp->iter == 0, "psMinimizationAlloc() properly set ->iter (%d)", tmp->iter);
@@ -96,5 +98,5 @@
         psMemId id = psMemGetId();
         psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
-        psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
+        psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL, 100);
         psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
         psVector *coordinates = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F32);
@@ -204,5 +206,5 @@
         psMemId id = psMemGetId();
         psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
-        psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
+        psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL, 100);
         psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
         psVector *coordinates = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F32);
Index: trunk/psLib/test/math/tap_psMinimizePowell.c
===================================================================
--- trunk/psLib/test/math/tap_psMinimizePowell.c	(revision 42336)
+++ trunk/psLib/test/math/tap_psMinimizePowell.c	(revision 42822)
@@ -81,5 +81,5 @@
         psVector *myParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
         psVector *myParamMask = psVectorAlloc(NUM_PARAMS, PS_TYPE_U8);
-        psMinimization *min = psMinimizationAlloc(100, 0.01);
+        psMinimization *min = psMinimizationAlloc(100, 0.01, 0.1);
         psArray *myCoords = psArrayAlloc(N);
 
@@ -136,5 +136,5 @@
         psMemId id = psMemGetId();
         psVector *myParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
-        psMinimization *min = psMinimizationAlloc(100, 0.01);
+        psMinimization *min = psMinimizationAlloc(100, 0.01, 0.1);
         psArray *myCoords = psArrayAlloc(N);
         psVector *myParamMask = psVectorAlloc(NUM_PARAMS, PS_TYPE_U8);
Index: trunk/psLib/test/math/tap_psPolyFit1D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit1D.c	(revision 42336)
+++ trunk/psLib/test/math/tap_psPolyFit1D.c	(revision 42822)
@@ -8,4 +8,6 @@
  
 XXX: Try null stats.
+
+XXX: this function is confused about POLY_ORDER (5 should have x^5, but setData stops at x^4)
  *****************************************************************************/
 #include <stdio.h>
@@ -350,4 +352,5 @@
     plan_tests(104);
 
+    // psTraceSetLevel ("psLib.math.psMatrixGJSolve", 4);
 
     // psVectorFitPolynomial1D()
Index: trunk/psLib/test/math/tap_psPolyFit_IRLS_1D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit_IRLS_1D.c	(revision 42822)
+++ trunk/psLib/test/math/tap_psPolyFit_IRLS_1D.c	(revision 42822)
@@ -0,0 +1,151 @@
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+// #define POLY_ORDER 5
+// #define A -560.0
+// #define B +1116.0
+// #define C -736.0
+// #define D +203.0
+// #define E -24.0
+// #define F +1.0
+
+// #define A -460.0
+// #define B +1300.0
+// #define C -300.0
+// #define D +400.0
+// #define E -30.0
+// #define F +2.0
+
+// #define A -300.0
+// #define B +1200.0
+// #define C -400.0
+// #define D +500.0
+// #define E -100.0
+// #define F +3.0
+
+#define POLY_ORDER 1
+#define A -1.0 
+#define B +2.0
+
+#define MASK_VALUE 1
+
+static psRandom *rng = NULL;
+
+psF32 setData(psF32 x)
+{
+//  return(A + (B * x) + (C * x * x) + (D * x * x * x) + (E * x * x * x * x) + (F * x * x * x * x * x));
+    return(A + (B * x));
+}
+
+# define DUMP_FIT							\
+    /* compare the fitted values to the input coefficients */		\
+    fprintf (stderr, "%5.3f vs %5.3f : %5.2f\n", myPoly->coeff[0], A, myPoly->coeff[0] - A); \
+    fprintf (stderr, "%5.3f vs %5.3f : %5.2f\n", myPoly->coeff[1], B, myPoly->coeff[1] - B); 
+
+//    fprintf (stderr, "%5.2f vs %5.2f : %5.2f = %5.2f\n", myPoly->coeff[2], C, myPoly->coeff[2] - C, (myPoly->coeff[2] - C)/myPoly->coeff[2]); 
+//    fprintf (stderr, "%5.2f vs %5.2f : %5.2f = %5.2f\n", myPoly->coeff[3], D, myPoly->coeff[3] - D, (myPoly->coeff[3] - D)/myPoly->coeff[3]); 
+//    fprintf (stderr, "%5.2f vs %5.2f : %5.2f = %5.2f\n", myPoly->coeff[4], E, myPoly->coeff[4] - E, (myPoly->coeff[4] - E)/myPoly->coeff[4]); 
+//    fprintf (stderr, "%5.2f vs %5.2f : %5.2f = %5.2f\n", myPoly->coeff[5], F, myPoly->coeff[5] - F, (myPoly->coeff[5] - F)/myPoly->coeff[5]);
+
+# define IS_IRLS 1
+int genericFit (psVector *xTruth, psVector *fTruth, float sigma, float outfrac, int isIRLS) {
+
+    psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, POLY_ORDER);
+    psVector *x    = psVectorAlloc(xTruth->n, PS_TYPE_F64);
+    psVector *f    = psVectorAlloc(xTruth->n, PS_TYPE_F64);
+    psVector *fErr = psVectorAlloc(xTruth->n, PS_TYPE_F64);
+    // psVector *mask = psVectorAlloc(numData, PS_TYPE_U8);
+
+    // set values with an error of 0.5
+    for (int i = 0; i < xTruth->n; i++) {
+	x->data.F64[i] = xTruth->data.F64[i];
+	f->data.F64[i] = fTruth->data.F64[i] + sigma*psRandomGaussian(rng);
+	fErr->data.F64[i] = sigma;
+    }
+
+    // add in 5% random outliers
+    for (int i = 0; i < outfrac*xTruth->n; i++) {
+	int n = (xTruth->n - 1)*psRandomUniform(rng); // n is in range 0 - (numData-1)
+	float nsig = 20.0*psRandomUniform(rng) +10.0;
+	// symmetric outliers do not change the fit parameters
+	// nsig = (psRandomUniform(rng) > 0.5) ? nsig : -1.0 * nsig;
+	f->data.F64[n] += nsig*sigma;
+    }
+    psMemId id = psMemGetId();
+    psStats *stats = psStatsAlloc(PS_STAT_CLIPPED_MEAN);
+    stats->clipIter = 10; // max number of iterations
+    
+    if (isIRLS) {
+	diag ("IRLS fits with %f outliers: sigma = %f", outfrac, sigma);
+	bool rc = psVectorIRLSFitPolynomial1D(myPoly, stats, NULL, MASK_VALUE, f, fErr, x);
+	ok(rc == true, "fit succeeded mechanically");
+
+# if (0)
+	// XXX test:
+	FILE *ftest = fopen ("irls.ft.dat", "w");
+	for (int i = 0; i < f->n; i++) {
+	  fprintf (ftest, "%d %f %f %f\n", i, x->data.F64[i], f->data.F64[i], fErr->data.F64[i]);
+	}
+	fclose (ftest);
+# endif
+    } else {
+	diag ("ORD fits with %f outliers: sigma = %f", outfrac, sigma);
+	bool rc = psVectorFitPolynomial1D(myPoly, NULL, MASK_VALUE, f, fErr, x);
+	ok(rc == true, "fit succeeded mechanically");
+    }
+
+    // compare the fitted values to the input coefficients
+    DUMP_FIT;
+
+    // is_float_tol (myPoly->coeff[0], A, 1e-5, "A coeffs match");
+    // is_float_tol (myPoly->coeff[1], B, 1e-5, "B coeffs match");
+    // is_float_tol (myPoly->coeff[2], C, 1e-5, "C coeffs match");
+    // is_float_tol (myPoly->coeff[3], D, 1e-5, "D coeffs match");
+    // is_float_tol (myPoly->coeff[4], E, 1e-5, "E coeffs match");
+    // is_float_tol (myPoly->coeff[5], F, 1e-5, "F coeffs match");
+
+    psFree (stats);
+    psFree (x);
+    psFree (f);
+    psFree (fErr);
+    psFree (myPoly);
+    ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+
+    return true;
+}
+
+int main()
+{
+    psLogSetFormat("HLNM");
+    psLogSetLevel(PS_LOG_INFO);
+    plan_tests(104);
+
+    // create x vector running from -1 to 11 in steps of 0.1
+    int numData = 120;
+    psVector *xTruth = psVectorAlloc(numData, PS_TYPE_F64);
+    psVector *fTruth = psVectorAlloc(numData, PS_TYPE_F64);
+    rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using a known seed
+    
+    // create reference data
+    for (int i = 0; i < numData; i++) {
+	xTruth->data.F64[i] = 0.1*i - 1.0;
+	fTruth->data.F64[i] = setData(xTruth->data.F64[i]);
+    }
+
+    genericFit (xTruth, fTruth, 0.1, 0.20, !IS_IRLS);
+    genericFit (xTruth, fTruth, 0.1, 0.20,  IS_IRLS);
+
+    // genericFit (xTruth, fTruth, 0.01, 0.00, !IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.50, 0.00, !IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.01, 0.05, !IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.50, 0.05, !IS_IRLS);
+    // 
+    // genericFit (xTruth, fTruth, 0.01, 0.00,  IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.50, 0.00,  IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.01, 0.05,  IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.50, 0.05,  IS_IRLS);
+}
+
Index: trunk/psLib/test/math/tap_psPolyFit_IRLS_2D.c
===================================================================
--- trunk/psLib/test/math/tap_psPolyFit_IRLS_2D.c	(revision 42822)
+++ trunk/psLib/test/math/tap_psPolyFit_IRLS_2D.c	(revision 42822)
@@ -0,0 +1,151 @@
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+
+// #define POLY_ORDER 5
+// #define A -560.0
+// #define B +1116.0
+// #define C -736.0
+// #define D +203.0
+// #define E -24.0
+// #define F +1.0
+
+// #define A -460.0
+// #define B +1300.0
+// #define C -300.0
+// #define D +400.0
+// #define E -30.0
+// #define F +2.0
+
+// #define A -300.0
+// #define B +1200.0
+// #define C -400.0
+// #define D +500.0
+// #define E -100.0
+// #define F +3.0
+
+#define ORDER_X 1
+#define ORDER_Y 1
+#define A00 -1.0 
+#define A10 +2.0
+#define A01 -0.5
+
+#define MASK_VALUE 1
+
+static psRandom *rng = NULL;
+
+psF32 setData(psF32 x, psF32 y)
+{
+//  return(A00 + (A10 * x) + (A01 * y) + (A20 * x*x) + (A11 * x*y) + (A02 * y*y));
+    return(A00 + (A10 * x) + (A01 * y));
+}
+
+# define DUMP_FIT							\
+    /* compare the fitted values to the input coefficients */		\
+    fprintf (stderr, "%5.3f vs %5.3f : %5.2f\n", myPoly->coeff[0][0], A00, myPoly->coeff[0][0] - A00); \
+    fprintf (stderr, "%5.3f vs %5.3f : %5.2f\n", myPoly->coeff[1][0], A10, myPoly->coeff[1][0] - A10); \
+    fprintf (stderr, "%5.3f vs %5.3f : %5.2f\n", myPoly->coeff[0][1], A01, myPoly->coeff[0][1] - A01);
+
+# define IS_IRLS 1
+int genericFit (psVector *xTruth, psVector *yTruth, psVector *fTruth, float sigma, float outfrac, int isIRLS) {
+
+    psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, ORDER_X, ORDER_Y);
+    psVector *x    = psVectorAlloc(xTruth->n, PS_TYPE_F64);
+    psVector *y    = psVectorAlloc(xTruth->n, PS_TYPE_F64);
+    psVector *f    = psVectorAlloc(xTruth->n, PS_TYPE_F64);
+    psVector *fErr = psVectorAlloc(xTruth->n, PS_TYPE_F64);
+
+    // set values with an error of 'sigma'
+    for (int i = 0; i < xTruth->n; i++) {
+	x->data.F64[i] = xTruth->data.F64[i];
+	y->data.F64[i] = yTruth->data.F64[i];
+	f->data.F64[i] = fTruth->data.F64[i] + sigma*psRandomGaussian(rng);
+	fErr->data.F64[i] = sigma;
+    }
+
+    // add in outfrac random outliers
+    for (int i = 0; i < outfrac*xTruth->n; i++) {
+	int n = (xTruth->n - 1)*psRandomUniform(rng); // n is in range 0 - (numData-1)
+	float nsig = 20.0*psRandomUniform(rng) +10.0;
+	// symmetric outliers do not change the fit parameters
+	// nsig = (psRandomUniform(rng) > 0.5) ? nsig : -1.0 * nsig;
+	f->data.F64[n] += nsig*sigma;
+    }
+    psMemId id = psMemGetId();
+    psStats *stats = psStatsAlloc(PS_STAT_CLIPPED_MEAN);
+    stats->clipIter = 10; // max number of iterations
+    
+    if (isIRLS) {
+	diag ("IRLS fits with %f outliers: sigma = %f", outfrac, sigma);
+	bool rc = psVectorIRLSFitPolynomial2D(myPoly, stats, NULL, MASK_VALUE, f, fErr, x, y);
+	ok(rc == true, "fit succeeded mechanically");
+    } else {
+	diag ("ORD fits with %f outliers: sigma = %f", outfrac, sigma);
+	bool rc = psVectorFitPolynomial2D(myPoly, NULL, MASK_VALUE, f, fErr, x, y);
+	ok(rc == true, "fit succeeded mechanically");
+    }
+
+# if (0)
+	// XXX test:
+	FILE *ftest = fopen ("irls.ft.dat", "w");
+	for (int i = 0; i < f->n; i++) {
+	  fprintf (ftest, "%d %f %f %f %f\n", i, x->data.F64[i], y->data.F64[i], f->data.F64[i], fErr->data.F64[i]);
+	}
+	fclose (ftest);
+# endif
+
+    // compare the fitted values to the input coefficients
+    DUMP_FIT;
+
+    // is_float_tol (myPoly->coeff[0][0], A00, 1e-5, "A00 coeffs match");
+
+    psFree (stats);
+    psFree (x);
+    psFree (y);
+    psFree (f);
+    psFree (fErr);
+    psFree (myPoly);
+    ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+
+    return true;
+}
+
+int main()
+{
+    psLogSetFormat("HLNM");
+    psLogSetLevel(PS_LOG_INFO);
+    plan_tests(104);
+
+    // create x vector running from -1 to 11 in steps of 0.1
+    int numData = 120;
+    psVector *xTruth = psVectorAlloc(numData*numData, PS_TYPE_F64);
+    psVector *yTruth = psVectorAlloc(numData*numData, PS_TYPE_F64);
+    psVector *fTruth = psVectorAlloc(numData*numData, PS_TYPE_F64);
+    rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using a known seed
+    
+    // create reference data
+    int seq = 0;
+    for (int ix = 0; ix < numData; ix++) {
+	for (int iy = 0; iy < numData; iy++, seq++) {
+	    xTruth->data.F64[seq] = 0.1*ix - 1.0;
+	    yTruth->data.F64[seq] = 0.1*iy - 1.0;
+	    fTruth->data.F64[seq] = setData(xTruth->data.F64[seq], yTruth->data.F64[seq]);
+	}
+    }
+
+    genericFit (xTruth, yTruth, fTruth, 0.1, 0.20, !IS_IRLS);
+    genericFit (xTruth, yTruth, fTruth, 0.1, 0.20,  IS_IRLS);
+
+    // genericFit (xTruth, fTruth, 0.01, 0.00, !IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.50, 0.00, !IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.01, 0.05, !IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.50, 0.05, !IS_IRLS);
+    // 
+    // genericFit (xTruth, fTruth, 0.01, 0.00,  IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.50, 0.00,  IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.01, 0.05,  IS_IRLS);
+    // genericFit (xTruth, fTruth, 0.50, 0.05,  IS_IRLS);
+}
+
Index: trunk/psLib/test/math/tap_psSparse.c
===================================================================
--- trunk/psLib/test/math/tap_psSparse.c	(revision 42336)
+++ trunk/psLib/test/math/tap_psSparse.c	(revision 42822)
@@ -1,3 +1,3 @@
-    #include <stdio.h>
+#include <stdio.h>
 #include <string.h>
 #include <pslib.h>
@@ -227,5 +227,5 @@
         // test the support functions: LowerProduct
         fVec = psSparseBorderLowerProduct(NULL, border, xRef);
-        is_float(fVec->n, 1.0, "f dimen: %d", fVec->n);
+        is_int(fVec->n, 1.0, "f dimen: %d", fVec->n);
         is_float(fVec->data.F32[0], 0.3, "f(0): %f", fVec->data.F32[0]);
         psFree(fVec);
@@ -233,5 +233,5 @@
         // test the support functions: Upper Product
         fVec = psSparseBorderUpperProduct(NULL, border, yRef);
-        is_float(fVec->n, 2.0, "f dimen: %d", fVec->n);
+        is_int(fVec->n, 2.0, "f dimen: %d", fVec->n);
         is_float(fVec->data.F32[0], 0.05, "f(0): %f", fVec->data.F32[0]);
         is_float(fVec->data.F32[1], 0.10, "f(0): %f", fVec->data.F32[1]);
@@ -240,5 +240,5 @@
         // test the support functions: Square Product
         fVec = psSparseBorderSquareProduct(NULL, border, yRef);
-        is_float(fVec->n, 1.0, "f dimen: %d", fVec->n);
+        is_int(fVec->n, 1.0, "f dimen: %d", fVec->n);
         is_float(fVec->data.F32[0], 0.25, "f(0): %f", fVec->data.F32[0]);
         psFree(fVec);
Index: trunk/psLib/test/math/tap_psSpline1D.c
===================================================================
--- trunk/psLib/test/math/tap_psSpline1D.c	(revision 42336)
+++ trunk/psLib/test/math/tap_psSpline1D.c	(revision 42822)
@@ -107,7 +107,7 @@
         psSpline1D *tmpSpline = NULL;
         if (!xNull) {
-            tmpSpline = psSpline1DFitVector(xF32, yF32);
+	    tmpSpline = psSpline1DFitVector(xF32, yF32, NAN, NAN);
         } else {
-            tmpSpline = psSpline1DFitVector(NULL, yF32);
+            tmpSpline = psSpline1DFitVector(NULL, yF32, NAN, NAN);
         }
 
@@ -120,32 +120,15 @@
                 testStatus = false;
             }
-            if(tmpSpline->spline == NULL) {
-                diag("psSpline1DFitVector() returned a NULL psSpline1D->spline member.");
-                testStatus = false;
-            }
-            for (psS32 i = 0 ; i < NumSplines ; i++) {
-                if (tmpSpline->spline[i] == NULL) {
-                    diag("psSpline1DFitVector() returned a NULL psSpline1D->spline[%d] member.", i);
-                    testStatus = false;
-                }
-            }
-            if (tmpSpline->knots == NULL) {
+            if (tmpSpline->xKnots == NULL) {
                 diag("psSpline1DFitVector() returned a NULL psSpline1D->knots member");
                 testStatus = false;
             }
-            if (tmpSpline->p_psDeriv2 == NULL) {
+            if (tmpSpline->yKnots == NULL) {
+                diag("psSpline1DFitVector() returned a NULL psSpline1D->knots member");
+                testStatus = false;
+            }
+            if (tmpSpline->d2yKnots == NULL) {
                 diag("psSpline1DFitVector()returned a NULL psSpline1D->p_psDeriv2 member");
                 testStatus = false;
-            }
-
-            // Test psSpline1DEval()
-            for (psS32 i=0;i<NumSplines;i++) {
-                psF32 x = 0.5 + (float) i;
-                psF32 y = psSpline1DEval(tmpSpline, x);
-                if (CheckErrorF32(y, func(x))) {
-                    testStatus = false;
-                    diag("TEST ERROR: f(%f) is %f, should be %f", x, y, myFunc00(x));
-		    // XXX EAM : the truth value above should be 'func' not myFunc00
-                }
             }
 
@@ -196,7 +179,7 @@
         psSpline1D *tmpSpline = NULL;
         if (!xNull) {
-            tmpSpline = psSpline1DFitVector(xF64, yF64);
+            tmpSpline = psSpline1DFitVector(xF64, yF64, NAN, NAN);
         } else {
-            tmpSpline = psSpline1DFitVector(NULL, yF64);
+            tmpSpline = psSpline1DFitVector(NULL, yF64, NAN, NAN);
         }
         if(tmpSpline == NULL) {
@@ -208,20 +191,14 @@
                 testStatus = false;
             }
-            if(tmpSpline->spline == NULL) {
-                diag("psSpline1DFitVector() returned a NULL psSpline1D->spline member.");
-                testStatus = false;
-            }
-            for (psS32 i = 0 ; i < NumSplines ; i++) {
-                if (tmpSpline->spline[i] == NULL) {
-                    diag("psSpline1DFitVector() returned a NULL psSpline1D->spline[%d] member.", i);
-                    testStatus = false;
-                }
-            }
-            if (tmpSpline->knots == NULL) {
-                diag("psSpline1DFitVector() returned a NULL psSpline1D->knots member");
-                testStatus = false;
-            }
-            if (tmpSpline->p_psDeriv2 == NULL) {
-                diag("psSpline1DFitVector()returned a NULL psSpline1D->p_psDeriv2 member");
+            if (tmpSpline->xKnots == NULL) {
+                diag("psSpline1DFitVector() returned a NULL psSpline1D->xKnots member");
+                testStatus = false;
+            }
+            if (tmpSpline->yKnots == NULL) {
+                diag("psSpline1DFitVector() returned a NULL psSpline1D->yKnots member");
+                testStatus = false;
+            }
+            if (tmpSpline->d2yKnots == NULL) {
+                diag("psSpline1DFitVector()returned a NULL psSpline1D->d2yKnots member");
                 testStatus = false;
             }
@@ -278,7 +255,7 @@
         skip_start(tmpSpline == NULL, 4, "Skipping tests because psSpline1DAlloc() failed");
         ok(tmpSpline->n == 0, "psSpline1DAlloc() properly set the psSpline1D->n member");
-        ok(tmpSpline->spline == NULL, "psSpline1DAlloc() properly set the psSpline1D->spline member");
-        ok(tmpSpline->knots == NULL, "psSpline1DAlloc() properly set the psSpline1D->knots member");
-        ok(tmpSpline->p_psDeriv2 == NULL, "psSpline1DAlloc() properly set the psSpline1D->p_psDeriv2 member");
+        ok(tmpSpline->xKnots   == NULL, "psSpline1DAlloc() properly set the psSpline1D->xKnots member");
+        ok(tmpSpline->yKnots   == NULL, "psSpline1DAlloc() properly set the psSpline1D->yKnots member");
+        ok(tmpSpline->d2yKnots == NULL, "psSpline1DAlloc() properly set the psSpline1D->d2yKnots member");
         psFree(tmpSpline);
         skip_end();
@@ -289,5 +266,5 @@
     {
         psMemId id = psMemGetId();
-        psSpline1D *tmpSpline = psSpline1DFitVector(NULL, NULL);
+        psSpline1D *tmpSpline = psSpline1DFitVector(NULL, NULL, NAN, NAN);
         ok(tmpSpline == NULL, "psSpline1DFitVector() returns NULL with NULL arguments");
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
Index: trunk/psLib/test/math/tst_psFunc01.c
===================================================================
--- trunk/psLib/test/math/tst_psFunc01.c	(revision 42336)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that the psGaussian() shall evaluate a
-    specified Gaussian at some X.
- 
-    It also tests the p_psGaussianDev() procedure.
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "psMemory.h"
-#include "psPolynomial.h"
-#define MY_MEAN 30.0
-#define MY_STDEV 2.0
-#define N 30
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    psS32 testStatus = true;
-    float x = 0.0;
-    psS32  memLeaks;
-    psS32  currentId = psMemGetId();
-    psVector *myGaussData = NULL;
-    printPositiveTestHeader(stdout,
-                            "psPolynomial functions",
-                            "psGaussian()");
-
-
-    for (x = 0.0 ; x < (MY_MEAN * 2.0) ; x+= 1.0) {
-        printf("normal psGaussian(%f) is %f\n", x, psGaussian(x, MY_MEAN, MY_STDEV, true));
-        x = x + 1.0;
-    }
-
-    for (x = 0.0 ; x < (MY_MEAN * 2.0) ; x+= 1.0) {
-        printf("NON-normal psGaussian(%f) is %f\n", x, psGaussian(x, MY_MEAN, MY_STDEV, false));
-        x = x + 1.0;
-    }
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psPolynomial functions",
-                "psGaussian()",
-                testStatus);
-
-
-    printPositiveTestHeader(stdout,
-                            "psPolynomial functions",
-                            "p_psGaussianDev()");
-
-    myGaussData = p_psGaussianDev(MY_MEAN, MY_STDEV, N);
-    for (psS32 i = 0; i < N ; i++) {
-        printf("Gaussian Deviate [%d] is %f\n", i, myGaussData->data.F32[i]);
-    }
-
-    if ( myGaussData->type.type != PS_TYPE_F32) {
-        psAbort("p_psGaussianDev did not return a vector of type F32");
-    }
-
-    psFree(myGaussData);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psPolynomial functions",
-                "p_psGaussianDev()",
-                testStatus);
-
-    return (!testStatus);
-}
Index: trunk/psLib/test/math/tst_psHist00.c
===================================================================
--- trunk/psLib/test/math/tst_psHist00.c	(revision 42336)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that the psHistogram structure is correctly
-    allocated and deallocated by the procedure psHistogramAlloc().
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "psMemory.h"
-#define LOWER 20.0
-#define UPPER 30.0
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorBinDisect", 0);
-    psTraceSetLevel("psHistogramAlloc", 0);
-    psTraceSetLevel("psHistogramAllocGeneric", 0);
-    psTraceSetLevel("UpdateHistogramBins", 0);
-    psTraceSetLevel("psVectorHistogram", 0);
-    psHistogram *myHist = NULL;
-    psS32 testStatus      = true;
-    psS32 memLeaks        = 0;
-    psS32 i               = 0;
-    psS32 nb              = 0;
-    psS32 numBins         = 0;
-    psS32 currentId       = 0;
-
-    currentId       = psMemGetId();
-    for (nb=0;nb<4;nb++) {
-        if (nb == 0)
-            numBins = 1;
-        if (nb == 1)
-            numBins = 2;
-        if (nb == 2)
-            numBins = 10;
-        if (nb == 3)
-            numBins = 20;
-        /*********************************************************************/
-        /*  Allocate and initialize data structures                          */
-        /*********************************************************************/
-        printPositiveTestHeader(stdout,
-                                "psStats functions",
-                                "Allocate the psHistogram structure.");
-
-        myHist = psHistogramAlloc(LOWER, UPPER, numBins);
-
-        if (myHist->nums->n != numBins) {
-            printf("ERROR: myHist->nums->n is wrong size (%ld)\n", myHist->nums->n);
-            testStatus = false;
-        }
-
-        if (myHist->bounds->n != numBins+1) {
-            printf("ERROR: myHist->bounds->n is wrong size (%ld)\n", myHist->bounds->n);
-            testStatus = false;
-        }
-
-        for (i=0;i<numBins;i++) {
-            if (myHist->nums->data.F32[i] != 0.0) {
-                printf("ERROR: myHist->nums->data.U32[%d] not initialized to 0.\n", i);
-                testStatus = false;
-            }
-            myHist->nums->data.F32[i] = 0.0;
-        }
-
-        if (myHist->minNum != 0) {
-            printf("ERROR: myHist->minNum is %d\n", myHist->minNum);
-            testStatus = false;
-        }
-
-        if (myHist->maxNum != 0) {
-            printf("myHist->maxNum is %d\n", myHist->maxNum);
-            testStatus = false;
-        }
-
-        if (myHist->uniform != true) {
-            printf("ERROR: myHist->uniform is %d\n", myHist->uniform);
-            testStatus = false;
-        }
-
-        for (i=0;i<numBins;i++) {
-            printf("Bin number %d bounds: (%6.3f - %6.3f)\n", i,
-                   myHist->bounds->data.F32[i],
-                   myHist->bounds->data.F32[i+1]);
-        }
-
-        psMemCheckCorruption(1);
-        psFree(myHist);
-        psMemCheckCorruption(1);
-
-        printFooter(stdout,
-                    "psStats functions",
-                    "Allocate the psHistogram structure.",
-                    testStatus);
-    }
-
-
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "Allocate the psHistogram structure. (UPPER<LOWER)");
-
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
-    myHist = psHistogramAlloc(UPPER, LOWER, numBins);
-    if (myHist != NULL) {
-        printf("ERROR: myHist != NULL\n");
-    }
-    printFooter(stdout,
-                "psStats functions",
-                "Allocate the psHistogram structure. (UPPER<LOWER)",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "Deallocate the psHistogram structure.");
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    psMemCheckCorruption(1);
-
-    printFooter(stdout,
-                "psStats functions",
-                "Deallocate the psHistogram structure.",
-                testStatus);
-
-    return (!testStatus);
-}
Index: trunk/psLib/test/math/tst_psHist01.c
===================================================================
--- trunk/psLib/test/math/tst_psHist01.c	(revision 42336)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that the psHistogram structure is correctly
-    allocated and deallocated by the procedure psHistogramAllocGeneric().
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "psMemory.h"
-#define LOWER 20.0
-#define UPPER 30.0
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorBinDisect", 0);
-    psTraceSetLevel("psHistogramAlloc", 0);
-    psTraceSetLevel("psHistogramAllocGeneric", 0);
-    psTraceSetLevel("UpdateHistogramBins", 0);
-    psTraceSetLevel("psVectorHistogram", 0);
-    psHistogram *myHist = NULL;
-    psVector *myBounds  = NULL;
-    psS32 testStatus      = true;
-    psS32 memLeaks        = 0;
-    psS32 i               = 0;
-    psS32 nb              = 0;
-    psS32 numBins         = 0;
-    psS32 currentId       = 0;
-
-    currentId       = psMemGetId();
-    for (nb=0;nb<4;nb++) {
-        if (nb == 0)
-            numBins = 1;
-        if (nb == 1)
-            numBins = 2;
-        if (nb == 2)
-            numBins = 10;
-        if (nb == 3)
-            numBins = 20;
-        /*********************************************************************/
-        /*  Allocate and initialize data structures                          */
-        /*********************************************************************/
-        printPositiveTestHeader(stdout,
-                                "psStats functions",
-                                "Allocate the psHistogram structure.");
-        myBounds = psVectorAlloc(numBins+1, PS_TYPE_F32);
-        myBounds->n = myBounds->nalloc;
-        for (i=0;i<numBins+1;i++) {
-            myBounds->data.F32[i] = LOWER + ((UPPER - LOWER) / (float) numBins) *
-                                    (float) i;
-        }
-        myHist = psHistogramAllocGeneric(myBounds);
-
-        if (myHist->nums->n != numBins) {
-            printf("ERROR: myHist->nums->n is wrong size (%ld)\n", myHist->nums->n);
-            testStatus = false;
-        }
-
-        if (myHist->bounds->n != numBins+1) {
-            printf("ERROR: myHist->bounds->n is wrong size (%ld)\n", myHist->bounds->n);
-            testStatus = false;
-        }
-
-        for (i=0;i<numBins;i++) {
-            if (myHist->nums->data.F32[i] != 0.0) {
-                printf("ERROR: myHist->nums->data.F32[%d] not initialized to 0.\n", i);
-                testStatus = false;
-            }
-            myHist->nums->data.F32[i] = 0.0;
-        }
-
-        if (myHist->minNum != 0) {
-            printf("ERROR: myHist->minNum is %d\n", myHist->minNum);
-            testStatus = false;
-        }
-
-        if (myHist->maxNum != 0) {
-            printf("myHist->maxNum is %d\n", myHist->maxNum);
-            testStatus = false;
-        }
-
-        if (myHist->uniform != false) {
-            printf("ERROR: myHist->uniform is %d\n", myHist->uniform);
-            testStatus = false;
-        }
-
-        for (i=0;i<numBins;i++) {
-            printf("Bin number %d bounds: (%6.3f - %6.3f)\n", i,
-                   myHist->bounds->data.F32[i],
-                   myHist->bounds->data.F32[i+1]);
-        }
-        psMemCheckCorruption(1);
-        psFree(myHist);
-        psMemCheckCorruption(1);
-        psFree(myBounds);
-
-        printFooter(stdout,
-                    "psStats functions",
-                    "Allocate the psHistogram structure.",
-                    testStatus);
-    }
-    /*************************************************************************/
-    /*  Deallocate data structures                                           */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "Deallocate the psHistogram structure.");
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    psMemCheckCorruption(1);
-
-    printFooter(stdout,
-                "psStats functions",
-                "Deallocate the psHistogram structure.",
-                testStatus);
-
-    return (!testStatus);
-}
Index: trunk/psLib/test/math/tst_psHist02.c
===================================================================
--- trunk/psLib/test/math/tst_psHist02.c	(revision 42336)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*****************************************************************************
-   This routine must ensure that the psHistogram structure is correctly
-   populated by the procedure psGetArrayHistogram().
- 
-*****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "psMemory.h"
-#define MISC_FLOAT_NUMBER 345.0
-#define MISC_INT_NUMBER 345
-#define LOWER 20.0
-#define UPPER 30.0
-#define NUM_DATA 10000
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    psHistogram * myHist = NULL;
-    psHistogram *myHist2 = NULL;
-    psVector *myData = NULL;
-    psVector *myMask = NULL;
-    psS32 testStatus = true;
-    psS32 memLeaks = 0;
-    psS32 nb = 0;
-    psS32 numBins = 0;
-    psS32 i = 0;
-    psS32 currentId = 0;
-
-    currentId = psMemGetId();
-
-    /*********************************************************************/
-    /*  Allocate and initialize data structures                          */
-    /*********************************************************************/
-    myData = psVectorAlloc( NUM_DATA, PS_TYPE_F32 );
-    myData->n = myData->nalloc;
-    for ( i = 0;i < NUM_DATA;i++ ) {
-        myData->data.F32[ i ] = LOWER + ( ( UPPER - LOWER ) / ( float ) NUM_DATA ) * ( float ) i;
-    }
-
-    myMask = psVectorAlloc( NUM_DATA, PS_TYPE_U8 );
-    myMask->n = myMask->nalloc;
-    for ( i = 0;i < NUM_DATA;i++ ) {
-        if ( i >= ( NUM_DATA / 2 ) ) {
-            myMask->data.U8[ i ] = 1;
-        } else {
-            myMask->data.U8[ i ] = 0;
-        }
-    }
-
-    for ( nb = 0;nb < 4;nb++ ) {
-        if ( nb == 0 )
-            numBins = 1;
-        if ( nb == 1 )
-            numBins = 2;
-        if ( nb == 2 )
-            numBins = 10;
-        if ( nb == 3 )
-            numBins = 20;
-
-        /*********************************************************************/
-        /*  Allocate and Perform Histogram, no mask                          */
-        /*********************************************************************/
-        printPositiveTestHeader( stdout,
-                                 "psStats functions",
-                                 "Allocate and Perform Histogram, no mask" );
-
-        myHist = psHistogramAlloc( LOWER, UPPER, numBins );
-        myHist = psVectorHistogram( myHist, myData, NULL, NULL, 0 );
-
-        for ( i = 0;i < numBins;i++ ) {
-            printf( "Bin number %d bounds: (%.2f - %.2f) data (%f)\n", i,
-                    myHist->bounds->data.F32[ i ],
-                    myHist->bounds->data.F32[ i + 1 ],
-                    myHist->nums->data.F32[ i ] );
-        }
-        psMemCheckCorruption( 1 );
-        psFree( myHist );
-        psMemCheckCorruption( 1 );
-
-        printFooter( stdout,
-                     "psStats functions",
-                     "Allocate and Perform Histogram, no mask",
-                     testStatus );
-
-        /*********************************************************************/
-        /*  Allocate and Perform Histogram with mask                         */
-        /*********************************************************************/
-        printPositiveTestHeader( stdout,
-                                 "psStats functions",
-                                 "Allocate and Perform Histogram with mask" );
-
-        myHist = psHistogramAlloc( LOWER, UPPER, numBins );
-        myHist = psVectorHistogram( myHist, myData, NULL, myMask, 1 );
-
-        for ( i = 0;i < numBins;i++ ) {
-            printf( "Bin number %d bounds: (%6.3f - %6.3f) data (%f)\n", i,
-                    myHist->bounds->data.F32[ i ],
-                    myHist->bounds->data.F32[ i + 1 ],
-                    myHist->nums->data.F32[ i ] );
-        }
-        psMemCheckCorruption( 1 );
-        psFree( myHist );
-        psMemCheckCorruption( 1 );
-
-        printFooter( stdout,
-                     "psStats functions",
-                     "Allocate and Perform Histogram with mask",
-                     testStatus );
-    }
-    psFree( myMask );
-
-    printPositiveTestHeader( stdout,
-                             "psStats functions",
-                             "Calling psVectorHistogram() with various NULL inputs." );
-
-
-
-    // ********************************************************************
-    // Verify the return value is null and program execution doesn't stop,
-    // if input parameter myHist is null.
-
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
-    myHist2 = psVectorHistogram( NULL, myData, NULL, NULL, 0 );
-    if ( myHist2 != NULL ) {
-        printf( "ERROR: myHist2!=NULL\n" );
-        testStatus = false;
-    }
-    psFree( myData );
-
-
-    // ********************************************************************
-    // Verify the return value is the same as the input parameter myHist and
-    // program execution doesn't stop, if the input parameter myArray is
-    // null.
-
-    myHist = psHistogramAlloc( LOWER, UPPER, numBins );
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
-    myHist = psVectorHistogram( myHist, NULL, NULL, NULL, 0 );
-    if ( myHist == NULL ) {
-        printf( "ERROR: myHist==NULL\n" );
-        testStatus = false;
-    }
-    psFree( myHist );
-
-
-    //    exit(0);
-    // ********************************************************************
-    // Verify the return value is the same as the input parameter myHist and
-    // program execution doesn't stop, if the input parameter myArray has no
-    // elements.
-    // NOTE: This code segment is commented out because psVectorAlloc returns
-    // NULL if called with an N element data.
-    /*
-    myData = psVectorAlloc(0, PS_TYPE_F32);
-    myData->n = myData->nalloc;
-    myHist = psHistogramAlloc(LOWER, UPPER, numBins);
-    myHist = psVectorHistogram(myHist, NULL, NULL, NULL, 0);
-    if (myHist == NULL) {
-        printf("ERROR: myHist==NULL\n");
-        testStatus = false;
-    }
-    psFree(myHist);
-    psFree(myData);
-    */
-    printFooter( stdout,
-                 "psStats functions",
-                 "Calling psVectorHistogram() with various NULL inputs.",
-                 testStatus );
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
-    /*************************************************************************/
-    printPositiveTestHeader( stdout,
-                             "psStats functions",
-                             "Deallocate the psHistogram structure." );
-
-    psMemCheckCorruption( 1 );
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if ( 0 != memLeaks ) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks );
-    }
-    psMemCheckCorruption( 1 );
-
-    printFooter( stdout,
-                 "psStats functions",
-                 "Deallocate the psHistogram structure.",
-                 testStatus );
-
-    return ( !testStatus );
-}
Index: trunk/psLib/test/math/tst_psHist03.c
===================================================================
--- trunk/psLib/test/math/tst_psHist03.c	(revision 42336)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that the psHistogram structure is correctly
-    allocated and deallocated by the procedure psHistogramAllocGeneric() and
-    that it can be populated correctly by psVectorHistogram().
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "psMemory.h"
-#define LOWER 20.0
-#define UPPER 30.0
-#define NUM_DATA 20
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorBinDisect", 0);
-    psTraceSetLevel("psHistogramAlloc", 0);
-    psTraceSetLevel("psHistogramAllocGeneric", 0);
-    psTraceSetLevel("UpdateHistogramBins", 0);
-    psTraceSetLevel("psVectorHistogram", 0);
-    psHistogram *myHist = NULL;
-    psVector *myBounds  = NULL;
-    psVector *myData = psVectorAlloc( NUM_DATA, PS_TYPE_F32 );
-    psS32 testStatus      = true;
-    psS32 memLeaks        = 0;
-    psS32 i               = 0;
-    psS32 nb              = 0;
-    psS32 numBins         = 0;
-    psS32 currentId       = 0;
-
-    currentId       = psMemGetId();
-
-    psTraceSetLevel(".psLib", 0);
-
-    myData->n = myData->nalloc;
-    for ( i = 0;i < NUM_DATA;i++ ) {
-        myData->data.F32[ i ] = LOWER + ( ( UPPER - LOWER ) / ( float ) NUM_DATA ) * ( float ) i;
-    }
-
-    for (nb=0;nb<4;nb++) {
-        if (nb == 0)
-            numBins = 1;
-        if (nb == 1)
-            numBins = 2;
-        if (nb == 2)
-            numBins = 10;
-        if (nb == 3)
-            numBins = 20;
-        /*********************************************************************/
-        /*  Allocate and initialize data structures                          */
-        /*********************************************************************/
-        printPositiveTestHeader(stdout,
-                                "psStats functions",
-                                "Allocate the psHistogram structure.");
-        myBounds = psVectorAlloc(numBins+1, PS_TYPE_F32);
-        myBounds->n = myBounds->nalloc;
-        for (i=0;i<numBins+1;i++) {
-            myBounds->data.F32[i] = LOWER + ((UPPER - LOWER) / (float) numBins) *
-                                    (float) i;
-        }
-        myHist = psHistogramAllocGeneric(myBounds);
-
-        if (myHist->nums->n != numBins) {
-            printf("ERROR: myHist->nums->n is wrong size (%ld)\n", myHist->nums->n);
-            testStatus = false;
-        }
-
-        if (myHist->bounds->n != numBins+1) {
-            printf("ERROR: myHist->bounds->n is wrong size (%ld)\n", myHist->bounds->n);
-            testStatus = false;
-        }
-
-        for (i=0;i<numBins;i++) {
-            if (myHist->nums->data.F32[i] != 0.0) {
-                printf("ERROR: myHist->nums->data.F32[%d] not initialized to 0.\n", i);
-                testStatus = false;
-            }
-            myHist->nums->data.F32[i] = 0.0;
-        }
-
-        if (myHist->minNum != 0) {
-            printf("ERROR: myHist->minNum is %d\n", myHist->minNum);
-            testStatus = false;
-        }
-
-        if (myHist->maxNum != 0) {
-            printf("myHist->maxNum is %d\n", myHist->maxNum);
-            testStatus = false;
-        }
-
-        if (myHist->uniform != false) {
-            printf("ERROR: myHist->uniform is %d\n", myHist->uniform);
-            testStatus = false;
-        }
-
-        myHist = psVectorHistogram( myHist, myData, NULL, NULL, 0 );
-        for (i=0;i<numBins;i++) {
-            printf("Bin number %d bounds: (%6.3f - %6.3f): data: (%f)\n", i,
-                   myHist->bounds->data.F32[i],
-                   myHist->bounds->data.F32[i+1],
-                   myHist->nums->data.F32[i]);
-        }
-
-        psMemCheckCorruption(1);
-        psFree(myHist);
-        psMemCheckCorruption(1);
-        psFree(myBounds);
-
-        printFooter(stdout,
-                    "psStats functions",
-                    "Allocate the psHistogram structure.",
-                    testStatus);
-    }
-    /*************************************************************************/
-    /*  Deallocate data structures                                           */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "Deallocate the psHistogram structure.");
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,NULL,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    psMemCheckCorruption(1);
-
-    printFooter(stdout,
-                "psStats functions",
-                "Deallocate the psHistogram structure.",
-                testStatus);
-
-    return (!testStatus);
-}
Index: trunk/psLib/test/math/tst_psMathUtils.c
===================================================================
--- trunk/psLib/test/math/tst_psMathUtils.c	(revision 42336)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/*****************************************************************************
-This routine contains code which tests the general math utility functions.
- *****************************************************************************/
-#include <stdio.h>
-#include <math.h>
-#include "pslib.h"
-#include "psTest.h"
-#define NUM_DATA 10
-#define VERBOSE 0
-#define TS00_X_F32  0x00000001
-#define TS00_X_F64  0x00000002
-#define TS00_X_NULL  0x00000004
-#define TS00_DOMAIN_F32  0x00000008
-#define TS00_DOMAIN_F64  0x00000010
-#define TS00_DOMAIN_NULL 0x00000020
-#define TS00_RANGE_F32  0x00000040
-#define TS00_RANGE_F64  0x00000080
-#define TS00_RANGE_NULL  0x00000200
-
-psS32 genericInterpolateTest(
-    psU32 flags,
-    psS32 order,
-    psS32 numData,
-    psF64 xValue,
-    psBool expectedRC)
-{
-    psS32 currentId = psMemGetId();
-    psS32 testStatus = true;
-    psS32 memLeaks = 0;
-    psScalar *x = NULL;
-    psVector *domain = NULL;
-    psVector *range = NULL;
-    psScalar *out = NULL;
-
-    printPositiveTestHeader(stdout, "psMathUtils functions", "1D Interpolation routines");
-
-    if (expectedRC == false) {
-        printf("This test should generate an error message, and return NULL.\n");
-    }
-
-    if (flags & TS00_X_NULL) {
-        printf(" using a NULL x scalar\n");
-    }
-
-    if (flags & TS00_X_F32) {
-        printf(" using a psF32 x scalar\n");
-        x = psScalarAlloc((psF32) xValue, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_X_F64) {
-        printf(" using a psF64 x scalar\n");
-        x = psScalarAlloc((psF64) xValue, PS_TYPE_F64);
-    }
-
-    if (flags & TS00_DOMAIN_NULL) {
-        printf(" using a NULL domain vector\n");
-    }
-
-    if (flags & TS00_DOMAIN_F32) {
-        printf(" using a psF32 domain vector\n");
-        domain = psVectorAlloc(numData, PS_TYPE_F32);
-        for (psS32 i=0;i<numData;i++) {
-            domain->data.F32[i] = (psF32) i;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original domain data %d: (%.1f)\n", i, domain->data.F32[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_DOMAIN_F64) {
-        printf(" using a psF64 domain vector\n");
-        domain = psVectorAlloc(numData, PS_TYPE_F64);
-        for (psS64 i=0;i<numData;i++) {
-            domain->data.F64[i] = (psF64) i;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original domain data %d: (%.1f)\n", i, domain->data.F64[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_RANGE_NULL) {
-        printf(" using a NULL range vector\n");
-    }
-
-    if (flags & TS00_RANGE_F32) {
-        printf(" using a psF32 range vector\n");
-        range = psVectorAlloc(numData, PS_TYPE_F32);
-        for (psS32 i=0;i<numData;i++) {
-            range->data.F32[i] = (psF32) 2*i;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original range data %d: (%.1f)\n", i, range->data.F32[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_RANGE_F64) {
-        printf(" using a psF64 range vector\n");
-        range = psVectorAlloc(numData, PS_TYPE_F64);
-        for (psS64 i=0;i<numData;i++) {
-            range->data.F64[i] = (psF64) 2*i;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original range data %d: (%.1f)\n", i, range->data.F64[i]);
-            }
-        }
-    }
-
-
-    out = p_psVectorInterpolate(NULL, domain, range, order, x);
-
-    if (out == NULL) {
-        if (expectedRC == true) {
-            printf("TEST ERROR: the p_psVectorInterpolate function returned NULL.\n");
-            testStatus = false;
-        }
-    } else {
-        if (expectedRC == false) {
-            printf("TEST ERROR: the p_psVectorInterpolate function returned non-NULL.\n");
-            testStatus = false;
-        }
-
-        if (flags & TS00_X_F32) {
-            printf("The interpolated value was %.2f: should be %.2f\n", out->data.F32, 2.0 * x->data.F32);
-        } else if (flags & TS00_X_F64) {
-            printf("The interpolated value was %.2f: should be %.2f\n", out->data.F64, 2.0 * x->data.F64);
-        }
-
-        /*
-        if (0) {
-                if (flags & TS00_F_F32) {
-                    expectData = f->data.F32[i];
-                } else if (flags & TS00_F_F64) {
-                    expectData = (psF32) f->data.F64[i];
-                } else if (flags & TS00_F_S32) {
-                    expectData = (psF32) f->data.S32[i];
-                }
-         
-                    if (flags & TS00_X_F32) {
-                        xData = x->data.F32[i];
-                    } else if (flags & TS00_X_F64) {
-                        xData = (psF32) x->data.F64[i];
-                    } else if (flags & TS00_X_S32) {
-                        xData = (psF32) x->data.S32[i];
-                    } else if (flags & TS00_X_NULL) {
-                        if (flags & TS00_POLY_ORD) {
-                            xData = (psF32) i;
-                        } else if (flags & TS00_POLY_CHEB) {
-                            xData = ((2.0 / ((psF32) (numData - 1))) * ((psF32) i)) - 1.0;
-                        }
-                    }
-         
-                    psF32 actualData = psPolynomial1DEval(myPoly, xData);
-         
-                    if (fabs(actualData-expectData) > fabs(ERROR_TOLERANCE * expectData)) {
-                        printf("TEST ERROR: Fitted data %d: (%.1f %.1f), expected was (%.1f)\n",
-                               i, xData, actualData, expectData);
-                        testStatus = false;
-                     } else {
-                        if (VERBOSE) {
-                            printf("GOOD: Fitted data %d: (%.1f %.1f), expected was (%.1f)\n",
-                                     i, xData, actualData, expectData);
-                        }
-                    }
-                }
-        }
-        */
-    }
-
-    psMemCheckCorruption(1);
-    psFree(x);
-    psFree(out);
-    psFree(domain);
-    psFree(range);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout, "psMinimize functions", "1D Interpolation routines", testStatus);
-
-    return (testStatus);
-}
-
-/*****************************************************************************
-We test a variety of 
- *****************************************************************************/
-psS32 main()
-{
-    psBool testStatus = true;
-    psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    printPositiveTestHeader(stdout, "psMathUtils functions: 1D Interpolation routines", "");
-
-    //
-    // F32 tests:
-    //
-    // All Vectors non-NULL
-
-    testStatus &= genericInterpolateTest(TS00_X_F32 | TS00_DOMAIN_F32 | TS00_RANGE_F32, 5, NUM_DATA, 5.5, true);
-
-    printFooter(stdout, "psMinimize functions: 1D Polynomial Fitting Functions", "", testStatus);
-}
Index: trunk/psLib/test/math/tst_psMatrix01.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrix01.c	(revision 42336)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/** @file  tst_psMatrix_01.c
-*
-*  @brief Test driver for psMatrix transpose function
-*
-*  This test driver contains the following tests for psMatrix test point 1:
-*     A)  Create input and output images
-*     B)  Transpose input image into output image
-*     C)  Transpose input image into auto allocated NULL output image
-*     D)  Free images and check for leaks
-*
-*  @author  Ross Harman, MHPCC
-*
-*  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2005-08-24 01:24:24 $
-*
-*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
-*
-*/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define TOLERANCE 0.000001
-
-#define CHECK_MATRIX(IMAGE)                                                                                  \
-for(psU32 i=0; i<IMAGE->numRows; i++) {                                                                  \
-    for(psU32 j=0; j<IMAGE->numCols; j++) {                                                              \
-        if(IMAGE->type.type == PS_TYPE_F64) {                                                            \
-            if(fabs(IMAGE->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
-                printf("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,                 \
-                       IMAGE->data.F64[i][j], truthMatrix[i][j]);                                        \
-            }                                                                                            \
-        } else if(IMAGE->type.type == PS_TYPE_F32){                                                      \
-            if(fabs(IMAGE->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
-                printf("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,                  \
-                       IMAGE->data.F32[i][j], truthMatrix[i][j]);                                        \
-            }                                                                                            \
-        }                                                                                                \
-    }                                                                                                    \
-}
-
-
-psS32 main( psS32 argc, char* argv[] )
-{
-    psLogSetFormat("HLNM");
-    psImage * tempImage = NULL;
-
-    double truthMatrix[3][3] = {{1, 4, 7},
-                                {2, 5, 8},
-                                {3, 6, 9}};
-
-    // Test A - Create input and output images
-    printPositiveTestHeader(stdout, "psMatrix", "Create input and output images");
-    psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
-    psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
-    inImage->data.F64[0][0] = 1;
-    inImage->data.F64[0][1] = 2;
-    inImage->data.F64[0][2] = 3;
-    inImage->data.F64[1][0] = 4;
-    inImage->data.F64[1][1] = 5;
-    inImage->data.F64[1][2] = 6;
-    inImage->data.F64[2][0] = 7;
-    inImage->data.F64[2][1] = 8;
-    inImage->data.F64[2][2] = 9;
-    psImage *inImageF32 = (psImage*)psImageAlloc(3, 3, PS_TYPE_F32);
-    psImage *outImageF32 = (psImage*)psImageAlloc(3, 3, PS_TYPE_F32);
-    inImageF32->data.F32[0][0] = 1;
-    inImageF32->data.F32[0][1] = 2;
-    inImageF32->data.F32[0][2] = 3;
-    inImageF32->data.F32[1][0] = 4;
-    inImageF32->data.F32[1][1] = 5;
-    inImageF32->data.F32[1][2] = 6;
-    inImageF32->data.F32[2][0] = 7;
-    inImageF32->data.F32[2][1] = 8;
-    inImageF32->data.F32[2][2] = 9;
-    printFooter(stdout, "psMatrix", "Create input and output images", true);
-
-
-    // Test B - Transpose input image into output image
-    printPositiveTestHeader(stdout, "psMatrix", "Transpose input image into output image");
-    tempImage = outImage;
-    outImage = psMatrixTranspose(outImage, inImage);
-    CHECK_MATRIX(outImage);
-    if (outImage->type.dimen != PS_DIMEN_IMAGE) {
-        printf( "Error: Resulting image is not PS_DIMEN_IMAGE\n");
-    } else if (outImage != tempImage) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
-    }
-
-    tempImage = outImageF32;
-    outImageF32 = psMatrixTranspose(outImageF32, inImageF32);
-    CHECK_MATRIX(outImageF32);
-    if (outImageF32->type.dimen != PS_DIMEN_IMAGE) {
-        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
-    } else if (outImageF32 != tempImage) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
-    }
-    printFooter(stdout, "psMatrix", "Transpose input image into output image", true);
-
-
-    // Test C - Transpose input image into auto allocated NULL output image
-    printPositiveTestHeader(stdout, "psMatrix", "Transpose input image into auto allocated NULL output image");
-    psImage *outImageNull = NULL;
-    outImageNull = psMatrixTranspose(outImageNull, inImage);
-    CHECK_MATRIX(outImageNull);
-
-    psImage *outImageNullF32 = NULL;
-    outImageNullF32 = psMatrixTranspose(outImageNullF32, inImageF32);
-    CHECK_MATRIX(outImageNullF32);
-    printFooter(stdout, "psMatrix", "Transpose input image into auto allocated NULL output image", true);
-
-
-    // Test D - Free images and check for leaks
-    printPositiveTestHeader(stdout, "psMatrix", "Free images and check for leaks");
-    psFree(inImage);
-    psFree(outImage);
-    psFree(outImageNull);
-    psFree(inImageF32);
-    psFree(outImageF32);
-    psFree(outImageNullF32);
-    psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout, false);
-    if (nLeaks != 0) {
-        printf("ERROR: Found %d memory leaks\n", nLeaks);
-    }
-    psS32 nBad = psMemCheckCorruption(0);
-    if (nBad) {
-        printf("ERROR: Found %d bad memory blocks\n", nBad);
-    }
-    printFooter(stdout, "psMatrix" , "Free images and check for leaks", true);
-
-    return 0;
-}
Index: trunk/psLib/test/math/tst_psMatrix02.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrix02.c	(revision 42336)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/** @file  tst_psMatrix_02.c
- *
- *  @brief Test driver for negative tests for psMatrix transpose function
- *
- *  This test driver contains the following tests for psMatrix test point 2:
- *     A)  Input pointer same as output pointer
- *     B)  Null input psImage
- *     C)  Incorrect type for input pointer
- *     D)  Incorrect type for output pointer
- *     E)  Matrix not square for output pointer
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-08-24 01:24:24 $
- *
- *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-psS32 main(psS32 argc,
-           char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psImage *nullImage = NULL;
-    psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
-    psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
-    psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_C32);
-    psImage *badImage2 = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64);
-
-    // Test A - Input pointer same as output pointer
-    printPositiveTestHeader(stdout,"psMatrix", "Input pointer same as output pointer");
-    psMemIncrRefCounter(inImage);
-    if (psMatrixTranspose(inImage, inImage) != NULL) {
-        psError(PS_ERR_UNKNOWN, true,
-                "inImage = outImage didn't results in NULL return");
-        return 1;
-    }
-    if (psMemGetRefCounter(inImage) != 1) {
-        psError(PS_ERR_UNKNOWN, true,
-                "the output image was not freed on an error.");
-        return 2;
-    }
-    printFooter(stdout, "psMatrix", "Input pointer same as output pointer", true);
-
-    // Test B - Null input psImage
-    printPositiveTestHeader(stdout,"psMatrix", "Null input psImage");
-    psMemIncrRefCounter(outImage);
-    if (psMatrixTranspose(outImage, nullImage) != NULL) {
-        psError(PS_ERR_UNKNOWN, true,
-                "inImage = outImage didn't results in NULL return");
-        return 3;
-    }
-    if (psMemGetRefCounter(outImage) != 1) {
-        psError(PS_ERR_UNKNOWN, true,
-                "the output image was not freed on an error.");
-        return 4;
-    }
-    printFooter(stdout, "psMatrix", "Null input psImage", true);
-
-    // Test C - Incorrect type for input pointer
-    printPositiveTestHeader(stdout,"psMatrix", "Incorrect type for input pointer");
-    psMemIncrRefCounter(outImage);
-    if (psMatrixTranspose(outImage, badImage1) != NULL) {
-        psError(PS_ERR_UNKNOWN, true,
-                "inImage = outImage didn't results in NULL return");
-        return 5;
-    }
-    if (psMemGetRefCounter(outImage) != 1) {
-        psError(PS_ERR_UNKNOWN, true,
-                "the output image was not freed on an error.");
-        return 6;
-    }
-    printFooter(stdout, "psMatrix", "Incorrect type for input pointer", true);
-
-    // Test D - Incorrect type for output pointer
-    printPositiveTestHeader(stdout,"psMatrix", "Incorrect type for output pointer");
-    badImage1 = psMatrixTranspose(badImage1, inImage);
-    if (badImage1 == NULL) {
-        psError(PS_ERR_UNKNOWN, true,
-                "inImage = outImage didn't results in NULL return");
-        return 7;
-    }
-    // check that the type was changed.
-    if (badImage1->type.type != PS_TYPE_F64) {
-        psError(PS_ERR_UNKNOWN, true,
-                "the output image was not freed on an error.");
-        return 8;
-    }
-    printFooter(stdout, "psMatrix", "Incorrect type for output pointer", true);
-
-    // Test E - Matrix not square for output pointer
-    printPositiveTestHeader(stdout,"psMatrix", "Matrix not square for output pointer");
-    psMatrixTranspose(badImage2, inImage);
-    printFooter(stdout, "psMatrix", "Matrix not square for output pointer", true);
-
-    return 0;
-}
Index: trunk/psLib/test/math/tst_psMatrix04.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrix04.c	(revision 42336)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/** @file  tst_psMatrix_04.c
- *
- *  @brief Test driver for psMatrix invert function
- *
- *  This test driver contains the following tests for psMatrix test point 4:
- *     A)  Create input and output images
- *     B)  Invert matrix and calculate determinant
- *     C)  Calculate determinant only
- *     D)  Free input and output images
- *     E)  Attempt to use null input image argument
- *     F)  Attempt to use null input float argument
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-08-24 01:24:24 $
- *
- *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-
-#define TOLERANCE 0.000001
-
-#define CHECK_MATRIX(IMAGE)                                                                                  \
-for(psU32 i=0; i<IMAGE->numRows; i++) {                                                                  \
-    for(psU32 j=0; j<IMAGE->numCols; j++) {                                                              \
-        if(IMAGE->type.type == PS_TYPE_F64) {                                                            \
-            if(fabs(IMAGE->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
-                printf("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,                 \
-                       IMAGE->data.F64[i][j], truthMatrix[i][j]);                                        \
-            }                                                                                            \
-        } else if(IMAGE->type.type == PS_TYPE_F32){                                                      \
-            if(fabs(IMAGE->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
-                printf("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,                  \
-                       IMAGE->data.F32[i][j], truthMatrix[i][j]);                                        \
-            }                                                                                            \
-        }                                                                                                \
-    }                                                                                                    \
-}
-
-#define CHECK_VALUE(VALUE)                                                                                   \
-if(fabs(VALUE-truthValue) > TOLERANCE) {                                                                     \
-    printf("Values don't agree %lf vs %lf\n", VALUE, truthValue);                                            \
-}
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    float det = 0.0f;
-    float det2 = 0;
-    psImage *outImage = NULL;
-    psImage *inImage = NULL;
-    psImage *tempImage = NULL;
-    psImage *outImage32 = NULL;
-    psImage *inImage32 = NULL;
-    psImage *tempImage32 = NULL;
-
-    double truthMatrix[3][3] = {{4.0000000, -4.333333, -2.333333},
-                                {-1.000000,  1.666667,  0.666667},
-                                {-1.000000,  0.666667,  0.666667}};
-    double truthValue = 3.0;
-
-
-    // Test A - Create input and output images
-    printPositiveTestHeader(stdout, "psMatrix", "Create input and output images");
-    outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
-    inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
-    inImage->data.F64[0][0] =  2;
-    inImage->data.F64[0][1] =  4;
-    inImage->data.F64[0][2] =  3;
-    inImage->data.F64[1][0] =  0;
-    inImage->data.F64[1][1] =  1;
-    inImage->data.F64[1][2] = -1;
-    inImage->data.F64[2][0] =  3;
-    inImage->data.F64[2][1] =  5;
-    inImage->data.F64[2][2] =  7;
-
-    outImage32 = (psImage*)psImageAlloc(3, 3, PS_TYPE_F32);
-    inImage32 = (psImage*)psImageAlloc(3, 3, PS_TYPE_F32);
-    inImage32->data.F32[0][0] =  2;
-    inImage32->data.F32[0][1] =  4;
-    inImage32->data.F32[0][2] =  3;
-    inImage32->data.F32[1][0] =  0;
-    inImage32->data.F32[1][1] =  1;
-    inImage32->data.F32[1][2] = -1;
-    inImage32->data.F32[2][0] =  3;
-    inImage32->data.F32[2][1] =  5;
-    inImage32->data.F32[2][2] =  7;
-    printFooter(stdout, "psMatrix", "Create input and output images", true);
-
-
-    // Test B - Invert matrix and calculate determinant
-    printPositiveTestHeader(stdout, "psMatrix", "Invert matrix and calculate determinant");
-    tempImage = outImage;
-    outImage = psMatrixInvert(outImage, inImage, &det);
-    CHECK_MATRIX(outImage);
-    CHECK_VALUE(det);
-    if(outImage->type.dimen != PS_DIMEN_IMAGE) {
-        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
-    } else if(outImage != tempImage) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
-    }
-    det = 0.0f;
-    tempImage32 = outImage32;
-    outImage32 = psMatrixInvert(outImage32, inImage32, &det);
-    CHECK_MATRIX(outImage32);
-    CHECK_VALUE(det);
-    if(outImage32->type.dimen != PS_DIMEN_IMAGE) {
-        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
-    } else if(outImage32 != tempImage32) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
-    }
-    printFooter(stdout, "psMatrix", "Invert matrix and calculate determinant", true);
-
-
-    // Test C - Calculate determinant only
-    printPositiveTestHeader(stdout, "psMatrix", "Calculate determinant only");
-    det2 = psMatrixDeterminant(inImage);
-    CHECK_VALUE(det2);
-    det2 = psMatrixDeterminant(inImage32);
-    CHECK_VALUE(det2);
-    printFooter(stdout, "psMatrix", "Calculate determinant only", true);
-
-
-    // Test D - Free input and output images
-    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images");
-    psFree(outImage);
-    psFree(inImage);
-    psFree(outImage32);
-    psFree(inImage32);
-    if(psMemCheckLeaks(0, NULL, stdout, false) != 0 ) {
-        psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");
-        return 10;
-    }
-    psS32 nBad = psMemCheckCorruption(0);
-    if(nBad) {
-        printf("ERROR: Found %d bad memory blocks\n", nBad);
-    }
-    printFooter(stdout, "psMatrix" ,"Free input and output images", true);
-
-
-    // Test E - Attempt to use null input image argument
-    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input image argument",
-                            "Invalid operation: inImage or its data is NULL.", 0);
-    psImage *badOutImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
-    psMatrixInvert(badOutImage, NULL, &det);
-    printFooter(stdout, "psMatrix", "Attempt to use null input image argument", true);
-
-
-    // Test F - Attempt to use null input float argument
-    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input float argument",
-                            "Invalid operation: determinant argument is NULL.", 0);
-    psImage *badInImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
-    psMatrixInvert(badOutImage, badInImage, NULL);
-    printFooter(stdout, "psMatrix", "Attempt to use null input float argument", true);
-
-    return 0;
-}
Index: trunk/psLib/test/math/tst_psMatrix05.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrix05.c	(revision 42336)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/** @file  tst_psMatrix_05.c
-*
-*  @brief Test driver for psMatrix multiplication function
-*
-*  This test driver contains the following tests for psMatrix test point 5:
-*     A)  Create input and output images
-*     B)  Multiply images
-*     C)  Free input and output images
-*
-*  @author  Ross Harman, MHPCC
-*
-*  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2005-08-24 01:24:24 $
-*
-*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
-*
-*/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define TOLERANCE 0.000001
-
-#define CHECK_MATRIX(IMAGE)                                                                                  \
-for(psU32 i=0; i<IMAGE->numRows; i++) {                                                                  \
-    for(psU32 j=0; j<IMAGE->numCols; j++) {                                                              \
-        if(IMAGE->type.type == PS_TYPE_F64) {                                                            \
-            if(fabs(IMAGE->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
-                printf("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,                 \
-                       IMAGE->data.F64[i][j], truthMatrix[i][j]);                                        \
-            }                                                                                            \
-        } else if(IMAGE->type.type == PS_TYPE_F32){                                                      \
-            if(fabs(IMAGE->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
-                printf("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,                  \
-                       IMAGE->data.F32[i][j], truthMatrix[i][j]);                                        \
-            }                                                                                            \
-        }                                                                                                \
-    }                                                                                                    \
-}
-
-
-psS32 main( psS32 argc,
-            char* argv[] )
-{
-    psLogSetFormat("HLNM");
-    psImage * outImage = NULL;
-    psImage *inImage1 = NULL;
-    psImage *inImage2 = NULL;
-    psImage * outImage32 = NULL;
-    psImage *inImage132 = NULL;
-    psImage *inImage232 = NULL;
-
-    double truthMatrix[3][3] = {{  0.0, 52.0},
-                                {-14.0, 51.0}};
-
-    // Test A - Create input and output images
-    printPositiveTestHeader(stdout, "psMatrix", "Create input and output images");
-    outImage = (psImage*) psImageAlloc(2, 2, PS_TYPE_F64);
-    inImage1 = (psImage*) psImageAlloc(3, 2, PS_TYPE_F64);
-    inImage2 = (psImage*) psImageAlloc(2, 3, PS_TYPE_F64);
-    inImage1->data.F64[0][0] = 2;
-    inImage1->data.F64[0][1] = 3;
-    inImage1->data.F64[0][2] = 4;
-    inImage1->data.F64[1][0] = -1;
-    inImage1->data.F64[1][1] = 2;
-    inImage1->data.F64[1][2] = 5;
-    inImage2->data.F64[0][0] = 4;
-    inImage2->data.F64[0][1] = 1;
-    inImage2->data.F64[1][0] = 0;
-    inImage2->data.F64[1][1] = 6;
-    inImage2->data.F64[2][0] = -2;
-    inImage2->data.F64[2][1] = 8;
-    outImage32 = (psImage*)psImageAlloc(2, 2, PS_TYPE_F32);
-    inImage132 = (psImage*)psImageAlloc(3, 2, PS_TYPE_F32);
-    inImage232 = (psImage*)psImageAlloc(2, 3, PS_TYPE_F32);
-    inImage132->data.F32[0][0] = 2;
-    inImage132->data.F32[0][1] = 3;
-    inImage132->data.F32[0][2] = 4;
-    inImage132->data.F32[1][0] = -1;
-    inImage132->data.F32[1][1] = 2;
-    inImage132->data.F32[1][2] = 5;
-    inImage232->data.F32[0][0] = 4;
-    inImage232->data.F32[0][1] = 1;
-    inImage232->data.F32[1][0] = 0;
-    inImage232->data.F32[1][1] = 6;
-    inImage232->data.F32[2][0] = -2;
-    inImage232->data.F32[2][1] = 8;
-    printFooter( stdout, "psMatrix", "Create input and output images", true );
-
-
-    // Test B - Multiply images
-    printPositiveTestHeader(stdout, "psMatrix", "Multiply images");
-    psMatrixMultiply(outImage, inImage1, inImage2);
-    CHECK_MATRIX(outImage);
-    psMatrixMultiply(outImage32, inImage132, inImage232);
-    CHECK_MATRIX(outImage32);
-    printFooter(stdout, "psMatrix", "Multiply images", true);
-
-
-    // Test C - Free input and output images
-    printPositiveTestHeader( stdout, "psMatrix", "Free input and output images" );
-    psFree(outImage);
-    psFree(inImage1);
-    psFree(inImage2);
-    psFree(outImage32);
-    psFree(inImage132);
-    psFree(inImage232);
-    psS32 nLeaks = psMemCheckLeaks( 0, NULL, stdout, false );
-    if ( nLeaks != 0 ) {
-        printf( "ERROR: Found %d memory leaks\n", nLeaks );
-    }
-    psS32 nBad = psMemCheckCorruption( 0 );
-    if ( nBad ) {
-        printf( "ERROR: Found %d bad memory blocks\n", nBad );
-    }
-    printFooter( stdout, "psMatrix" , "Free input and output images", true );
-
-    return 0;
-}
Index: trunk/psLib/test/math/tst_psMatrix06.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrix06.c	(revision 42336)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/** @file  tst_psMatrix_06.c
-*
-*  @brief Test driver for psMatrix Eigenvectors function
-*
-*  This test driver contains the following tests for psMatrix test point 6:
-*     A)  Create input and output images
-*     B)  Calculate Eigenvectors
-*     C)  Free input and output images
-*
-*  @author  Ross Harman, MHPCC
-*
-*  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2005-08-24 01:24:24 $
-*
-*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
-*
-*/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define TOLERANCE 0.000001
-
-#define CHECK_MATRIX(IMAGE)                                                                                  \
-for(psU32 i=0; i<IMAGE->numRows; i++) {                                                                  \
-    for(psU32 j=0; j<IMAGE->numCols; j++) {                                                              \
-        if(IMAGE->type.type == PS_TYPE_F64) {                                                            \
-            if(fabs(IMAGE->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
-                printf("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,                 \
-                       IMAGE->data.F64[i][j], truthMatrix[i][j]);                                        \
-            }                                                                                            \
-        } else if(IMAGE->type.type == PS_TYPE_F32){                                                      \
-            if(fabs(IMAGE->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
-                printf("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,                  \
-                       IMAGE->data.F32[i][j], truthMatrix[i][j]);                                        \
-            }                                                                                            \
-        }                                                                                                \
-    }                                                                                                    \
-}
-
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psImage * outImage = NULL;
-    psImage *inImage = NULL;
-    psImage * outImage32 = NULL;
-    psImage *inImage32 = NULL;
-
-    double truthMatrix[4][4] = {{0.792608,  0.582076, -0.179186, -0.029193},
-                                {0.451923, -0.370502,  0.741918,  0.328712},
-                                {0.322416, -0.509579, -0.100228, -0.791411},
-                                {0.252161, -0.514048, -0.638283,  0.514553}};
-
-
-    // Test A - Create input and output images
-    printPositiveTestHeader( stdout, "psMatrix", "Create input and output images" );
-    outImage = (psImage*) psImageAlloc(4, 4, PS_TYPE_F64);
-    inImage = (psImage*)  psImageAlloc(4, 4, PS_TYPE_F64);
-
-    inImage->data.F64[0][0] = 1./1.;
-    inImage->data.F64[0][1] = 1./2.;
-    inImage->data.F64[0][2] = 1./3.;
-    inImage->data.F64[0][3] = 1./4.;
-    inImage->data.F64[1][0] = 1./2.;
-    inImage->data.F64[1][1] = 1./3.;
-    inImage->data.F64[1][2] = 1./4.;
-    inImage->data.F64[1][3] = 1./5.;
-    inImage->data.F64[2][0] = 1./3.;
-    inImage->data.F64[2][1] = 1./4.;
-    inImage->data.F64[2][2] = 1./5.;
-    inImage->data.F64[2][3] = 1./6.;
-    inImage->data.F64[3][0] = 1./4.;
-    inImage->data.F64[3][1] = 1./5.;
-    inImage->data.F64[3][2] = 1./6.;
-    inImage->data.F64[3][3] = 1./7.;
-
-    outImage32 = (psImage*) psImageAlloc(4, 4, PS_TYPE_F32);
-    inImage32 = (psImage*)  psImageAlloc(4, 4, PS_TYPE_F32);
-    inImage32->data.F32[0][0] = 1./1.;
-    inImage32->data.F32[0][1] = 1./2.;
-    inImage32->data.F32[0][2] = 1./3.;
-    inImage32->data.F32[0][3] = 1./4.;
-    inImage32->data.F32[1][0] = 1./2.;
-    inImage32->data.F32[1][1] = 1./3.;
-    inImage32->data.F32[1][2] = 1./4.;
-    inImage32->data.F32[1][3] = 1./5.;
-    inImage32->data.F32[2][0] = 1./3.;
-    inImage32->data.F32[2][1] = 1./4.;
-    inImage32->data.F32[2][2] = 1./5.;
-    inImage32->data.F32[2][3] = 1./6.;
-    inImage32->data.F32[3][0] = 1./4.;
-    inImage32->data.F32[3][1] = 1./5.;
-    inImage32->data.F32[3][2] = 1./6.;
-    inImage32->data.F32[3][3] = 1./7.;
-    printFooter(stdout, "psMatrix", "Create input and output images", true);
-
-
-    // Test B - Calculate Eigenvectors
-    printPositiveTestHeader(stdout, "psMatrix", "Calculate Eigenvectors");
-    psMatrixEigenvectors(outImage, inImage);
-    CHECK_MATRIX(outImage);
-    psMatrixEigenvectors(outImage32, inImage32);
-    CHECK_MATRIX(outImage32);
-    printFooter(stdout, "psMatrix", "Calculate Eigenvectors", true);
-
-
-    // Test C - Free input and output images
-    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images");
-    psFree(outImage);
-    psFree(inImage);
-    psFree(outImage32);
-    psFree(inImage32);
-    psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout, false);
-    if (nLeaks != 0) {
-        printf("ERROR: Found %d memory leaks\n", nLeaks);
-    }
-    psS32 nBad = psMemCheckCorruption(0);
-    if (nBad) {
-        printf("ERROR: Found %d bad memory blocks\n", nBad);
-    }
-    printFooter(stdout, "psMatrix" , "Free input and output images", true);
-
-    return 0;
-}
Index: trunk/psLib/test/math/tst_psMatrix07.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrix07.c	(revision 42336)
+++ 	(revision )
@@ -1,314 +1,0 @@
-/** @file  tst_psMatrix_07.c
- *
- *  @brief Test driver for psMatrix vector conversion functions
- *
- *  This test driver contains the following tests for psMatrix test point 7:
- *     A)  Create input and output images and vectors
- *     B)  Convert matrix to PS_DIMEN_VECTOR vector
- *     C)  Attempt to use null image input argument
- *     D)  Convert matrix to PS_DIMEN_TRANSV vector
- *     E)  Improper image size
- *     F)  Convert PS_DIMEN_VECTOR vector to matrix
- *     G)  Attempt to use null input vector argument
- *     H)  Convert PS_DIMEN_TRANSV vector to matrix
- *     I)  Free input and output images and vectors
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-08-24 01:24:24 $
- *
- *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-
-#define TOLERANCE 0.000001
-
-#define CHECK_MATRIX(IMAGE,TRUTH)                                                                        \
-for(psU32 i=0; i<IMAGE->numRows; i++) {                                                                  \
-    for(psU32 j=0; j<IMAGE->numCols; j++) {                                                              \
-        if(IMAGE->type.type == PS_TYPE_F64) {                                                            \
-            if(fabs(IMAGE->data.F64[i][j]-TRUTH[i][j]) > TOLERANCE) {                                    \
-                printf("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,                 \
-                       IMAGE->data.F64[i][j], TRUTH[i][j]);                                              \
-            }                                                                                            \
-        } else if(IMAGE->type.type == PS_TYPE_F32){                                                      \
-            if(fabs(IMAGE->data.F32[i][j]-TRUTH[i][j]) > TOLERANCE) {                                    \
-                printf("Matrix values at element %d, %d don't agree %f vs %f\n", i, j,                  \
-                       IMAGE->data.F32[i][j], TRUTH[i][j]);                                              \
-            }                                                                                            \
-        }                                                                                                \
-    }                                                                                                    \
-}
-
-#define CHECK_VECTOR(VECTOR)                                                                                 \
-for(psU32 i=0; i<VECTOR->n; i++) {                                                                       \
-    if(VECTOR->type.type == PS_TYPE_F64) {                                                               \
-        if(fabs(VECTOR->data.F64[i]-truthVector[i]) > TOLERANCE) {                                       \
-            printf("Vector values at element %d don't agree %lf vs %lf\n", i,                            \
-                   VECTOR->data.F64[i], truthVector[i]);                                                 \
-        }                                                                                                \
-    } else if(VECTOR->type.type == PS_TYPE_F32){                                                         \
-        if(fabs(VECTOR->data.F32[i]-truthVector_32[i]) > TOLERANCE) {                                       \
-            printf("Vector values at element %d don't agree %f vs %lf\n", i,                             \
-                   VECTOR->data.F32[i], truthVector[i]);                                                 \
-        }                                                                                                \
-    }                                                                                                    \
-}
-
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psVector *v1 = NULL;
-    psVector *v1_32 = NULL;
-    psVector *tempVector = NULL;
-    psVector *tempVector_32 = NULL;
-    psImage *tempImage = NULL;
-    psImage *tempImage_32 = NULL;
-    psImage *m1 = NULL;
-    psImage *m1_32 = NULL;
-    psVector *v2 = NULL;
-    psVector *v2_32 = NULL;
-    psVector *v3 = NULL;
-    psVector *v3_32 = NULL;
-    psImage *m2 = NULL;
-    psImage *m2_32 = NULL;
-    psImage *m3 = NULL;
-    psImage *m3_32 = NULL;
-    psImage *m4 = NULL;
-    psImage *m4_32 = NULL;
-    psImage *badImage = NULL;
-    psImage *badImage_32 = NULL;
-
-    psF64 truthVector[3] = {0.0, 1.0, 2.0};
-    psF32 truthVector_32[3] = {0.0, 1.0, 2.0};
-    psF64 truthMatrix[3][1] = {{0.0}, {1.0}, {2.0}};
-    psF32 truthMatrix_32[3][1] = {{0.0}, {1.0}, {2.0}};
-
-    // Test A - Create input and output images
-    printPositiveTestHeader(stdout, "psMatrix", "Create input and output images and vectors");
-    v1 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
-    v1_32 = (psVector*)psVectorAlloc(3, PS_TYPE_F32);
-    m1 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
-    m1_32 = (psImage*)psImageAlloc(1,3,PS_TYPE_F32);
-    v2 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
-    v2_32 = (psVector*)psVectorAlloc(3,PS_TYPE_F32);
-    m2 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
-    m2_32 = (psImage*)psImageAlloc(1,3,PS_TYPE_F32);
-    m3 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
-    m3_32 = (psImage*)psImageAlloc(3,1,PS_TYPE_F32);
-    m4 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
-    m4_32 = (psImage*)psImageAlloc(3,1,PS_TYPE_F32);
-    badImage = (psImage*)psImageAlloc(2, 2, PS_TYPE_F64);
-    badImage_32 = (psImage*)psImageAlloc(2,2,PS_TYPE_F32);
-    m1->data.F64[0][0] = 0.0;
-    m1->data.F64[1][0] = 1.0;
-    m1->data.F64[2][0] = 2.0;
-    m1_32->data.F32[0][0] = 0.0;
-    m1_32->data.F32[1][0] = 1.0;
-    m1_32->data.F32[2][0] = 2.0;
-    v2->data.F64[0] = 0.0;
-    v2->data.F64[1] = 1.0;
-    v2->data.F64[2] = 2.0;
-    v2->n = 3;
-    v2_32->data.F32[0] = 0.0;
-    v2_32->data.F32[1] = 1.0;
-    v2_32->data.F32[2] = 2.0;
-    v2_32->n = 3;
-    m4->data.F64[0][0] = 0.0;
-    m4->data.F64[0][1] = 1.0;
-    m4->data.F64[0][2] = 2.0;
-    m4_32->data.F32[0][0] = 0.0;
-    m4_32->data.F32[0][1] = 1.0;
-    m4_32->data.F32[0][2] = 2.0;
-    printFooter(stdout, "psMatrix", "Create input and output images and vectors", true);
-
-    // Test B - Convert matrix to PS_DIMEN_VECTOR vector
-    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector");
-    tempVector = v1;
-    v1 = psMatrixToVector(v1, m1);
-    CHECK_VECTOR(v1);
-    if(v1->type.dimen != PS_DIMEN_VECTOR) {
-        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_VECTOR");
-        return 1;
-    } else if(v1 != tempVector) {
-        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
-        return 2;
-    }
-    tempVector_32 = v1_32;
-    v1_32 = psMatrixToVector(v1_32, m1_32);
-    CHECK_VECTOR(v1_32);
-    if(v1_32->type.dimen != PS_DIMEN_VECTOR) {
-        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_VECTOR");
-        return 1;
-    } else if(v1_32 != tempVector_32) {
-        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
-        return 2;
-    }
-    printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector", true);
-
-
-    // Test C - Attempt to use null image input argument
-    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null image input argument",
-                            "Invalid operation: inImage or its data is NULL.", 0);
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error.");
-    v1 = psMatrixToVector(v1, NULL);
-    if(v1 != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with NULL input");
-        return 3;
-    }
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error.");
-    v1_32 = psMatrixToVector(v1_32, NULL);
-    if(v1_32 != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with NULL input");
-        return 3;
-    }
-    printFooter(stdout, "psMatrix", "Attempt to use null image input argument", true);
-
-
-    // Test D - Convert matrix to PS_DIMEN_TRANSV vector
-    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector");
-    v3 = psVectorAlloc(3, PS_TYPE_F64);
-    tempVector = v3;
-    v3->type.dimen = PS_DIMEN_TRANSV;
-    psMatrixToVector(v3, m4);
-    CHECK_VECTOR(v3);
-    if(v3->type.dimen != PS_DIMEN_TRANSV) {
-        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_TRANSV");
-        return 4;
-    } else if(v3 != tempVector) {
-        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
-        return 5;
-    }
-    v3_32 = psVectorAlloc(3, PS_TYPE_F32);
-    tempVector_32 = v3_32;
-    v3_32->type.dimen = PS_DIMEN_TRANSV;
-    psMatrixToVector(v3_32, m4_32);
-    CHECK_VECTOR(v3_32);
-    if(v3_32->type.dimen != PS_DIMEN_TRANSV) {
-        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_TRANSV");
-        return 6;
-    } else if(v3_32 != tempVector_32) {
-        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
-        return 7;
-    }
-    printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector", true);
-
-
-    // Test E - Improper image size
-    printNegativeTestHeader(stdout,"psMatrix", "Improper image size",
-                            "Image does not have dim with 1 col or 1 row: (2 x 2).", 0);
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
-    if(psMatrixToVector(v1, badImage) != NULL ) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with improper sizes");
-        return 8;
-    }
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
-    if(psMatrixToVector(v1_32, badImage_32) != NULL ) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return NULL with improper sizes");
-        return 9;
-    }
-    printFooter(stdout, "psMatrix", "Improper image size", true);
-
-
-    // Test F - Convert PS_DIMEN_VECTOR vector to matrix
-    printPositiveTestHeader(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix");
-    tempImage = m2;
-    m2 = psVectorToMatrix(m2, v2);
-    CHECK_MATRIX(m2,truthMatrix);
-    if(m2->type.dimen != PS_DIMEN_IMAGE) {
-        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_IMAGE");
-        return 10;
-    } else if(m2 != tempImage) {
-        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
-        return 11;
-    }
-    tempImage_32 = m2_32;
-    m2_32 = psVectorToMatrix(m2_32, v2_32);
-    CHECK_MATRIX(m2_32,truthMatrix_32);
-    if(m2_32->type.dimen != PS_DIMEN_IMAGE) {
-        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_IMAGE");
-        return 10;
-    } else if(m2_32 != tempImage_32) {
-        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
-        return 11;
-    }
-    printFooter(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix", true);
-
-
-    // Test G - Attempt to use null input vector argument
-    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input vector argument",
-                            "Invalid operation: inVector or its data is NULL.", 0);
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    if(psVectorToMatrix(m2, NULL) != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return output image");
-        return 12;
-    }
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    if(psVectorToMatrix(m2_32, NULL) != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return output image");
-        return 13;
-    }
-    printFooter(stdout, "psMatrix", "Attempt to use null input vector argument", true);
-
-
-    // Test H - Convert PS_DIMEN_TRANSV vector to matrix
-    printPositiveTestHeader(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix");
-    v2->type.dimen = PS_DIMEN_TRANSV;
-    tempImage = m3;
-    psVectorToMatrix(m3, v2);
-    CHECK_MATRIX(m3, truthMatrix);
-    if(m3->type.dimen != PS_DIMEN_IMAGE) {
-        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_IMAGE");
-        return 14;
-    } else if(m3 != tempImage) {
-        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
-        return 15;
-    }
-    v2_32->type.dimen = PS_DIMEN_TRANSV;
-    tempImage_32 = m3_32;
-    psVectorToMatrix(m3_32, v2_32);
-    CHECK_MATRIX(m3_32, truthMatrix_32);
-    if(m3_32->type.dimen != PS_DIMEN_IMAGE) {
-        psError(PS_ERR_UNKNOWN,true,"Resulting image is not PS_DIMEN_IMAGE");
-        return 16;
-    } else if(m3_32 != tempImage_32) {
-        psError(PS_ERR_UNKNOWN,true,"Return pointer not equal to output argument pointer");
-        return 17;
-    }
-    printFooter(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix", true);
-
-
-    // Test I - Free input and output images
-    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors");
-    psFree(m1);
-    psFree(v1);
-    psFree(v2);
-    psFree(v3);
-    psFree(m3);
-    psFree(m4);
-    psFree(m1_32);
-    psFree(v1_32);
-    psFree(v2_32);
-    psFree(v3_32);
-    psFree(m3_32);
-    psFree(m4_32);
-    psFree(badImage);
-    psFree(badImage_32);
-    if( psMemCheckLeaks(0, NULL, stdout, false) != 0) {
-        psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");
-        return 10;
-    }
-    psS32 nBad = psMemCheckCorruption(0);
-    if(nBad) {
-        printf("ERROR: Found %d bad memory blocks\n", nBad);
-    }
-    printFooter(stdout, "psMatrix" ,"Free input and output images and vectors", true);
-
-    return 0;
-}
Index: trunk/psLib/test/math/tst_psMatrixVectorArithmetic01.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrixVectorArithmetic01.c	(revision 42336)
+++ 	(revision )
@@ -1,206 +1,0 @@
-/** @file  tst_psMatrixVectorArithmetic01.c
- *
- *  @brief Test driver for psMatrixVector arithmetic functions
- *
- *  This test driver tests combinations of matrix, vector, and scalar binary operations including:
- *     Matrix-matrix with +,-,*,/ with S32, F32, F64, C32
- *     Matrix-vector with +,-,*,/ with S32, F32, F64, C32
- *     Matrix-scalar with +,-,*,/ with S32, F32, F64, C32
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-08-24 01:24:24 $
- *
- *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define PRINT_SCALAR(SCALAR,TYPE)                                                                            \
-if(PS_IS_PSELEMTYPE_COMPLEX(SCALAR->type.type)) {                                                        \
-    printf("%f+%fi ", creal(SCALAR->data.TYPE), cimag(SCALAR->data.TYPE));                               \
-} else if(PS_IS_PSELEMTYPE_INT(SCALAR->type.type)) {                                                     \
-    printf("%d ", (psS32)SCALAR->data.TYPE);                                                               \
-} else {                                                                                                 \
-    printf("%f ", (double)SCALAR->data.TYPE);                                                            \
-}                                                                                                        \
-printf("\n\n");
-
-#define PRINT_VECTOR(VECTOR,TYPE)                                                                            \
-for(psS32 i=0; i<VECTOR->n; i++) {                                                                         \
-    if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) {                                                    \
-        printf("%f+%fi ", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i]));                     \
-    } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) {                                                 \
-        printf("%d ", (psS32)VECTOR->data.TYPE[i]);                                                        \
-    } else {                                                                                             \
-        printf("%f ", (double)VECTOR->data.TYPE[i]);                                                     \
-    }                                                                                                    \
-}                                                                                                        \
-printf("\n\n");
-
-
-#define PRINT_MATRIX(IMAGE,TYPE)                                                                             \
-for(psS32 i=IMAGE->numRows-1; i>-1; i--) {                                                                 \
-    for(psS32 j=0; j<IMAGE->numCols; j++) {                                                                \
-        if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                 \
-            printf("%f+%fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j]));             \
-        } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                              \
-            printf("%d ", (psS32)IMAGE->data.TYPE[i][j]);                                                  \
-        } else {                                                                                         \
-            printf("%f ", (double)IMAGE->data.TYPE[i][j]);                                               \
-        }                                                                                                \
-    }                                                                                                    \
-    printf("\n");                                                                                        \
-}                                                                                                        \
-printf("\n");
-
-
-#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE)                                                          \
-psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE);                                         \
-for(psS32 i=0; i<SIZE; i++) {                                                                              \
-    NAME->data.TYPE[i] = VALUE;                                                                          \
-}                                                                                                        \
-NAME->n = SIZE;
-
-
-#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)                                                    \
-psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                      \
-for(psS32 i=0; i<NAME->numRows; i++) {                                                                     \
-    for(psS32 j=0; j<NAME->numCols; j++) {                                                                 \
-        NAME->data.TYPE[i][j] = VALUE;                                                                   \
-    }                                                                                                    \
-}
-
-
-#define CHECK_MEMORY                                                                                     \
-if(psMemCheckLeaks(0, NULL, stdout, false) != 0 ) {                                                             \
-    psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");                                                \
-    return 10;                                                                                            \
-}                                                                                                        \
-psS32 nBad = psMemCheckCorruption(0);                                                                    \
-if(nBad) {                                                                                               \
-    printf("ERROR: Found %d bad memory blocks\n", nBad);                                                 \
-}
-
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-
-    // Test matrix-matrix binary operations
-    #define testBinaryOpMM(OP,TYPE,VALUE1,VALUE2,NROWS,NCOLS)                                                \
-    {                                                                                                        \
-        printPositiveTestHeader(stdout, "psMatrixVectorArithmetic", "Test matrix-matrix psBinaryOp");        \
-        printf("Operation: %s\n", #OP);                                                                      \
-        CREATE_AND_SET_IMAGE(inImage,TYPE,VALUE1,NROWS,NCOLS);                                               \
-        CREATE_AND_SET_IMAGE(outImage,TYPE,VALUE2,NROWS,NCOLS);                                              \
-        printf("Input:\n");                                                                                  \
-        PRINT_MATRIX(inImage,TYPE);                                                                          \
-        PRINT_MATRIX(outImage,TYPE);                                                                         \
-        outImage = (psImage*)psBinaryOp(outImage, inImage, #OP, outImage);                                   \
-        printf("Output:\n");                                                                                 \
-        PRINT_MATRIX(outImage,TYPE);                                                                         \
-        psFree(inImage);                                                                                     \
-        psFree(outImage);                                                                                    \
-        CHECK_MEMORY;                                                                                        \
-        printFooter(stdout, "psMatrixVectorArithmetic", "Test matrix-matrix psBinaryOp", true);              \
-    }
-
-    testBinaryOpMM(+,S32,10,10,3,2);
-    testBinaryOpMM(+,F32,10.0,10.0,3,2);
-    testBinaryOpMM(+,F64,10.0,10.0,3,2);
-    testBinaryOpMM(+,C32,10.0+10.0i,10.0+10.0i,3,2);
-    testBinaryOpMM(-,S32,20,10,3,2);
-    testBinaryOpMM(-,F32,20.0,10.0,3,2);
-    testBinaryOpMM(-,F64,20.0,10.0,3,2);
-    testBinaryOpMM(*,C32,20.0+20.0i,10.0+10.0i,3,2);
-    testBinaryOpMM(*,S32,20,10,3,2);
-    testBinaryOpMM(*,F32,20.0,10.0,3,2);
-    testBinaryOpMM(*,F64,20.0,10.0,3,2);
-    testBinaryOpMM(*,C32,20.0+20.0i,10.0+10.0i,3,2);
-    testBinaryOpMM(/,C32,20.0+20.0i,10.0+10.0i,3,2);
-    testBinaryOpMM(/,S32,20,10,3,2);
-    testBinaryOpMM(/,F32,20.0,10.0,3,2);
-    testBinaryOpMM(/,F64,20.0,10.0,3,2);
-    testBinaryOpMM(/,C32,20.0+20.0i,10.0+10.0i,3,2);
-
-    // Test Matrix-Vector binary operations
-    #define testBinaryOpMV(OP,TYPE,VALUE1,VALUE2,NROWS,NCOLS)                                                \
-    {                                                                                                        \
-        printPositiveTestHeader(stdout, "psMatrixVectorArithmetic", "Test matrix-vector psBinaryOp");        \
-        printf("Operation: %s\n", #OP);                                                                      \
-        CREATE_AND_SET_IMAGE(outImage,TYPE,VALUE1,NROWS,NCOLS);                                              \
-        CREATE_AND_SET_VECTOR(inVector,TYPE,VALUE2,NROWS);                                                   \
-        printf("Input:\n");                                                                                  \
-        PRINT_MATRIX(outImage,TYPE);                                                                         \
-        PRINT_VECTOR(inVector,TYPE);                                                                         \
-        outImage = (psImage*)psBinaryOp(outImage, outImage, #OP, inVector);                                  \
-        printf("Output:\n");                                                                                 \
-        PRINT_MATRIX(outImage,TYPE);                                                                         \
-        psFree(inVector);                                                                                    \
-        psFree(outImage);                                                                                    \
-        CHECK_MEMORY;                                                                                        \
-        printFooter(stdout, "psMatrixVectorArithmetic", "Test matrix-vector psBinaryOp", true);              \
-    }
-
-    testBinaryOpMV(+,S32,10,5,3,2);
-    testBinaryOpMV(+,F32,10.0,5.0,3,2);
-    testBinaryOpMV(+,F64,10.0,5.0,3,2);
-    testBinaryOpMV(+,C32,10.0+10.0i,5.0+5.0i,3,2);
-    testBinaryOpMV(-,S32,20,5,3,2);
-    testBinaryOpMV(-,F32,20.0,5.0,3,2);
-    testBinaryOpMV(-,F64,20.0,5.0,3,2);
-    testBinaryOpMV(*,C32,20.0+20.0i,5.0+5.0i,3,2);
-    testBinaryOpMV(*,S32,20,5,3,2);
-    testBinaryOpMV(*,F32,20.0,5.0,3,2);
-    testBinaryOpMV(*,F64,20.0,5.0,3,2);
-    testBinaryOpMV(*,C32,20.0+20.0i,5.0+5.0i,3,2);
-    testBinaryOpMV(/,C32,20.0+20.0i,5.0+5.0i,3,2);
-    testBinaryOpMV(/,S32,20,5,3,2);
-    testBinaryOpMV(/,F32,20.0,5.0,3,2);
-    testBinaryOpMV(/,F64,20.0,5.0,3,2);
-    testBinaryOpMV(/,C32,20.0+20.0i,5.0+5.0i,3,2);
-
-    // Test Matrix-Scalar binary operations
-    #define testBinaryOpMS(OP,TYPE,VALUE1,VALUE2,NROWS,NCOLS)                                                \
-    {                                                                                                        \
-        printPositiveTestHeader(stdout, "psMatrixVectorArithmetic", "Test matrix-scalar psBinaryOp");        \
-        printf("Operation: %s\n", #OP);                                                                      \
-        CREATE_AND_SET_IMAGE(outImage,TYPE,VALUE1,NROWS,NCOLS);                                              \
-        psScalar *inScalar = (psScalar*)psScalarAlloc(VALUE2,PS_TYPE_##TYPE);                                \
-        printf("Input:\n");                                                                                  \
-        PRINT_MATRIX(outImage,TYPE);                                                                         \
-        PRINT_SCALAR(inScalar,TYPE);                                                                         \
-        outImage = (psImage*)psBinaryOp(outImage, outImage, #OP, psScalarCopy(inScalar));                    \
-        printf("Output:\n");                                                                                 \
-        PRINT_MATRIX(outImage,TYPE);                                                                         \
-        psFree(inScalar);                                                                                    \
-        psFree(outImage);                                                                                    \
-        CHECK_MEMORY;                                                                                        \
-        printFooter(stdout, "psMatrixVectorArithmetic", "Test matrix-scalar psBinaryOp", true);              \
-    }
-
-    testBinaryOpMS(+,S32,10,5,3,2);
-    testBinaryOpMS(+,F32,10.0,5.0,3,2);
-    testBinaryOpMS(+,F64,10.0,5.0,3,2);
-    testBinaryOpMS(+,C32,10.0+10.0i,5.0+5.0i,3,2);
-    testBinaryOpMS(-,S32,20,5,3,2);
-    testBinaryOpMS(-,F32,20.0,5.0,3,2);
-    testBinaryOpMS(-,F64,20.0,5.0,3,2);
-    testBinaryOpMS(*,C32,20.0+20.0i,5.0+5.0i,3,2);
-    testBinaryOpMS(*,S32,20,5,3,2);
-    testBinaryOpMS(*,F32,20.0,5.0,3,2);
-    testBinaryOpMS(*,F64,20.0,5.0,3,2);
-    testBinaryOpMS(*,C32,20.0+20.0i,5.0+5.0i,3,2);
-    testBinaryOpMS(/,C32,20.0+20.0i,5.0+5.0i,3,2);
-    testBinaryOpMS(/,S32,20,5,3,2);
-    testBinaryOpMS(/,F32,20.0,5.0,3,2);
-    testBinaryOpMS(/,F64,20.0,5.0,3,2);
-    testBinaryOpMS(/,C32,20.0+20.0i,5.0+5.0i,3,2);
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psMatrixVectorArithmetic02.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrixVectorArithmetic02.c	(revision 42336)
+++ 	(revision )
@@ -1,269 +1,0 @@
-
-/** @file  tst_psMatrixVectorArithmetic02.c
- *
- *  @brief Test driver for psMatrixVector arithmetic functions
- *
- *  This test driver tests combinations of matrix, vector, and scalar unary operations including:
- *     Matrix with all math operators with S32, F32, F64, C32
- *     Vector with all math operators with S32, F32, F64, C32
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-08-24 01:24:24 $
- *
- *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#include <math.h>
-
-
-#define CHECK_VECTOR(VECTOR,TYPE,TRUTH)                                                                      \
-for(psS32 i=0; i<VECTOR->n; i++) {                                                                             \
-    if(cabs(VECTOR->data.TYPE[i])-cabs(TRUTH) > FLT_EPSILON){                                                \
-        printf("ERROR:Truth and calculated values don't match for vector operation:\n");                     \
-        if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) {                                                    \
-            printf("Truth: %.2f%+.2fi\n", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i]));         \
-            printf("Calculated: %.2f%+.2fi\n", creal(TRUTH), cimag(TRUTH));                                  \
-        } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) {                                                 \
-            printf("Truth: %d\n", (psS32)(VECTOR->data.TYPE[i]));                                              \
-            printf("Calculated: %d\n", (psS32)(TRUTH));                                                        \
-        } else {                                                                                             \
-            printf("Truth: %.2f\n", (double)(VECTOR->data.TYPE[i]));                                         \
-            printf("Calculated: %.2f\n", (double)(TRUTH));                                                   \
-        }                                                                                                    \
-    }                                                                                                        \
-}                                                                                                            \
-printf("\n");
-
-
-#define CHECK_MATRIX(IMAGE,TYPE,TRUTH)                                                                       \
-for(psS32 i=IMAGE->numRows-1; i>-1; i--) {                                                                     \
-    for(psS32 j=0; j<IMAGE->numCols; j++) {                                                                    \
-        if(cabs(IMAGE->data.TYPE[i][j])-cabs(TRUTH) > FLT_EPSILON){                                          \
-            printf("ERROR:Truth and calculated values don't match for matrix operation:\n");                 \
-            if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) {                                                 \
-                printf("Truth: %.2f%+.2fi\n", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j])); \
-                printf("Calculated: %.2f%+.2fi\n", creal(TRUTH), cimag(TRUTH));                              \
-            } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) {                                              \
-                printf("Truth: %d\n", (psS32)(IMAGE->data.TYPE[i][j]));                                        \
-                printf("Calculated: %d\n", (psS32)(TRUTH));                                                    \
-            } else {                                                                                         \
-                printf("Truth: %.2f\n", (double)(IMAGE->data.TYPE[i][j]));                                   \
-                printf("Calculated: %.2f\n", (double)(TRUTH));                                               \
-            }                                                                                                \
-        }                                                                                                    \
-    }                                                                                                        \
-    printf("\n");                                                                                            \
-}                                                                                                            \
-printf("\n");
-
-
-#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE)                                                          \
-psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE);                                             \
-for(psS32 i=0; i<SIZE; i++) {                                                                                  \
-    NAME->data.TYPE[i] = VALUE;                                                                              \
-}                                                                                                            \
-NAME->n = SIZE;
-
-
-#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)                                                    \
-psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);                                          \
-for(psS32 i=0; i<NAME->numRows; i++) {                                                                         \
-    for(psS32 j=0; j<NAME->numCols; j++) {                                                                     \
-        NAME->data.TYPE[i][j] = VALUE;                                                                       \
-    }                                                                                                        \
-}
-
-
-#define CHECK_MEMORY \
-if( psMemCheckLeaks(0, NULL, stdout, false) != 0 ) {  \
-    psError(PS_ERR_UNKNOWN, true,"Memory leaks detected."); \
-    return 50; \
-} \
-psS32 nBad = psMemCheckCorruption(0); \
-if(nBad) { \
-    psError(PS_ERR_UNKNOWN, true,"ERROR: Found %d bad memory blocks\n", nBad); \
-    return 51; \
-}
-
-
-psS32 main( psS32 argc, char* argv[] )
-{
-    psLogSetFormat("HLNM");
-    // Test matrix unary operations
-    #define testUnaryOpM(OP,TYPE,VALUE1,VALUE2,NROWS,NCOLS,TRUTH)                                            \
-    {                                                                                                        \
-        printPositiveTestHeader(stdout, "psMatrixVectorArithmetic", "Test matrix psUnaryOp");                \
-        printf("Operation: %s\n", #OP);                                                                      \
-        CREATE_AND_SET_IMAGE(inImage,TYPE,VALUE1,NROWS,NCOLS);                                               \
-        CREATE_AND_SET_IMAGE(outImage,TYPE,VALUE2,NROWS,NCOLS);                                              \
-        outImage = (psImage*)psUnaryOp(outImage, inImage, #OP);                                              \
-        CHECK_MATRIX(outImage,TYPE,TRUTH);                                                                   \
-        psFree(inImage);                                                                                     \
-        psFree(outImage);                                                                                    \
-        CHECK_MEMORY;                                                                                        \
-        printFooter(stdout, "psMatrixVectorArithmetic", "Test matrix psUnaryOp", true);                      \
-    }
-
-    testUnaryOpM( abs, S32, -10, 0, 3, 2, 10 );
-    testUnaryOpM( abs, F32, -10.0, 0.0, 3, 2, 10.0 );
-    testUnaryOpM( abs, F64, -10.0, 0.0, 3, 2, 10.0 );
-    testUnaryOpM( abs, C32, -10.0 - 10.0i, 0.0 + 0.0i, 3, 2,10+10i );
-    testUnaryOpM( exp, S32, 10, 0, 3, 2, cexp(10));
-    testUnaryOpM( exp, F32, 10.0, 0.0, 3, 2, cexp(10.0) );
-    testUnaryOpM( exp, F64, 10.0, 0.0, 3, 2, cexp(10.0) );
-    testUnaryOpM( exp, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, cexp(1.0+1.0i) );
-    testUnaryOpM( ln, S32, 10, 0, 3, 2, clog(10) );
-    testUnaryOpM( ln, F32, 10.0, 0.0, 3, 2, clog(10.0) );
-    testUnaryOpM( ln, F64, 10.0, 0.0, 3, 2, clog(10.0) );
-    testUnaryOpM( ln, C32, 10.0 + 10.0i, 0.0 + 0.0i, 3, 2, clog(10.0+10.0i) );
-    testUnaryOpM( ten, S32, 3, 0, 3, 2, 1000 );
-    testUnaryOpM( ten, F32, 3.0, 0.0, 3, 2, 1000 );
-    testUnaryOpM( ten, F64, 3.0, 0.0, 3, 2, 1000 );
-    testUnaryOpM( ten, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, 10.0 );
-    testUnaryOpM( log, S32, 1000, 0, 3, 2, 3 );
-    testUnaryOpM( log, F32, 1000.0, 0.0, 3, 2, 3 );
-    testUnaryOpM( log, F64, 1000.0, 0.0, 3, 2, 3 );
-    testUnaryOpM( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 2, 3 );
-    testUnaryOpM( sin, S32, M_PI_2, 0, 3, 2, 1 );
-    testUnaryOpM( sin, F32, M_PI_2, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( sin, F64, M_PI_2, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 );
-    testUnaryOpM( dsin, S32, 90, 0, 3, 2 , 1);
-    testUnaryOpM( dsin, F32, 90.0, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( dsin, F64, 90.0, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( dsin, C32, 90.0 + 00.0i, 0.0 + 0.0i, 3, 2, 1.0 );
-    testUnaryOpM( cos, S32, 0, 0, 3, 2, 1 );
-    testUnaryOpM( cos, F32, 0.0, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( cos, F64, 0.0, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( cos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 );
-    testUnaryOpM( dcos, S32, 0, 0, 3, 2, 1 );
-    testUnaryOpM( dcos, F32, 0.0, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( dcos, F64, 0.0, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 );
-    testUnaryOpM( tan, S32, M_PI_4, 0, 3, 2, 1);
-    testUnaryOpM( tan, F32, M_PI_4, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( tan, F64, M_PI_4, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 2, 1 );
-    testUnaryOpM( dtan, S32, 45, 0, 3, 2, 1 );
-    testUnaryOpM( dtan, F32, 45.0, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( dtan, F64, 45.0, 0.0, 3, 2, 1.0 );
-    testUnaryOpM( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 2, 1.0 );
-    testUnaryOpM( asin, S32, 1, 0, 3, 2, M_PI_2);
-    testUnaryOpM( asin, F32, 1.0, 0.0, 3, 2, M_PI_2  );
-    testUnaryOpM( asin, F64, 1.0, 0.0, 3, 2, M_PI_2);
-    testUnaryOpM( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, M_PI_2);
-    testUnaryOpM( dasin, S32, 1.0, 0, 3, 2, 90 );
-    testUnaryOpM( dasin, F32, 1.0, 0.0, 3, 2, 90.0 );
-    testUnaryOpM( dasin, F64, 1.0, 0.0, 3, 2, 90.0 );
-    testUnaryOpM( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, 90.0 );
-    testUnaryOpM( acos, S32, 0, 0, 3, 2, M_PI_2);
-    testUnaryOpM( acos, F32, 0.0, 0.0, 3, 2, M_PI_2 );
-    testUnaryOpM( acos, F64, 0.0, 0.0, 3, 2, M_PI_2 );
-    testUnaryOpM( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_2 );
-    testUnaryOpM( dacos, S32, 0, 0, 3, 2, 90 );
-    testUnaryOpM( dacos, F32, 0.0, 0.0, 3, 2, 90.0 );
-    testUnaryOpM( dacos, F64, 0.0, 0.0, 3, 2, 90.0 );
-    testUnaryOpM( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 90.0 );
-    testUnaryOpM( atan, S32, 1, 0, 3, 2, M_PI_4);
-    testUnaryOpM( atan, F32, 1.0, 0.0, 3, 2, M_PI_4 );
-    testUnaryOpM( atan, F64, 1.0, 0.0, 3, 2, M_PI_4);
-    testUnaryOpM( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_4);
-    testUnaryOpM( datan, S32, 1, 0, 3, 2, 45 );
-    testUnaryOpM( datan, F32, 1.0, 0.0, 3, 2, 45.0 );
-    testUnaryOpM( datan, F64, 1.0, 0.0, 3, 2, 45.0 );
-    testUnaryOpM( datan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, 45.0 );
-
-
-    // Test vector unary operations
-    #define testUnaryOpV(OP,TYPE,VALUE1,VALUE2,SIZE,TRUTH)                                                   \
-    {                                                                                                        \
-        printPositiveTestHeader(stdout, "psMatrixVectorArithmetic", "Test vector psUnaryOp");                \
-        printf("Operation: %s\n", #OP);                                                                      \
-        CREATE_AND_SET_VECTOR(inVector,TYPE,VALUE1,SIZE);                                                    \
-        CREATE_AND_SET_VECTOR(outVector,TYPE,VALUE2,SIZE);                                                   \
-        outVector = (psVector*)psUnaryOp(outVector, inVector, #OP);                                          \
-        CHECK_VECTOR(outVector,TYPE,TRUTH);                                                                  \
-        psFree(inVector);                                                                                    \
-        psFree(outVector);                                                                                   \
-        CHECK_MEMORY;                                                                                        \
-        printFooter(stdout, "psMatrixVectorArithmetic", "Test vector psUnaryOp", true);                      \
-    }
-
-    testUnaryOpV( abs, S32, -10, 0, 3, 10 );
-    testUnaryOpV( abs, F32, -10.0, 0.0, 3, 10.0 );
-    testUnaryOpV( abs, F64, -10.0, 0.0, 3, 10.0 );
-    testUnaryOpV( abs, C32, -10.0 - 10.0i, 0.0 + 0.0i, 3, 10+10i );
-    testUnaryOpV( exp, S32, 10, 0, 3, cexp(10));
-    testUnaryOpV( exp, F32, 10.0, 0.0, 3, cexp(10.0) );
-    testUnaryOpV( exp, F64, 10.0, 0.0, 3, cexp(10.0) );
-    testUnaryOpV( exp, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, cexp(1.0+1.0i) );
-    testUnaryOpV( ln, S32, 10, 0, 3, clog(10) );
-    testUnaryOpV( ln, F32, 10.0, 0.0, 3, clog(10.0) );
-    testUnaryOpV( ln, F64, 10.0, 0.0, 3, clog(10.0) );
-    testUnaryOpV( ln, C32, 10.0 + 10.0i, 0.0 + 0.0i, 3, clog(10.0+10.0i) );
-    testUnaryOpV( ten, S32, 3, 0, 3, 1000 );
-    testUnaryOpV( ten, F32, 3.0, 0.0, 3, 1000 );
-    testUnaryOpV( ten, F64, 3.0, 0.0, 3, 1000 );
-    testUnaryOpV( ten, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 10.0 );
-    testUnaryOpV( log, S32, 1000, 0, 3,  3 );
-    testUnaryOpV( log, F32, 1000.0, 0.0, 3, 3 );
-    testUnaryOpV( log, F64, 1000.0, 0.0, 3, 3 );
-    testUnaryOpV( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 3 );
-    testUnaryOpV( sin, S32, M_PI_2, 0, 3, 1 );
-    testUnaryOpV( sin, F32, M_PI_2, 0.0, 3, 1.0 );
-    testUnaryOpV( sin, F64, M_PI_2, 0.0, 3, 1.0 );
-    testUnaryOpV( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 1.0 );
-    testUnaryOpV( dsin, S32, 90, 0, 3, 1);
-    testUnaryOpV( dsin, F32, 90.0, 0.0, 3, 1.0 );
-    testUnaryOpV( dsin, F64, 90.0, 0.0, 3, 1.0 );
-    testUnaryOpV( dsin, C32, 90.0 + 00.0i, 0.0 + 0.0i, 3, 1.0 );
-    testUnaryOpV( cos, S32, 0, 0, 3, 1 );
-    testUnaryOpV( cos, F32, 0.0, 0.0, 3, 1.0 );
-    testUnaryOpV( cos, F64, 0.0, 0.0, 3, 1.0 );
-    testUnaryOpV( cos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 1.0 );
-    testUnaryOpV( dcos, S32, 0, 0, 3, 1 );
-    testUnaryOpV( dcos, F32, 0.0, 0.0, 3, 1.0 );
-    testUnaryOpV( dcos, F64, 0.0, 0.0, 3, 1.0 );
-    testUnaryOpV( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 1.0 );
-    testUnaryOpV( tan, S32, M_PI_4, 0, 3, 1);
-    testUnaryOpV( tan, F32, M_PI_4, 0.0, 3, 1.0 );
-    testUnaryOpV( tan, F64, M_PI_4, 0.0, 3, 1.0 );
-    testUnaryOpV( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 1 );
-    testUnaryOpV( dtan, S32, 45, 0, 3, 1 );
-    testUnaryOpV( dtan, F32, 45.0, 0.0, 3, 1.0 );
-    testUnaryOpV( dtan, F64, 45.0, 0.0, 3, 1.0 );
-    testUnaryOpV( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 1.0 );
-    testUnaryOpV( asin, S32, 1, 0, 3, M_PI_2);
-    testUnaryOpV( asin, F32, 1.0, 0.0, 3, M_PI_2  );
-    testUnaryOpV( asin, F64, 1.0, 0.0, 3, M_PI_2);
-    testUnaryOpV( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, M_PI_2);
-    testUnaryOpV( dasin, S32, 1.0, 0, 3, 90 );
-    testUnaryOpV( dasin, F32, 1.0, 0.0, 3, 90.0 );
-    testUnaryOpV( dasin, F64, 1.0, 0.0, 3, 90.0 );
-    testUnaryOpV( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 90.0 );
-    testUnaryOpV( acos, S32, 0, 0, 3, M_PI_2);
-    testUnaryOpV( acos, F32, 0.0, 0.0, 3, M_PI_2 );
-    testUnaryOpV( acos, F64, 0.0, 0.0, 3, M_PI_2 );
-    testUnaryOpV( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_2 );
-    testUnaryOpV( dacos, S32, 0, 0, 3, 90 );
-    testUnaryOpV( dacos, F32, 0.0, 0.0, 3, 90.0 );
-    testUnaryOpV( dacos, F64, 0.0, 0.0, 3, 90.0 );
-    testUnaryOpV( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 90.0 );
-    testUnaryOpV( atan, S32, 1, 0, 3, M_PI_4);
-    testUnaryOpV( atan, F32, 1.0, 0.0, 3, M_PI_4 );
-    testUnaryOpV( atan, F64, 1.0, 0.0, 3, M_PI_4);
-    testUnaryOpV( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_4);
-    testUnaryOpV( datan, S32, 1, 0, 3, 45 );
-    testUnaryOpV( datan, F32, 1.0, 0.0, 3, 45.0 );
-    testUnaryOpV( datan, F64, 1.0, 0.0, 3, 45.0 );
-    testUnaryOpV( datan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 45.0 );
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psMatrixVectorArithmetic03.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrixVectorArithmetic03.c	(revision 42336)
+++ 	(revision )
@@ -1,315 +1,0 @@
-/** @file  tst_psMatrixVectorArithmetic03.c
- *
- *  @brief Test driver for psMatrixVector arithmetic functions
- *
- *  This test driver contains negative tests for psBinaryOp and psUanryOp:
- *     Check for NULL arguments
- *     Inconsistent element types
- *     Inconsistent element count
- *     Inconsistent dimensionality
- *     Division by zero
- *     Attempt to use min with complex numbers
- *     Attempt to use max with complex numbers
- *     Invalid operation
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2005-08-24 01:24:24 $
- *
- *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define PRINT_VECTOR(VECTOR,TYPE) \
-for(psS32 i=0; i<VECTOR->n; i++) { \
-    if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) { \
-        printf("%f+%fi ", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i])); \
-    } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) { \
-        printf("%d ", (psS32)VECTOR->data.TYPE[i]); \
-    } else { \
-        printf("%f ", (double)VECTOR->data.TYPE[i]); \
-    } \
-} \
-printf("\n\n");
-
-#define PRINT_MATRIX(IMAGE,TYPE) \
-for(psS32 i=IMAGE->numRows-1; i>-1; i--) { \
-    for(psS32 j=0; j<IMAGE->numCols; j++) { \
-        if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) { \
-            printf("%f+%fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j])); \
-        } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) { \
-            printf("%d ", (psS32)IMAGE->data.TYPE[i][j]); \
-        } else { \
-            printf("%f ", (double)IMAGE->data.TYPE[i][j]); \
-        } \
-    } \
-    printf("\n"); \
-} \
-printf("\n");
-
-
-#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE) \
-psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE); \
-for(psS32 i=0; i<SIZE; i++) { \
-    NAME->data.TYPE[i] = VALUE; \
-} \
-NAME->n = SIZE;
-
-
-#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS) \
-psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE); \
-for(psS32 i=0; i<NAME->numRows; i++) { \
-    for(psS32 j=0; j<NAME->numCols; j++) { \
-        NAME->data.TYPE[i][j] = VALUE; \
-    } \
-}
-
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    CREATE_AND_SET_IMAGE(image1,F64,0,3,3);
-    CREATE_AND_SET_IMAGE(image2,F64,0,3,3);
-    CREATE_AND_SET_IMAGE(image3,F32,0,3,3);
-    CREATE_AND_SET_IMAGE(image4,F64,0,2,2);
-    CREATE_AND_SET_IMAGE(image5,C32,1+1i,3,3);
-    CREATE_AND_SET_VECTOR(vector1,F64,0,2);
-    CREATE_AND_SET_VECTOR(vector2,F64,0,3);
-
-    // Check for NULL output argument
-    printPositiveTestHeader(stdout,"psBinaryOp", "Check for output generated");
-    psImage* image6 = (psImage*)psBinaryOp(NULL, image1, "+", image2);
-    if (image6 == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp failed to make an image given no output to recycle.");
-        return 1;
-    }
-    printFooter(stdout,"psBinaryOp","Check for output generated",true);
-
-    // Check for NULL input argument #1
-    printPositiveTestHeader(stdout,"psBinaryOp","Check for null input arg 1");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psBinaryOp(image6, NULL, "+", image2);
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given a NULL first operand.");
-        return 2;
-    }
-    printFooter(stdout,"psBinaryOp","Check for null input arg 1",true);
-
-    // Check for NULL input argument #2
-    printPositiveTestHeader(stdout,"psBinaryOp","Check for null input arg 2");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psBinaryOp(image6, image1, "+", NULL);
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given a NULL second operand.");
-        return 3;
-    }
-    printFooter(stdout,"psBinaryOp","Check for null input arg 2",true);
-
-    // Check for NULL operand
-    printPositiveTestHeader(stdout,"psBinaryOp","Check for null operand");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psBinaryOp(image6, image1, NULL, image2);
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given a NULL operator.");
-        return 4;
-    }
-    printFooter(stdout,"psBinaryOp","Check for null operand",true);
-
-    // Check for null output
-    printPositiveTestHeader(stdout,"psUnaryOp","Check for null output");
-    image6 = (psImage*)psUnaryOp(NULL, image1, "sin");
-    if (image6 == NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp failed to make an image given no output to recycle.");
-        return 5;
-    }
-    printFooter(stdout,"psUnaryOp","Check for null output",true);
-
-    // Check for NULL input arg
-    printPositiveTestHeader(stdout,"psUnaryOp","Check for null input");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psUnaryOp(image6, NULL, "sin");
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned a result given a NULL operand.");
-        return 6;
-    }
-    printFooter(stdout,"psUnaryOp","Check for null input",true);
-
-    // Check for NULL operand
-    printPositiveTestHeader(stdout,"psUnaryOp","Check for null operator");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psUnaryOp(image6, image1, NULL);
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned a result given a NULL operator.");
-        return 7;
-    }
-    printFooter(stdout,"psUnaryOp","Check for null operator",true);
-
-    // Inconsistent element types
-    printPositiveTestHeader(stdout,"psBinaryOp", "Inconsistent element types");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psBinaryOp(image6, image3, "+", image2);
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given operands of different types.");
-        return 8;
-    }
-    printFooter(stdout,"psBinaryOp","Inconsistent element types",true);
-
-    // Check unary op to convert to correct type
-    printPositiveTestHeader(stdout,"psUnaryOp","Check output type conversion");
-    image6 = psImageCopy(image6,image2,PS_TYPE_F64);
-    image6 = (psImage*)psUnaryOp(image6, image3, "sin");
-    if (image6 == NULL || image6->type.type != PS_TYPE_F32) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp failed to convert the type of the output.");
-        return 9;
-    }
-    printFooter(stdout,"psUnaryOp","Check output type conversion",true);
-
-    // Inconsistent element count
-    printPositiveTestHeader(stdout,"psBinaryOp","Check for inconsistent elements");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psBinaryOp(image6, image4, "+", image2);
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given operands of different sizes.");
-        return 10;
-    }
-    printFooter(stdout,"psBinaryOp","Check for inconsistent elements",true);
-
-    // Inconsistent element in input and output
-    printPositiveTestHeader(stdout,"psUnaryOp","Check inconsistent elements in input and output");
-    image6 = psImageCopy(image6,image2,PS_TYPE_F64);
-    image6 = (psImage*)psUnaryOp(image6, image4, "sin");
-    if (image6 == NULL ||
-            image6->numCols != image6->numCols ||
-            image6->numRows != image6->numRows) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp failed to resize the output.");
-        return 11;
-    }
-    printFooter(stdout,"psUnaryOp","Check inconsistent elements in input and output",true);
-
-    // Inconsistent size of input 1 and input 2
-    printPositiveTestHeader(stdout,"psBinaryOp","Check inconsistent size");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psBinaryOp(image6, vector1, "+", image2);
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given operands of different sizes.");
-        return 12;
-    }
-    printFooter(stdout,"psBinaryOp","Check inconsistent size",true);
-
-    // Inconsistent size of input 1 and input 2
-    printPositiveTestHeader(stdout,"psBinaryOp","Check inconsistent size");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    vector1->type.dimen = PS_DIMEN_TRANSV;
-    image6 = (psImage*)psBinaryOp(image6, vector1, "+", image2);
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given operands of different sizes.");
-        return 13;
-    }
-    printFooter(stdout, "psBinaryOp", "Check inconsistent size", true);
-
-
-    // Inconsistent dimensionality
-    printPositiveTestHeader(stdout,"psUnaryOp","Check inconsistent dimensionality");
-    image6 = psImageCopy(image6,image2,PS_TYPE_F64);
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an two error messages");
-    image6 = (psImage*)psUnaryOp(image6, vector2, "sin");
-    if (image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned result given wrong type out parameter.");
-        return 14;
-    }
-    printFooter(stdout,"psUnaryOp","Check inconsistent dimensionality",true);
-
-    // Attempt to use min with complex numbers
-    printPositiveTestHeader(stdout,"psBinaryOp","Attempt to use min with complex numbers");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
-    image6 = (psImage*)psBinaryOp(image6, image5, "min", image5);
-    if(image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned result with min of complex numbers");
-        return 15;
-    }
-    printFooter(stdout, "psBinaryOp", "Attempt to use  min with complex numbers", true);
-
-
-    // Attempt to use max with complex numbers
-    printPositiveTestHeader(stdout,"psBinaryOp","Attempt to use max with complex numbers");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psBinaryOp(image6, image5, "max", image5);
-    if(image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned result with max of complex numbers");
-        return 16;
-    }
-    printFooter(stdout, "psBinaryOp", "Attempt to use max with complex numbers", true);
-
-
-    // Invalid operation
-    printPositiveTestHeader(stdout,"psBinary","Attempt to use invalid operator");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error messgae");
-    image6 = (psImage*)psBinaryOp(image6, image1, "yarg", image2);
-    if(image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned result with invalid operator");
-        return 17;
-    }
-    printFooter(stdout,"psBinaryOp","Attempt to use invalid operator",true);
-
-    printPositiveTestHeader(stdout,"psUnaryOp","Attempt to use invalid operator");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    image6 = (psImage*)psUnaryOp(image6, image1, "yarg");
-    if(image6 != NULL) {
-        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned result with invalid operator");
-        return 18;
-    }
-    printFooter(stdout, "psUnaryOp", "Attempt to use invalid operator", true);
-
-    CREATE_AND_SET_VECTOR(vector4,F64,0,3);
-    CREATE_AND_SET_VECTOR(vector5,F64,0,3);
-
-    // Input parameter with dimension of PS_DIMEN_OTHER
-    printPositiveTestHeader(stdout,"psBinaryOp","Attempt to use input with PS_DIMEN_OTHER");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    vector4->type.dimen = PS_DIMEN_OTHER;
-    if ( psBinaryOp(NULL,vector4,"+",vector5) != NULL) {
-        psError(PS_ERR_UNKNOWN, true,"psBinaryOp should return null when input dimen PS_DIMEN_OTHER.");
-        return 19;
-    }
-    vector4->type.dimen = PS_DIMEN_VECTOR;
-    printFooter(stdout,"psBinaryOp","Attempt to use input with PS_DIMEN_OTHER",true);
-
-    // Input parameter with dimension of PS_DIMEN_OTHER
-    printPositiveTestHeader(stdout,"psUnaryOp","Attempt to use input with PS_DIMEN_OTHER");
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
-    vector4->type.dimen = PS_DIMEN_OTHER;
-    if ( psUnaryOp(NULL,vector4,"sin") != NULL ) {
-        psError(PS_ERR_UNKNOWN,true,"psUnaryOp should return null when input dimen PS_DIMEN_OTHER");
-        return 20;
-    }
-    vector4->type.dimen = PS_DIMEN_VECTOR;
-    printFooter(stdout,"psUnaryOp","Attempt to use input with PS_DIMEN_OTHER",true);
-
-    psFree(vector4);
-    psFree(vector5);
-    psFree(image1);
-    psFree(image2);
-    psFree(image3);
-    psFree(image4);
-    psFree(image5);
-    psFree(vector1);
-    psFree(vector2);
-
-    psS32 nLeaks = psMemCheckLeaks(0,NULL,stdout,false);
-    if(nLeaks != 0) {
-        psError(PS_ERR_UNKNOWN,true,"Memory leaks detected");
-        return 50;
-    }
-    psS32 nBad = psMemCheckCorruption(0);
-    if(nBad) {
-        psError(PS_ERR_UNKNOWN,true,"Memory corruption detected");
-        return 51;
-    }
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psMatrixVectorArithmetic04.c
===================================================================
--- trunk/psLib/test/math/tst_psMatrixVectorArithmetic04.c	(revision 42336)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/** @file  tst_psMatrixVectorArithmetic04.c
- *
- *  @brief Test driver for psBinary arithmetic operations with scalars
- *
- *  This test driver will test the following binary operation with scalar inputs
- *        vector addition with scalar in first argument
- *        image addition with scalar in second argument
- *
- * @author  Eric Van Alst, MHPCC
- *
- * @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- * @date  $Date: 2005-08-24 01:24:24 $
- *
- * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-static psS32 testBinOpScalarFirst(void);
-static psS32 testBinOpScalarSecond(void);
-static psS32 testBinOpScalarBoth(void);
-static psS32 testUnaryOpScalar(void);
-
-testDescription testsBinary[] = {
-                                    {testBinOpScalarFirst,737,"psBinaryOp",0,false},
-                                    {testBinOpScalarSecond,737,"psBinaryOp",0,false},
-                                    {testBinOpScalarBoth,737,"psBinaryOp",0,false},
-                                    {NULL}
-                                };
-
-testDescription testUnary[] = {
-                                  {testUnaryOpScalar,737,"psUnaryOp",0,false},
-                                  {NULL}
-                              };
-
-// Create vector
-#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE) \
-psVector *NAME = psVectorAlloc(SIZE,PS_TYPE_##TYPE); \
-for(psS32 i=0; i<SIZE; i++) { \
-    NAME->data.TYPE[i] = VALUE; \
-} \
-NAME->n = SIZE;
-
-// Create image
-#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS) \
-psImage *NAME = psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE); \
-for(psS32 i=0; i<NAME->numRows; i++) { \
-    for(psS32 j=0; j<NAME->numCols; j++) { \
-        NAME->data.TYPE[i][j] = VALUE; \
-    } \
-}
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-
-    runTestSuite(stderr,"psBinaryOp",testsBinary,argc,argv);
-    runTestSuite(stderr,"psUnaryOp",testUnary,argc,argv);
-
-    return 0;
-}
-
-psS32 testBinOpScalarFirst(void)
-{
-    CREATE_AND_SET_VECTOR(vector1,S8,1,5)
-    CREATE_AND_SET_VECTOR(vector2,S8,0,5)
-
-    psScalar* inScalar1 = psScalarAlloc(2,PS_TYPE_S8);
-
-    // Add vector and scalar
-    vector2 = (psVector*)psBinaryOp(vector2,inScalar1,"+",vector1);
-    // Verify the result vector
-    for(psS32 i=0; i<vector2->n; i++) {
-        if(vector2->data.S8[i] != 3 ) {
-            psError(PS_ERR_UNKNOWN,true,"Unexpected value in return vector[%d]",i);
-            return 1;
-        }
-    }
-    psFree(vector1);
-    psFree(vector2);
-
-    CREATE_AND_SET_VECTOR(vector3,S8,1,5);
-    CREATE_AND_SET_VECTOR(vector4,S8,0,3);
-
-    psScalar* inScalar2 = psScalarAlloc(2,PS_TYPE_S8);
-    vector4->type.dimen = PS_DIMEN_TRANSV;
-    vector4 = (psVector*)psBinaryOp(vector4,inScalar2,"+",vector3);
-    for(psS32 i=0; i<vector4->n; i++) {
-        if(vector4->data.S8[i] != 3 ) {
-            psError(PS_ERR_UNKNOWN,true,"Unexpected value in return vector[%d]",i);
-            return 2;
-        }
-    }
-    psFree(vector3);
-    psFree(vector4);
-
-    CREATE_AND_SET_IMAGE(image1,S8,1,5,5)
-    psImage* image2 = NULL;
-
-    psScalar* inScalar3 = psScalarAlloc(2,PS_TYPE_S8);
-
-    image2 = (psImage*)psBinaryOp(image2,inScalar3,"+",image1);
-    for(psS32 i=0; i<image2->numRows; i++) {
-        for(psS32 j=0; j<image2->numCols; j++) {
-            if(image2->data.S8[i][j] != 3 ) {
-                psError(PS_ERR_UNKNOWN,true,"Unexpected value in return image[%d][%d]",i,j);
-                return 10;
-            }
-        }
-    }
-    psFree(image1);
-    psFree(image2);
-
-    return 0;
-}
-
-psS32 testBinOpScalarSecond(void)
-{
-    CREATE_AND_SET_VECTOR(vector1,S8,1,5)
-    CREATE_AND_SET_VECTOR(vector2,S8,0,5)
-
-    psScalar* inScalar1 = psScalarAlloc(2,PS_TYPE_S8);
-
-    vector2 = (psVector*)psBinaryOp(vector2,vector1,"+",inScalar1);
-    for(psS32 i=0; i<vector2->n; i++) {
-        if(vector2->data.S8[i] != 3 ) {
-            psError(PS_ERR_UNKNOWN,true,"Unexpected value in return vector[%d]",i);
-            return 1;
-        }
-    }
-    psFree(vector1);
-    psFree(vector2);
-
-    CREATE_AND_SET_VECTOR(vector3,S8,1,5);
-    CREATE_AND_SET_VECTOR(vector4,S8,0,3);
-
-    psScalar* inScalar2 = psScalarAlloc(2,PS_TYPE_S8);
-    vector4->type.dimen = PS_DIMEN_TRANSV;
-    vector4 = (psVector*)psBinaryOp(vector4,vector3,"+",inScalar2);
-    for(psS32 i=0; i<vector4->n; i++) {
-        if(vector4->data.S8[i] != 3 ) {
-            psError(PS_ERR_UNKNOWN,true,"Unexpected value in return vector[%d]",i);
-            return 2;
-        }
-    }
-    psFree(vector3);
-    psFree(vector4);
-
-    CREATE_AND_SET_IMAGE(image1,S8,1,5,5);
-    psImage* image2 = NULL;
-
-    psScalar* inScalar3 = psScalarAlloc(2,PS_TYPE_S8);
-
-    image2 = (psImage*)psBinaryOp(image2,image1,"+",inScalar3);
-    for(psS32 i=0; i<image2->numRows; i++) {
-        for(psS32 j=0; j<image2->numCols; j++) {
-            if(image2->data.S8[i][j] != 3 ) {
-                psError(PS_ERR_UNKNOWN,true,"Unexpected value in return image[%d][%d]",i,j);
-                return 10;
-            }
-        }
-    }
-    psFree(image1);
-    psFree(image2);
-
-    return 0;
-}
-
-psS32 testBinOpScalarBoth(void)
-{
-    psScalar* inScalar1 = psScalarAlloc(1,PS_TYPE_S8);
-    psScalar* inScalar2 = psScalarAlloc(2,PS_TYPE_S8);
-    psScalar* outScalar = psScalarAlloc(4,PS_TYPE_S8);
-
-    outScalar = (psScalar*)psBinaryOp(outScalar,inScalar1,"+",inScalar2);
-    if(outScalar->data.S8 != 3) {
-        psError(PS_ERR_UNKNOWN,true,"Unexpected value in return scalar");
-        return 3;
-    }
-    psFree(outScalar);
-
-    psScalar* inScalar3 = psScalarAlloc(10,PS_TYPE_S8);
-    psScalar* inScalar4 = psScalarAlloc(20,PS_TYPE_S8);
-    psScalar* outScalar1 = NULL;
-
-    outScalar1 = (psScalar*)psBinaryOp(outScalar1,inScalar3,"+",inScalar4);
-    if(outScalar1->data.S8 != 30 ) {
-        psError(PS_ERR_UNKNOWN,true,"Unexpected value in return scalar");
-        return 4;
-    }
-    psFree(outScalar1);
-
-    return 0;
-}
-
-psS32 testUnaryOpScalar(void)
-{
-    psScalar* inScalar = psScalarAlloc(-1,PS_TYPE_F32);
-    psScalar* outScalar = NULL;
-
-    outScalar = (psScalar*)psUnaryOp(outScalar,inScalar,"abs");
-    if(outScalar->data.F32 != 1) {
-        psError(PS_ERR_UNKNOWN,true,"Unexpected value in return scalar = %d  in = %d",outScalar->data.F32,inScalar->data.F32);
-        return 5;
-    }
-    psFree(outScalar);
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psMinimizeLMM.c
===================================================================
--- trunk/psLib/test/math/tst_psMinimizeLMM.c	(revision 42336)
+++ 	(revision )
@@ -1,296 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that psMinimizeLM() works correctly.
- 
-    XXX: This code needs a lot of additional test case work.
-    XXX: Use the tst_template.
-    XXX: Print headers and footers.
-    XXX: Why are we flushing stdout?
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include <math.h>
-#define NUM_ITERATIONS 100
-#define ERR_TOL 1e-6
-#define NUM_DATA_POINTS 300
-#define NUM_PARAMS 3
-#define VERBOSE 0
-float expectedParm[NUM_PARAMS];
-
-
-float function(const psVector *params,      // Paramters
-               const psVector *x            // Ordinate
-              )
-{
-    return params->data.F32[0] *
-           expf(- (PS_SQR(x->data.F32[0]) + PS_SQR(x->data.F32[1]) / 2.0 / PS_SQR(params->data.F32[1]))) +
-           params->data.F32[2];
-}
-
-void derivatives(psVector *deriv,       // Derivatives
-                 const psVector *params,      // Paramters
-                 const psVector *x            // Ordinate
-                )
-{
-    deriv->data.F32[0] = expf(- (PS_SQR(x->data.F32[0]) + PS_SQR(x->data.F32[1]) / 2.0 / PS_SQR(params->data.F32[1])));
-    deriv->data.F32[1] = params->data.F32[0] * (PS_SQR(x->data.F32[0]) + PS_SQR(x->data.F32[1]) / 2.0 / PS_SQR(params->data.F32[1])) / params->data.F32[1] / params->data.F32[1] / params->data.F32[1] * expf(- (PS_SQR(x->data.F32[0]) + PS_SQR(x->data.F32[1]) / 2.0 / PS_SQR(params->data.F32[1])));
-    deriv->data.F32[2] = 1.0;
-}
-
-
-
-/*****************************************************************************
-myFunc():
-    sum = param[0] * x[0] * x[1] +
-          param[1] * x[0] +
-          param[2] * x[0]^2 +
-          param[3] * x[1] +
-          param[4] * x[1]^2
- 
- *****************************************************************************/
-psF32 fitFunc(psVector *deriv,
-              psVector *params,
-              psVector *x)
-{
-    if ((deriv == NULL) || (params == NULL) || (x == NULL)) {
-        psError(PS_ERR_UNKNOWN, true, "deriv or params or x is NULL.\n");
-    }
-
-    derivatives(deriv, params, x);
-    return function(params, x);
-}
-
-psS32 t01()
-{
-    psS32 currentId = psMemGetId();
-    psBool testStatus = true;
-
-    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
-    psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
-    psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
-    psVector *coordinates = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F32);
-    psVector *errors = psVectorAlloc(NUM_DATA_POINTS, PS_TYPE_F32);
-    ordinates->n = NUM_DATA_POINTS;
-    coordinates->n = NUM_DATA_POINTS;
-    errors->n = NUM_DATA_POINTS;
-    psVector *params = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
-    params->n = NUM_PARAMS;
-    psVector *trueParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
-    trueParams->n = NUM_PARAMS;
-
-    trueParams->data.F32[0] = 100.0;    // Normalisation
-    trueParams->data.F32[1] = 3.0;      // Width
-    trueParams->data.F32[2] = 10.0;     // Background
-
-    // Set parameters
-    for (long i = 0; i < NUM_PARAMS; i++) {
-        // So we're not starting right on the true value:
-        params->data.F32[i] = trueParams->data.F32[i] * (1.0 - psRandomGaussian(rng) / 10.0);
-    }
-
-    for (long i = 0; i < NUM_DATA_POINTS; i++) {
-        psVector *x = psVectorAlloc(2, PS_TYPE_F32);
-        x->data.F32[0] = 10.0 * psRandomUniform(rng) - 5.0;
-        x->data.F32[1] = 10.0 * psRandomUniform(rng) - 5.0;
-        ordinates->data[i] = x;
-        // Add some noise
-        coordinates->data.F32[i] = function(params, x) + 0.1 * (2.0 * psRandomGaussian(rng) - 1.0);
-        errors->data.F32[i] = 0.1;
-        if (VERBOSE) {
-            printf("Data %ld: (%f, %f) --> %f\n",
-                   i, x->data.F32[0], x->data.F32[1], coordinates->data.F32[i]);
-        }
-    }
-
-    if (!psMinimizeLMChi2(min, NULL, params, NULL, ordinates, coordinates, errors,
-                          (psMinimizeLMChi2Func)fitFunc)) {
-        printf("TEST ERROR: psMinimizeLMChi2() returned FALSE.\n");
-        fflush(stdout);
-        testStatus = false;
-    } else {
-        printf("Minimisation took %d iterations\n", min->iter);
-        printf("chi^2 at the minimum is %.3g\n", min->value);
-        for (long i = 0; i < NUM_PARAMS; i++) {
-            printf("Parameter %ld at the minimum is %.3f, expected: %f\n", i,
-                   params->data.F32[i], trueParams->data.F32[i]);
-            fflush(stdout);
-        }
-        float diff = 0.0;
-        for (long i = 0; i < NUM_DATA_POINTS; i++) {
-            psVector *x = ordinates->data[i];
-            float fitted = function(trueParams, x);
-            float expected = function(params, x);
-            diff += (fitted - expected) / fabsf(expected);
-            if (VERBOSE) {
-                printf("Data point %ld: Fitted: %f, expected: %f\n", i, fitted, expected);
-            }
-            fflush(stdout);
-        }
-        printf("Mean relative difference is %f\n", diff/(float)NUM_DATA_POINTS);
-
-    }
-
-    psFree(min);
-    psFree(params);
-    psFree(trueParams);
-    psFree(ordinates);
-    psFree(coordinates);
-    psFree(errors);
-    psFree(rng);
-    psMemCheckCorruption(1);
-    psS32 memLeaks = psMemCheckLeaks(currentId, NULL, NULL, false);
-    if (0 != memLeaks) {
-        printf("TEST ERROR: Memory Leaks! (%d leaks).\n", memLeaks);
-        fflush(stdout);
-        // XXX: This is causing a seg fault
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    return (testStatus);
-}
-
-#define NUM_ITER 10
-#define TOL  20.0
-psS32 tst_psMinimizationAlloc()
-{
-    psS32 currentId = psMemGetId();
-    psBool testStatus = true;
-
-    psMinimization *tmp = psMinimizationAlloc(NUM_ITER, TOL);
-    if (tmp == NULL) {
-        printf("TEST ERROR: psMinimizationAlloc() returned FALSE.\n");
-        testStatus = false;
-    } else {
-        if (tmp->maxIter != NUM_ITER) {
-            printf("TEST ERROR: psMinimizationAlloc() did not properly set ->maxIter.\n");
-            testStatus = false;
-        }
-
-        if (tmp->tol != TOL) {
-            printf("TEST ERROR: psMinimizationAlloc() did not properly set ->tol.\n");
-            testStatus = false;
-        }
-
-        if (tmp->value != 0.0) {
-            printf("TEST ERROR: psMinimizationAlloc() did not properly set ->value.\n");
-            testStatus = false;
-        }
-
-        if (tmp->iter != 0) {
-            printf("TEST ERROR: psMinimizationAlloc() did not properly set ->iter.\n");
-            testStatus = false;
-        }
-
-        if (!isnan(tmp->lastDelta)) {
-            printf("TEST ERROR: psMinimizationAlloc() did not properly set ->lastDelta.\n");
-            testStatus = false;
-        }
-        psFree(tmp);
-    }
-
-    psMemCheckCorruption(1);
-    psS32 memLeaks = psMemCheckLeaks(currentId, NULL, NULL, false);
-    if (0 != memLeaks) {
-        printf("TEST ERROR: Memory Leaks! (%d leaks).\n", memLeaks);
-        testStatus = false;
-    }
-
-    return(testStatus);
-}
-
-
-#define NUM_ITER 10
-#define TOL  20.0
-psS32 tst_psMinConstrainAlloc()
-{
-    psS32 currentId = psMemGetId();
-    psBool testStatus = true;
-
-    psMinConstrain *tmp = psMinConstrainAlloc(NUM_ITER, TOL);
-    if (tmp == NULL) {
-        printf("TEST ERROR: psMinConstrainAlloc() returned FALSE.\n");
-        testStatus = false;
-    } else {
-        if (tmp->paramMask != NULL) {
-            printf("TEST ERROR: psMinConstrainAlloc() did not properly set ->paramMask.\n");
-            testStatus = false;
-        }
-
-        if (tmp->paramMax != NULL) {
-            printf("TEST ERROR: psMinConstrainAlloc() did not properly set ->paramMax.\n");
-            testStatus = false;
-        }
-
-        if (tmp->paramMin != NULL) {
-            printf("TEST ERROR: psMinConstrainAlloc() did not properly set ->paramMin.\n");
-            testStatus = false;
-        }
-
-        if (tmp->paramDelta != NULL) {
-            printf("TEST ERROR: psMinConstrainAlloc() did not properly set ->paramDelta.\n");
-            testStatus = false;
-        }
-
-        psFree(tmp);
-    }
-
-    psMemCheckCorruption(1);
-    psS32 memLeaks = psMemCheckLeaks(currentId, NULL, NULL, false);
-    if (0 != memLeaks) {
-        printf("TEST ERROR: Memory Leaks! (%d leaks).\n", memLeaks);
-        testStatus = false;
-    }
-
-    return(testStatus);
-}
-
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    psTraceSetDestination(1);
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel(__func__, 0);
-    psTraceSetLevel("t01", 0);
-    psTraceSetLevel("psMinimizeLMChi2_OLD", 0);
-    psTraceSetLevel("psMinimizeLMChi2", 0);
-    psTraceSetLevel("psMinimizeGaussNewtonDelta", 0);
-    psTraceSetLevel("psMinimizeGaussNewtonDelta_EAM", 0);
-    psTraceSetLevel("p_psMinLM_GuessABP", 0);
-    psTraceSetLevel("p_psMinLM_GuessABP_EAM", 0);
-    psTraceSetLevel("p_psMinLM_SetABX", 0);
-    psTraceSetLevel("psGaussJordan", 0);
-    psTraceSetLevel("psMinimizationAlloc", 0);
-    psTraceSetLevel("psMinConstrainAlloc", 0);
-    psTraceSetLevel("psMemCheckMinimization", 0);
-    psTraceSetLevel("p_psDetermineBracket", 0);
-    psTraceSetLevel("p_psDetermineBracket2", 0);
-    psTraceSetLevel("p_psLineMin", 0);
-    psTraceSetLevel("psMinimizePowell", 0);
-    psTraceSetLevel("myPowellChi2Func", 0);
-    psTraceSetLevel("psMinimizeChi2Powell", 0);
-    psTraceSetLevel("BuildSums1D", 0);
-    psTraceSetLevel("BuildSums2D", 0);
-    psTraceSetLevel("Polynomial2DEvalVectorD", 0);
-    psTraceSetLevel("vectorFitPolynomial1DCheby", 0);
-    psTraceSetLevel("VectorFitPolynomial1DOrd", 0);
-    psTraceSetLevel("psVectorFitPolynomial1D", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial1D", 0);
-
-    psTrace(__func__, 2, "Calling new psMinimize().\n");
-    psS32 testStatus = true;
-
-
-    testStatus &= t01();
-    testStatus &= tst_psMinimizationAlloc();
-    testStatus &= tst_psMinConstrainAlloc();
-    if (testStatus == true) {
-        printf("The LMM minimization tests PASSED.\n");
-    } else {
-        printf("The LMM minimization tests FAILED.\n");
-    }
-    printf("DONE\n");
-    fflush(stdout);
-}
-
-
Index: trunk/psLib/test/math/tst_psMinimizePowell.c
===================================================================
--- trunk/psLib/test/math/tst_psMinimizePowell.c	(revision 42336)
+++ 	(revision )
@@ -1,294 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that psMinimizePowell() works correctly.
- 
-    We test with a NULL and non-NULL paramMask.
- 
-    XXX: Must verify the stderr for the NULL parameter tests.
-    XXX: psMinimizeChi2Powell() is untested.
- *****************************************************************************/
-#include <stdio.h>
-#include <math.h>
-#include "pslib.h"
-#include "psTest.h"
-#define N 5
-#define MIN_VALUE 20.0
-#define NUM_PARAMS 10
-#define ERROR_TOLERANCE 0.10
-float expectedParm[NUM_PARAMS];
-psS32 testStatus = true;
-
-/*****************************************************************************
-myFunc(): This routine subtracts the associate value in expectedParm[] from
-each parameter and then squares it, then sums that for all parameters, then
-adds MIN_VALUE to it.  The minimum for this function will be MIN_VALUE, and
-will occur when each parameter equals the associated value in expectedParm[].
- 
-This procedure ignores the coordinates, other than to ensure that they were
-passed correctly from psMinimizePowell().
- *****************************************************************************/
-float myFunc(psVector *myParams,
-             psArray *myCoords)
-{
-    float sum = 0.0;
-    float coordData = 0.0;
-    float expData = 0.0;
-    psS32 i;
-
-    //
-    // Simply ensure that the coordinate data was passed correctly.
-    //
-    for (i=0;i<N;i++) {
-        coordData = ((psVector *) (myCoords->data[i]))->data.F32[0];
-        expData = (float) (i+10);
-        if (fabs(coordData - expData) > FLT_EPSILON) {
-            printf("ERROR(1): coordinate data was incorrectly passed to myFunc()\n");
-            printf("ERROR(1): was (%f) should be (%f)\n", coordData, expData);
-            testStatus = false;
-        }
-        coordData = ((psVector *) (myCoords->data[i]))->data.F32[1];
-        expData = (float) (i+3);
-        if (fabs(coordData - expData) > FLT_EPSILON) {
-            printf("ERROR(2): coordinate data was incorrectly passed to myFunc()\n");
-            printf("ERROR(2): was (%f) should be (%f)\n", coordData, expData);
-            testStatus = false;
-        }
-    }
-
-
-    sum = 0.0;
-    for (i=0;i<NUM_PARAMS;i++) {
-        sum+= (myParams->data.F32[i] - expectedParm[i]) * (myParams->data.F32[i] - expectedParm[i]);
-    }
-    sum = MIN_VALUE + (sum * sum);
-
-    return(sum);
-}
-
-
-psS32 t00()
-{
-    psS32 currentId = psMemGetId();
-    psS32 memLeaks = 0;
-    psS32 i = 0;
-    psArray *myCoords;
-    psVector *myParams;
-    psVector *myParamMask;
-    psMinimization *min;
-
-    psTraceSetLevel(".psLib", 0);
-    /**************************************************************************
-     *************************************************************************/
-    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);
-
-    myCoords = psArrayAlloc(N);
-    myCoords->n = N;
-    for (i=0;i<N;i++) {
-        myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
-        ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10);
-        ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3);
-    }
-    for (i=0;i<NUM_PARAMS;i++) {
-        expectedParm[i] = 2.32 + (float) (2 * i);
-        myParams->data.F32[i] = 0.0;
-        myParams->data.F32[i] = (float) i;
-        myParamMask->data.U8[i] = 0;
-    }
-
-    printPositiveTestHeader(stdout,
-                            "psMinimize functions",
-                            "psMinimizePowell()");
-
-    psMinimizePowell(min,
-                     myParams,
-                     myParamMask,
-                     myCoords,
-                     (psMinimizePowellFunc) myFunc);
-
-    printf("\nThe minimum is %f (expected: %f)\n", min->value, MIN_VALUE);
-
-    for (i=0;i<NUM_PARAMS;i++) {
-        printf("Parameter %d at the minimum is %.1f (expected: %.1f)\n", i,
-               myParams->data.F32[i], expectedParm[i]);
-
-        if (fabs(myParams->data.F32[i] - expectedParm[i]) > fabs(ERROR_TOLERANCE * expectedParm[i])) {
-            printf("ERROR: Parameter %d: (%.1f), expected was (%.1f)\n",
-                   i, myParams->data.F32[i], expectedParm[i]);
-            testStatus = false;
-        } else {
-            printf("Parameter %d: (%.1f), expected was (%.1f)\n",
-                   i, myParams->data.F32[i], expectedParm[i]);
-        }
-    }
-
-
-    psFree(myCoords);
-    psFree(myParams);
-    psFree(myParamMask);
-    psFree(min);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    printFooter(stdout,
-                "psMinimize functions",
-                "psMinimizePowell()",
-                testStatus);
-
-
-    return (!testStatus);
-}
-
-psS32 t01()
-{
-    psS32 currentId = psMemGetId();
-    psS32 memLeaks = 0;
-    psS32 i = 0;
-    psArray *myCoords;
-    psVector *myParams;
-    psMinimization *min;
-
-    psTraceSetLevel(".psLib", 0);
-    /**************************************************************************
-     *************************************************************************/
-    myParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
-    min = psMinimizationAlloc(100, 0.01);
-
-    myCoords = psArrayAlloc(N);
-    myCoords->n = N;
-    for (i=0;i<N;i++) {
-        myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
-        ((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++) {
-        expectedParm[i] = 2.32 + (float) (2 * i);
-        myParams->data.F32[i] = 0.0;
-        myParams->data.F32[i] = (float) i;
-        myParams->n++;
-    }
-
-    printPositiveTestHeader(stdout,
-                            "psMinimize functions",
-                            "psMinimizePowell()");
-
-    psMinimizePowell(min,
-                     myParams,
-                     NULL,
-                     myCoords,
-                     (psMinimizePowellFunc) myFunc);
-
-    printf("\nThe minimum is %f (expected: %f)\n", min->value, MIN_VALUE);
-
-    for (i=0;i<NUM_PARAMS;i++) {
-        printf("Parameter %d at the minimum is %.1f (expected: %.1f)\n", i,
-               myParams->data.F32[i], expectedParm[i]);
-
-        if (fabs(myParams->data.F32[i] - expectedParm[i]) > fabs(ERROR_TOLERANCE * expectedParm[i])) {
-            printf("ERROR: Parameter %d: (%.1f), expected was (%.1f)\n",
-                   i, myParams->data.F32[i], expectedParm[i]);
-            testStatus = false;
-        } else {
-            printf("Parameter %d: (%.1f), expected was (%.1f)\n",
-                   i, myParams->data.F32[i], expectedParm[i]);
-        }
-    }
-
-
-    psFree(myCoords);
-    psFree(myParams);
-    psFree(min);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    printFooter(stdout,
-                "psMinimize functions",
-                "psMinimizePowell()",
-                testStatus);
-
-
-    return (!testStatus);
-}
-
-psS32 t02()
-{
-    psS32 currentId = psMemGetId();
-    psS32 memLeaks = 0;
-    psS32 i = 0;
-    psArray *myCoords;
-    psVector *myParams;
-    psVector *myParamMask;
-    psMinimization *min;
-
-    psTraceSetLevel(".psLib", 0);
-    /**************************************************************************
-     *************************************************************************/
-    myParams = psVectorAlloc(NUM_PARAMS, PS_TYPE_F32);
-    myParamMask = psVectorAlloc(NUM_PARAMS, PS_TYPE_U8);
-    min = psMinimizationAlloc(100, 0.01);
-
-    myCoords = psArrayAlloc(N);
-    myCoords->n = N;
-    for (i=0;i<N;i++) {
-        myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
-        ((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++) {
-        expectedParm[i] = 2.32 + (float) (2 * i);
-        myParams->data.F32[i] = 0.0;
-        myParams->data.F32[i] = (float) i;
-        myParamMask->data.U8[i] = 0;
-        myParams->n++;
-        myParamMask->n++;
-    }
-
-    printPositiveTestHeader(stdout,
-                            "psMinimize functions",
-                            "psMinimizePowell(): various NULL inputs");
-
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error for null minimize.");
-    psMinimizePowell(NULL, myParams, myParamMask, myCoords, (psMinimizePowellFunc) myFunc);
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error for null parameter vector");
-    psMinimizePowell(min, NULL, myParamMask, myCoords,(psMinimizePowellFunc) myFunc);
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error for null coords.");
-    psMinimizePowell(min, myParams, myParamMask, NULL, (psMinimizePowellFunc) myFunc);
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error for null function");
-    psMinimizePowell(min, myParams, myParamMask, myCoords, NULL);
-
-    psFree(myCoords);
-    psFree(myParams);
-    psFree(myParamMask);
-    psFree(min);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    printFooter(stdout,
-                "psMinimize functions",
-                "psMinimizePowell(): various NULL inputs",
-                testStatus);
-
-
-    return (!testStatus);
-}
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    t00();
-    t01();
-    t02();
-}
Index: trunk/psLib/test/math/tst_psPolyFit1D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolyFit1D.c	(revision 42336)
+++ 	(revision )
@@ -1,493 +1,0 @@
-/*****************************************************************************
-This routine must ensure that various psLib functions which fit 1D polynomials
-to data work correctly.  There is a function genericTest() which creates
-vectors of data points (x and f), and populates them with the values from an
-arbitrary function setData().  It then calls appropriate 1D fitting function.
-It then evaluates the polynomial with the coefficients generated above and
-determines if they are within an error tolerance of the expected values.
- 
-XXX: Try null stats.
- *****************************************************************************/
-#include <stdio.h>
-#include <math.h>
-#include "pslib.h"
-#include "psTest.h"
-#define NUM_DATA 100
-#define POLY_ORDER 5
-#define A 2.0
-#define B 3.0
-#define C 4.0
-#define D 5.0
-#define E 6.0
-#define ERROR_TOLERANCE 0.10
-#define YERR 10.0
-#define VERBOSE 0
-#define NUM_ITERATIONS 5
-#define CLIP_SIGMA 4.0
-#define OUTLIERS true
-#define MASK_VALUE 1
-
-#define TS00_F_NULL  0x00000001
-#define TS00_F_F32  0x00000002
-#define TS00_F_F64  0x00000004
-#define TS00_F_S32  0x00000008
-#define TS00_X_NULL  0x00000010
-#define TS00_X_F32  0x00000020
-#define TS00_X_F64  0x00000040
-#define TS00_X_S32  0x00000080
-#define TS00_FERR_NULL  0x00000100
-#define TS00_FERR_F32  0x00000200
-#define TS00_FERR_F64  0x00000400
-#define TS00_FERR_S32  0x00000800
-#define TS00_MASK_NULL  0x00001000
-#define TS00_MASK_U8  0x00002000
-#define TS00_MASK_S32  0x00004000
-#define TS00_POLY_ORD  0x00008000
-#define TS00_POLY_CHEB  0x00010000
-#define TS00_CLIP_FIT  0x00020000
-
-psF32 setData(psF32 x)
-{
-    return(A + (B * x) + (C * x * x) + (D * x * x * x) + (E * x * x * x * x));
-}
-
-bool genericTest(
-    psU32 flags,
-    psS32 polyOrder,
-    psS32 numData,
-    psBool expectedRC)
-{
-    psS32 currentId = psMemGetId();
-    bool testStatus = true;
-    psS32 memLeaks = 0;
-    psPolynomial1D *myPoly = NULL;
-    psVector *x = NULL;
-    psVector *f = NULL;
-    psVector *mask = NULL;
-    psVector *fErr = NULL;
-    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    stats->clipSigma = CLIP_SIGMA;
-    stats->clipIter = NUM_ITERATIONS;
-
-    printPositiveTestHeader(stdout, "psMinimize functions", "1D Polynomial Fitting Functions");
-
-    if (expectedRC == false) {
-        printf("This test should generate an error message, and return NULL.\n");
-    }
-
-    if (flags & TS00_CLIP_FIT) {
-        printf("        performing a clip-fit\n");
-    } else {
-        printf("        performing a non clip-fit\n");
-    }
-
-    if (flags & TS00_POLY_ORD) {
-        printf(" using ordinary polynomials\n");
-        myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, polyOrder);
-    }
-
-    if (flags & TS00_POLY_CHEB) {
-        printf(" using chebyshev polynomials\n");
-        myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, polyOrder);
-    }
-
-    if (flags & TS00_X_NULL) {
-        printf(" using a NULL x vector\n");
-        numData = 30;
-    }
-
-    psVector *xTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *fTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    xTruth->n = numData;
-    fTruth->n = numData;
-    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using a known seed
-    for (int i = 0; i < numData; i++) {
-        xTruth->data.F64[i] = (flags & TS00_X_NULL) ? i : 2.0*psRandomUniform(rng) - 1.0;
-        fTruth->data.F64[i] = setData(xTruth->data.F64[i]);
-    }
-    if (flags & TS00_X_NULL && flags & TS00_POLY_CHEB) {
-        // Renormalise the indices
-        p_psNormalizeVectorRange(xTruth, -1.0, 1.0);
-    }
-    psFree(rng);
-    #if VERBOSE
-
-    for (int i = 0; i < numData; i++) {
-        printf("Original %d: %f\t%f\n", i, xTruth->data.F64[i], fTruth->data.F64[i]);
-    }
-    #endif
-
-    if (flags & TS00_X_F32) {
-        printf(" using a psF32 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_F32);
-
-        #if 0
-
-        if (flags & TS00_POLY_CHEB) {
-            p_psNormalizeVectorRange(x, -1.0, 1.0);
-        }
-        #endif
-
-    }
-
-    if (flags & TS00_X_S32) {
-        printf(" using a psS32 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_S32);
-
-        #if 0
-
-        if (flags & TS00_POLY_CHEB) {
-            p_psNormalizeVectorRange(x, -1, 1);
-        }
-        #endif
-
-    }
-
-    if (flags & TS00_X_F64) {
-        printf(" using a psF64 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_F64);
-
-        #if 0
-
-        if (flags & TS00_POLY_CHEB) {
-            p_psNormalizeVectorRange(x, -1.0, 1.0);
-        }
-        #endif
-
-    }
-
-    if (flags & TS00_F_NULL) {
-        printf(" using a NULL f vector\n");
-    }
-
-    if (flags & TS00_F_F32) {
-        printf(" using a psF32 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_F32);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F32[numData/4]*= 2.0;
-            f->data.F32[numData/2]*= 2.0;
-            f->data.F32[3*numData/4]*= 2.0;
-        }
-    }
-
-    if (flags & TS00_F_S32) {
-        printf(" using a psS32 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_S32);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.S32[numData/4]*= 2.0;
-            f->data.S32[numData/2]*= 2.0;
-            f->data.S32[3*numData/4]*= 2.0;
-        }
-
-    }
-
-    if (flags & TS00_F_F64) {
-        printf(" using a psF64 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_F64);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F64[numData/4]*= 2.0;
-            f->data.F64[numData/2]*= 2.0;
-            f->data.F64[3*numData/4]*= 2.0;
-        }
-    }
-
-    if (flags & TS00_FERR_NULL) {
-        printf(" using a NULL fErr vector\n");
-    }
-
-    if (flags & TS00_FERR_F32) {
-        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;
-        }
-    }
-
-    if (flags & TS00_FERR_S32) {
-        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;
-        }
-    }
-
-    if (flags & TS00_FERR_F64) {
-        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;
-        }
-    }
-
-    if (flags & TS00_MASK_NULL) {
-        printf(" using a NULL mask vector\n");
-    }
-
-    if (flags & TS00_MASK_U8) {
-        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;
-        }
-    }
-
-    if (flags & TS00_MASK_S32) {
-        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;
-        }
-    }
-
-    psPolynomial1D *rc = NULL;
-    if (flags & TS00_CLIP_FIT) {
-        rc = psVectorClipFitPolynomial1D(myPoly, stats, mask, MASK_VALUE, f, fErr, x);
-    } else {
-        rc = psVectorFitPolynomial1D(myPoly, mask, MASK_VALUE, f, fErr, x);
-    }
-
-    if (rc == NULL) {
-        if (expectedRC == true) {
-            printf("TEST ERROR: the 1D polynomial fitting function returned NULL.\n");
-            testStatus = false;
-        }
-    } else {
-        if (expectedRC == false) {
-            printf("TEST ERROR: the 1D polynomial fitting function returned non-NULL.\n");
-            testStatus = false;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<polyOrder+1;i++) {
-                printf("Polynomial coefficient %d is %0.1f\n", i, myPoly->coeff[i]);
-            }
-        }
-
-        psVector *result = psPolynomial1DEvalVector(myPoly, xTruth);
-        for (psS32 i=0; i<numData; i++) {
-            // Skip the outliers.
-            if ((i == numData/4) || (i == numData/2) || (i == 3*numData/4)) {
-                continue;
-            }
-            psF32 expectData = fTruth->data.F64[i];
-            psF32 actualData = result->data.F64[i];
-            if (fabs(actualData-expectData) > fabs(ERROR_TOLERANCE * expectData)) {
-                printf("TEST ERROR: Fitted data %d: %.1f --> %.1f vs %.1f\n",
-                       i, xTruth->data.F64[i], actualData, expectData);
-                testStatus = false;
-            } else {
-                if (VERBOSE) {
-                    printf("GOOD: Fitted data %d: %1.f --> %.1f vs %.1f\n",
-                           i, xTruth->data.F64[i], actualData, expectData);
-                }
-            }
-        }
-        psFree(result);
-    }
-
-    psMemCheckCorruption(1);
-    psFree(myPoly);
-    psFree(mask);
-    psFree(x);
-    psFree(f);
-    psFree(xTruth);
-    psFree(fTruth);
-    psFree(fErr);
-    psFree(stats);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout, "psMinimize functions", "1D Polynomial Fitting Functions", testStatus);
-
-    return (testStatus);
-}
-
-/*****************************************************************************
-We test a variety of polynomial fitting routines, types, and polynomial types
-here:
-    F32 tests: Ordinary polys, non-clip fit
-    F64 tests: Ordinary polys, non-clip fit
-    F32 tests: Chebyshev polys, non-clip fit
-    F64 tests: Chebyshev polys, non-clip fit
-    F32 tests: Ordinary polys, clip fit
-    F64 tests: Ordinary polys, clip fit
-    F32 tests: Chebyshev polys, clip fit
-    F64 tests: Chebyshev polys, clip fit
- *****************************************************************************/
-int main()
-{
-    psBool testStatus = true;
-    psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial1D", 0);
-    psTraceSetLevel("VectorFitPolynomial1DOrd", 0);
-    psTraceSetLevel("VectorFitPolynomial1DCheb", 0);
-    psTraceSetLevel("vectorFitPolynomial1DCheb", 0);
-    psTraceSetLevel("vectorFitPolynomial1DChebSlow", 0);
-    psTraceSetLevel("vectorFitPolynomial1DChebFast", 0);
-    psTraceSetLevel("psVectorFitPolynomial1D", 0);
-    psTraceSetLevel("p_psCreateChebyshevPolys", 0);
-
-    printPositiveTestHeader(stdout, "psMinimize functions: 1D Polynomial Fitting Functions", "");
-
-    //
-    // F32 tests: Ordinary polys, non-clip fit
-    //
-    // All Vectors non-NULL
-
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_NULL | TS00_X_NULL | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_NULL | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false);
-    // Unallowable vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_S32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_S32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_S32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false);
-
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-
-    //
-    // F64 tests: Ordinary polys, non-clip fit
-    //
-    // All Vectors non-NULL
-
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_NULL | TS00_X_NULL | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_NULL | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER, NUM_DATA, true);
-
-
-    //
-    // F32 tests: Chebyshev polys, non-clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_F_F32 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_NULL | TS00_X_NULL | TS00_F_F32 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_NULL | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_F_F32 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-
-
-    //
-    // F64 tests: Chebyshev polys, non-clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_F_F64 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_NULL | TS00_X_NULL | TS00_F_F64 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_NULL | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_F_F64 | TS00_POLY_CHEB, POLY_ORDER, NUM_DATA, true);
-
-    //
-    // F32 tests: Ordinary polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_NULL | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_NULL | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-
-
-    //
-    // F64 tests: Ordinary polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_NULL | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-
-
-    //
-    // F32 tests: Chebyshev polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_NULL | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_NULL | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-
-
-    //
-    // F64 tests: Chebyshev polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_F_F64 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_NULL | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F32 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_F_F64 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_F_F64 | TS00_POLY_CHEB | TS00_CLIP_FIT, POLY_ORDER, NUM_DATA, false);
-
-    printFooter(stdout, "psMinimize functions: 1D Polynomial Fitting Functions", "", testStatus);
-}
-
Index: trunk/psLib/test/math/tst_psPolyFit2D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolyFit2D.c	(revision 42336)
+++ 	(revision )
@@ -1,426 +1,0 @@
-/*****************************************************************************
-This routine must ensure that various psLib functions which fit 2D polynomials
-to data work correctly.  There is a function genericTest() which creates
-vectors of data points (x and f), and populates them with the values from an
-arbitrary function setData().  It then calls appropriate 2D fitting function.
-It then evaluates the polynomial with the coefficients generated above and
-determines if they are within an error tolerance of the expected values.
- *****************************************************************************/
-#include <stdio.h>
-#include <math.h>
-#include "pslib.h"
-#include "psTest.h"
-#define NUM_DATA 100
-#define POLY_ORDER_X 2
-#define POLY_ORDER_Y 3
-#define A 2.0
-#define B 3.0
-#define C 4.0
-#define D 5.0
-#define E 6.0
-#define F 4.0
-#define ERROR_TOLERANCE 0.10
-#define YERR 10.0
-#define VERBOSE 0
-#define NUM_ITERATIONS 5
-#define CLIP_SIGMA 4.0
-#define OUTLIERS true
-#define MASK_VALUE 1
-
-#define TS00_F_NULL  0x00000001
-#define TS00_F_F32  0x00000002
-#define TS00_F_F64  0x00000004
-#define TS00_F_S32  0x00000008
-#define TS00_X_NULL  0x00000010
-#define TS00_X_F32  0x00000020
-#define TS00_X_F64  0x00000040
-#define TS00_X_S32  0x00000080
-#define TS00_FERR_NULL  0x00000100
-#define TS00_FERR_F32  0x00000200
-#define TS00_FERR_F64  0x00000400
-#define TS00_FERR_S32  0x00000800
-#define TS00_MASK_NULL  0x00001000
-#define TS00_MASK_U8  0x00002000
-#define TS00_MASK_S32  0x00004000
-#define TS00_POLY_ORD  0x00008000
-#define TS00_POLY_CHEB  0x00010000
-#define TS00_CLIP_FIT  0x00020000
-#define TS00_Y_NULL  0x00100000
-#define TS00_Y_F32  0x00200000
-#define TS00_Y_F64  0x00400000
-#define TS00_Y_S32  0x00800000
-
-psF32 setData(psF32 x, psF32 y)
-{
-    return(A + (B * x) + (C * x * x) + (D * y) + (E * y * y) + (F * x * y));
-}
-
-psS32 genericTest(
-    psU32 flags,
-    psS32 polyOrderX,
-    psS32 polyOrderY,
-    psS32 numData,
-    psBool expectedRC)
-{
-    psS32 currentId = psMemGetId();
-    psS32 testStatus = true;
-    psS32 memLeaks = 0;
-    psPolynomial2D *myPoly = NULL;
-    psVector *x = NULL;
-    psVector *y = NULL;
-    psVector *f = NULL;
-    psVector *mask = NULL;
-    psVector *fErr = NULL;
-    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    stats->clipSigma = CLIP_SIGMA;
-    stats->clipIter = NUM_ITERATIONS;
-
-    printPositiveTestHeader(stdout, "psMinimize functions", "2D Polynomial Fitting Functions");
-
-    if (expectedRC == false) {
-        printf("This test should generate an error message, and return NULL.\n");
-    }
-
-    if (flags & TS00_CLIP_FIT) {
-        printf(" performing a clip-fit\n");
-    } else {
-        printf(" performing a non clip-fit\n");
-    }
-
-    if (flags & TS00_POLY_ORD) {
-        printf(" using ordinary polynomials\n");
-        myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, polyOrderX, polyOrderY);
-    }
-
-
-    psVector *xTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *yTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *fTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    xTruth->n = numData;
-    yTruth->n = numData;
-    fTruth->n = numData;
-    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
-    for (int i = 0; i < numData; i++) {
-        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        yTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        fTruth->data.F64[i] = setData(xTruth->data.F64[i], yTruth->data.F64[i]);
-    }
-    psFree(rng);
-
-    if (flags & TS00_X_NULL) {
-        printf(" using a NULL x vector\n");
-    }
-
-    if (flags & TS00_X_F32) {
-        printf(" using a psF32 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_X_S32) {
-        printf(" using a psS32 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_X_F64) {
-        printf(" using a psF64 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_F64);
-    }
-
-    if (flags & TS00_Y_NULL) {
-        printf(" using a NULL y vector\n");
-    }
-
-    if (flags & TS00_Y_F32) {
-        printf(" using a psF32 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_Y_S32) {
-        printf(" using a psS32 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_Y_F64) {
-        printf(" using a psF64 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_F64);
-    }
-
-    if (flags & TS00_F_NULL) {
-        printf(" using a NULL f vector\n");
-    }
-
-    if (flags & TS00_F_F32) {
-        printf(" using a psF32 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_F32);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F32[numData/4]*= 2.0;
-            f->data.F32[numData/2]*= 2.0;
-            f->data.F32[3*numData/4]*= 2.0;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original data %d: (%.1f %.1f)\n", i, (psF32) i, f->data.F32[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_F_S32) {
-        printf(" using a psS32 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_S32);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.S32[numData/4]*= 2.0;
-            f->data.S32[numData/2]*= 2.0;
-            f->data.S32[3*numData/4]*= 2.0;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original data %d: (%.1f %d)\n", i, (psF32) i, f->data.S32[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_F_F64) {
-        printf(" using a psF64 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_F64);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F64[numData/4]*= 2.0;
-            f->data.F64[numData/2]*= 2.0;
-            f->data.F64[3*numData/4]*= 2.0;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original data %d: (%.1f %.1f)\n", i, (psF32) i, f->data.F64[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_FERR_NULL) {
-        printf(" using a NULL fErr vector\n");
-    }
-
-    if (flags & TS00_FERR_F32) {
-        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;
-        }
-    }
-
-    if (flags & TS00_FERR_S32) {
-        printf(" using a psS32 fErr vector\n");
-        fErr = psVectorAlloc(numData, PS_TYPE_S32);
-        for (psS32 i=0;i<numData;i++) {
-            fErr->data.S32[i] = (psS32) YERR;
-        }
-    }
-
-    if (flags & TS00_FERR_F64) {
-        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;
-        }
-    }
-
-    if (flags & TS00_MASK_NULL) {
-        printf(" using a NULL mask vector\n");
-    }
-
-    if (flags & TS00_MASK_U8) {
-        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;
-        }
-    }
-
-    if (flags & TS00_MASK_S32) {
-        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;
-        }
-    }
-
-    psPolynomial2D *rc = NULL;
-    if (flags & TS00_CLIP_FIT) {
-        rc = psVectorClipFitPolynomial2D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y);
-    } else {
-        rc = psVectorFitPolynomial2D(myPoly, mask, MASK_VALUE, f, fErr, x, y);
-    }
-
-    if (rc == NULL) {
-        if (expectedRC == true) {
-            printf("TEST ERROR: the 2D polynomial fitting function returned NULL.\n");
-            testStatus = false;
-        }
-    } else {
-        if (expectedRC == false) {
-            printf("TEST ERROR: the 2D polynomial fitting function returned non-NULL.\n");
-            testStatus = false;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<polyOrderX+1;i++) {
-                for (psS32 j=0;j<polyOrderY+1;j++) {
-                    printf("Polynomial coefficient [%d][%d] is %0.1f\n", i, j, myPoly->coeff[i][j]);
-                }
-            }
-        }
-
-        psVector *result = psPolynomial2DEvalVector(myPoly, xTruth, yTruth);
-        for (psS32 i=0 ;i<numData; i++) {
-            // Skip the outliers.
-            if ((i == numData/4) || (i == numData/2) || (i == 3*numData/4)) {
-                continue;
-            }
-            psF64 actualData = result->data.F64[i];
-            psF64 expectData = fTruth->data.F64[i];
-
-            if (fabs(actualData-expectData) > fabs(ERROR_TOLERANCE * expectData)) {
-                printf("TEST ERROR: Fitted data %d: (%.1f), expected was (%.1f)\n",
-                       i, actualData, expectData);
-                testStatus = false;
-            } else {
-                if (VERBOSE) {
-                    printf("GOOD: Fitted data %d: (%.1f), expected was (%.1f)\n",
-                           i, actualData, expectData);
-                }
-            }
-        }
-        psFree(result);
-    }
-
-    psMemCheckCorruption(1);
-    psFree(myPoly);
-    psFree(mask);
-    psFree(xTruth);
-    psFree(yTruth);
-    psFree(fTruth);
-    psFree(x);
-    psFree(y);
-    psFree(f);
-    psFree(fErr);
-    psFree(stats);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout, "psMinimize functions", "2D Polynomial Fitting Functions", testStatus);
-
-    return (testStatus);
-}
-
-/*****************************************************************************
-We test a variety of polynomial fitting routines, types, and polynomial types
-here:
-    F32 tests: Ordinary polys, non-clip fit
-    F64 tests: Ordinary polys, non-clip fit
-    F32 tests: Chebyshev polys, non-clip fit
-    F64 tests: Chebyshev polys, non-clip fit
-    F32 tests: Ordinary polys, clip fit
-    F64 tests: Ordinary polys, clip fit
-    F32 tests: Chebyshev polys, clip fit
-    F64 tests: Chebyshev polys, clip fit
- *****************************************************************************/
-psS32 main()
-{
-    psBool testStatus = true;
-    psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial2D", 0);
-    psTraceSetLevel("VectorFitPolynomial2DOrd", 0);
-    psTraceSetLevel("psVectorFitPolynomial2D", 0);
-
-    printPositiveTestHeader(stdout, "psMinimize functions: 2D Polynomial Fitting Functions", "");
-
-    //
-    // F32 tests: Ordinary polys, non-clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_NULL | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_NULL | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F64 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-
-    //
-    // F64 tests: Ordinary polys, non-clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_NULL | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_NULL | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F32 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-
-    //
-    // F32 tests: Ordinary polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_NULL | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_NULL | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-
-    //
-    // F64 tests: Ordinary polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_NULL | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_NULL | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F32 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, NUM_DATA, false);
-
-    printFooter(stdout, "psMinimize functions: 2D Polynomial Fitting Functions", "", testStatus);
-}
Index: trunk/psLib/test/math/tst_psPolyFit3D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolyFit3D.c	(revision 42336)
+++ 	(revision )
@@ -1,479 +1,0 @@
-/*****************************************************************************
-This routine must ensure that various psLib functions which fit 3D polynomials
-to data work correctly.  There is a function genericTest() which creates
-vectors of data points (x and f), and populates them with the values from an
-arbitrary function setData().  It then calls appropriate 3D fitting function.
-It then evaluates the polynomial with the coefficients generated above and
-determines if they are within an error tolerance of the expected values.
- *****************************************************************************/
-#include <stdio.h>
-#include <math.h>
-#include "pslib.h"
-#include "psTest.h"
-#define NUM_DATA 100
-#define POLY_ORDER_X 2
-#define POLY_ORDER_Y 3
-#define POLY_ORDER_Z 2
-#define A 100.0
-#define B 2.0
-#define C 3.0
-#define D 4.0
-#define E 5.0
-#define F 4.0
-#define H 3.0
-#define J 3.0
-#define K 1.0
-#define L 5.0
-#define ERROR_TOLERANCE 0.10
-#define YERR 10.0
-#define VERBOSE 0
-#define NUM_ITERATIONS 5
-#define CLIP_SIGMA 4.0
-#define OUTLIERS true
-#define MASK_VALUE 1
-
-#define TS00_F_NULL  0x00000001
-#define TS00_F_F32  0x00000002
-#define TS00_F_F64  0x00000004
-#define TS00_F_S32  0x00000008
-#define TS00_X_NULL  0x00000010
-#define TS00_X_F32  0x00000020
-#define TS00_X_F64  0x00000040
-#define TS00_X_S32  0x00000080
-#define TS00_FERR_NULL  0x00000100
-#define TS00_FERR_F32  0x00000200
-#define TS00_FERR_F64  0x00000400
-#define TS00_FERR_S32  0x00000800
-#define TS00_MASK_NULL  0x00001000
-#define TS00_MASK_U8  0x00002000
-#define TS00_MASK_S32  0x00004000
-#define TS00_POLY_ORD  0x00008000
-#define TS00_POLY_CHEB  0x00010000
-#define TS00_CLIP_FIT  0x00020000
-#define TS00_Y_NULL  0x00100000
-#define TS00_Y_F32  0x00200000
-#define TS00_Y_F64  0x00400000
-#define TS00_Y_S32  0x00800000
-#define TS00_Z_NULL  0x01000000
-#define TS00_Z_F32  0x02000000
-#define TS00_Z_F64  0x04000000
-#define TS00_Z_S32  0x08000000
-
-psF32 setData(psF32 x, psF32 y, psF32 z)
-{
-    if (0) {
-        // Linear case, for testing.
-        return(A + (B * x) + (D * y) + (H * z));
-    } else {
-        return(A + (B * x) + (C * x * x) + (D * y) + (E * y * y) + (F * x * y) + (H * z) +
-               (J * z * z) + (K * x * z) + (L * y * z));
-    }
-}
-
-psS32 genericTest(
-    psU32 flags,
-    psS32 polyOrderX,
-    psS32 polyOrderY,
-    psS32 polyOrderZ,
-    psS32 numData,
-    psBool expectedRC)
-{
-    psS32 currentId = psMemGetId();
-    psS32 testStatus = true;
-    psS32 memLeaks = 0;
-    psPolynomial3D *myPoly = NULL;
-    psVector *x = NULL;
-    psVector *y = NULL;
-    psVector *z = NULL;
-    psVector *f = NULL;
-    psVector *mask = NULL;
-    psVector *fErr = NULL;
-    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    stats->clipSigma = CLIP_SIGMA;
-    stats->clipIter = NUM_ITERATIONS;
-
-    printPositiveTestHeader(stdout, "psMinimize functions", "3D Polynomial Fitting Functions");
-
-    psVector *xTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *yTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *zTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *fTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    xTruth->n = numData;
-    yTruth->n = numData;
-    zTruth->n = numData;
-    fTruth->n = numData;
-    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
-    for (int i = 0; i < numData; i++) {
-        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        yTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        zTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        fTruth->data.F64[i] = setData(xTruth->data.F64[i], yTruth->data.F64[i], zTruth->data.F64[i]);
-    }
-    psFree(rng);
-
-    if (expectedRC == false) {
-        printf("This test should generate an error message, and return NULL.\n");
-    }
-
-    if (flags & TS00_CLIP_FIT) {
-        printf(" performing a clip-fit\n");
-    } else {
-        printf(" performing a non clip-fit\n");
-    }
-
-    if (flags & TS00_POLY_ORD) {
-        printf(" using ordinary polynomials\n");
-        myPoly = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, polyOrderX, polyOrderY, polyOrderZ);
-    }
-
-    if (flags & TS00_X_NULL) {
-        printf(" using a NULL x vector\n");
-    }
-
-    if (flags & TS00_X_F32) {
-        printf(" using a psF32 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_X_S32) {
-        printf(" using a psS32 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_X_F64) {
-        printf(" using a psF64 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_F64);
-    }
-
-
-    if (flags & TS00_Y_NULL) {
-        printf(" using a NULL y vector\n");
-    }
-
-    if (flags & TS00_Y_F32) {
-        printf(" using a psF32 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_Y_S32) {
-        printf(" using a psS32 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_Y_F64) {
-        printf(" using a psF64 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_F64);
-    }
-
-    if (flags & TS00_Z_NULL) {
-        printf(" using a NULL z vector\n");
-    }
-
-    if (flags & TS00_Z_F32) {
-        printf(" using a psF32 z vector\n");
-        z = psVectorCopy(NULL, zTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_Z_S32) {
-        printf(" using a psS32 z vector\n");
-        z = psVectorCopy(NULL, zTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_Z_F64) {
-        printf(" using a psF64 z vector\n");
-        z = psVectorCopy(NULL, zTruth, PS_TYPE_F64);
-    }
-
-
-    if (flags & TS00_F_NULL) {
-        printf(" using a NULL f vector\n");
-    }
-
-    if (flags & TS00_F_F32) {
-        printf(" using a psF32 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_F32);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F32[numData/4]*= 2.0;
-            f->data.F32[numData/2]*= 2.0;
-            f->data.F32[3*numData/4]*= 2.0;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original data %d: (%.1f)\n", i, f->data.F32[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_F_S32) {
-        printf(" using a psS32 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_S32);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.S32[numData/4]*= 2.0;
-            f->data.S32[numData/2]*= 2.0;
-            f->data.S32[3*numData/4]*= 2.0;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original data %d: (%d)\n", i, f->data.S32[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_F_F64) {
-        printf(" using a psF64 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_F64);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F64[numData/4]*= 2.0;
-            f->data.F64[numData/2]*= 2.0;
-            f->data.F64[3*numData/4]*= 2.0;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original data %d: (%.1f)\n", i, f->data.F64[i]);
-            }
-        }
-    }
-
-    if (flags & TS00_FERR_NULL) {
-        printf(" using a NULL fErr vector\n");
-    }
-
-    if (flags & TS00_FERR_F32) {
-        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;
-        }
-    }
-
-    if (flags & TS00_FERR_S32) {
-        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;
-        }
-    }
-
-    if (flags & TS00_FERR_F64) {
-        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;
-        }
-    }
-
-    if (flags & TS00_MASK_NULL) {
-        printf(" using a NULL mask vector\n");
-    }
-
-    if (flags & TS00_MASK_U8) {
-        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;
-        }
-    }
-
-    if (flags & TS00_MASK_S32) {
-        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;
-        }
-    }
-
-    psPolynomial3D *rc = NULL;
-    if (flags & TS00_CLIP_FIT) {
-        rc = psVectorClipFitPolynomial3D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z);
-    } else {
-        rc = psVectorFitPolynomial3D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z);
-    }
-
-    if (rc == NULL) {
-        if (expectedRC == true) {
-            printf("TEST ERROR: the 3D polynomial fitting function returned NULL.\n");
-            testStatus = false;
-        }
-    } else {
-        if (expectedRC == false) {
-            printf("TEST ERROR: the 3D polynomial fitting function returned non-NULL.\n");
-            testStatus = false;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<polyOrderX+1;i++) {
-                for (psS32 j=0;j<polyOrderY+1;j++) {
-                    for (psS32 k=0;k<polyOrderZ+1;k++) {
-                        printf("Polynomial coefficient [%d][%d][%d] is %0.1f\n", i, j, k, myPoly->coeff[i][j][k]);
-                    }
-                }
-            }
-        }
-
-        psVector *result = psPolynomial3DEvalVector(myPoly, xTruth, yTruth, zTruth);
-        for (psS32 i=0 ;i<numData; i++) {
-            // Skip the outliers.
-            if ((i == numData/4) || (i == numData/2) || (i == 3*numData/4)) {
-                continue;
-            }
-            psF32 expectData = fTruth->data.F64[i];
-            psF32 actualData = result->data.F64[i];
-
-            if (fabs(actualData-expectData) > fabs(ERROR_TOLERANCE * expectData)) {
-                printf("TEST ERROR: Fitted data %d: (%.1f), expected was (%.1f)\n",
-                       i, actualData, expectData);
-                testStatus = false;
-            } else {
-                if (VERBOSE) {
-                    printf("GOOD: Fitted data %d: (%.1f), expected was (%.1f)\n",
-                           i, actualData, expectData);
-                }
-            }
-        }
-        psFree(result);
-    }
-
-    psMemCheckCorruption(1);
-    psFree(myPoly);
-    psFree(mask);
-    psFree(x);
-    psFree(y);
-    psFree(z);
-    psFree(f);
-    psFree(xTruth);
-    psFree(yTruth);
-    psFree(zTruth);
-    psFree(fTruth);
-    psFree(fErr);
-    psFree(stats);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout, "psMinimize functions", "3D Polynomial Fitting Functions", testStatus);
-
-    return (testStatus);
-}
-
-/*****************************************************************************
-We test a variety of polynomial fitting routines, types, and polynomial types
-here:
-    F32 tests: Ordinary polys, non-clip fit
-    F64 tests: Ordinary polys, non-clip fit
-    F32 tests: Chebyshev polys, non-clip fit
-    F64 tests: Chebyshev polys, non-clip fit
-    F32 tests: Ordinary polys, clip fit
-    F64 tests: Ordinary polys, clip fit
-    F32 tests: Chebyshev polys, clip fit
-    F64 tests: Chebyshev polys, clip fit
- *****************************************************************************/
-psS32 main()
-{
-    psBool testStatus = true;
-    psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial3D", 0);
-    psTraceSetLevel("VectorFitPolynomial3DOrd", 0);
-    psTraceSetLevel("psVectorFitPolynomial3D", 0);
-
-    printPositiveTestHeader(stdout, "psMinimize functions: 3D Polynomial Fitting Functions", "");
-
-    //
-    // F32 tests: Ordinary polys, non-clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_NULL | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_NULL | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F64 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F64 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-
-    //
-    // F64 tests: Ordinary polys, non-clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_NULL | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_NULL | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F32 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F32 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-
-    //
-    // F32 tests: Ordinary polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_NULL | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_NULL | TS00_Z_NULL | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_NULL | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F64 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-
-    //
-    // F64 tests: Ordinary polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_NULL | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_NULL | TS00_Z_NULL | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_NULL | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F32 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F32 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, NUM_DATA, false);
-
-    printFooter(stdout, "psMinimize functions: 3D Polynomial Fitting Functions", "", testStatus);
-}
Index: trunk/psLib/test/math/tst_psPolyFit4D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolyFit4D.c	(revision 42336)
+++ 	(revision )
@@ -1,667 +1,0 @@
-/*****************************************************************************
-This routine must ensure that various psLib functions which fit 4D polynomials
-to data work correctly.  There is a function genericTest() which creates
-vectors of data points (x and f), and populates them with the values from an
-arbitrary function setData().  It then calls appropriate 4D fitting function.
-It then evaluates the polynomial with the coefficients generated above and
-determines if they are within an error tolerance of the expected values.
- *****************************************************************************/
-#include <stdio.h>
-#include <math.h>
-#include "pslib.h"
-#include "psTest.h"
-#define NUM_DATA 200
-#define POLY_ORDER_X 1
-#define POLY_ORDER_Y 1
-#define POLY_ORDER_Z 1
-#define POLY_ORDER_T 1
-#define A 100.0
-#define B 2.0
-#define C 3.0
-#define D 4.0
-#define E 5.0
-#define F 6.0
-#define H 3.0
-#define J 3.0
-#define K 1.0
-#define L 5.0
-#define M 4.0
-#define N 3.0
-#define O 2.0
-#define P 1.0
-#define Q 5.0
-#define ERROR_TOLERANCE 0.05
-#define YERR 0.1
-#define VERBOSE 0
-#define NUM_ITERATIONS 5
-#define CLIP_SIGMA 3.0
-#define OUTLIERS true
-#define MASK_VALUE 1
-
-#define TS00_F_NULL  0x00000001
-#define TS00_F_F32  0x00000002
-#define TS00_F_F64  0x00000004
-#define TS00_F_S32  0x00000008
-#define TS00_X_NULL  0x00000010
-#define TS00_X_F32  0x00000020
-#define TS00_X_F64  0x00000040
-#define TS00_X_S32  0x00000080
-#define TS00_FERR_NULL  0x00000100
-#define TS00_FERR_F32  0x00000200
-#define TS00_FERR_F64  0x00000400
-#define TS00_FERR_S32  0x00000800
-#define TS00_MASK_NULL  0x00001000
-#define TS00_MASK_U8  0x00002000
-#define TS00_MASK_S32  0x00004000
-#define TS00_POLY_ORD  0x00008000
-#define TS00_POLY_CHEB  0x00010000
-#define TS00_CLIP_FIT  0x00020000
-#define TS00_Y_NULL  0x00100000
-#define TS00_Y_F32  0x00200000
-#define TS00_Y_F64  0x00400000
-#define TS00_Y_S32  0x00800000
-#define TS00_Z_NULL  0x01000000
-#define TS00_Z_F32  0x02000000
-#define TS00_Z_F64  0x04000000
-#define TS00_Z_S32  0x08000000
-#define TS00_T_NULL  0x10000000
-#define TS00_T_F32  0x20000000
-#define TS00_T_F64  0x40000000
-#define TS00_T_S32  0x80000000
-
-psF32 setData(psF32 x, psF32 y, psF32 z, psF32 t)
-{
-    if (0) {
-        // Linear case, for testing.
-        return(A + (B * x) + (C * y) + (D * z) + (E * t));
-    } else {
-        #if 0
-        return(A + (B * x) + (C * y) + (D * z) + (E * t) +
-               (F * x * x) + (H * y * y) + (J * z * z) + (K * t * t) +
-               (L * x * y) + (M * x * z) + (N * x * t) + (O * y * z) + (P * y * t) + (Q * z * t));
-        #else
-
-        return A + (B * x) + (C * y) + (D * z) + (E * t) + (F * x * y);
-        #endif
-
-    }
-}
-
-bool genericTest(
-    psU32 flags,
-    psS32 polyOrderX,
-    psS32 polyOrderY,
-    psS32 polyOrderZ,
-    psS32 polyOrderT,
-    psS32 numData,
-    psBool expectedRC)
-{
-    psS32 currentId = psMemGetId();
-    bool testStatus = true;
-    psS32 memLeaks = 0;
-    psPolynomial4D *myPoly = NULL;
-    psVector *x = NULL;
-    psVector *y = NULL;
-    psVector *z = NULL;
-    psVector *t = NULL;
-    psVector *f = NULL;
-    psVector *mask = NULL;
-    psVector *fErr = NULL;
-    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    stats->clipSigma = CLIP_SIGMA;
-    stats->clipIter = NUM_ITERATIONS;
-
-    printPositiveTestHeader(stdout, "psMinimize functions", "4D Polynomial Fitting Functions");
-
-    psVector *xTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *yTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *zTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *tTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    psVector *fTruth = psVectorAlloc(numData, PS_TYPE_F64);
-    xTruth->n = numData;
-    yTruth->n = numData;
-    zTruth->n = numData;
-    tTruth->n = numData;
-    fTruth->n = numData;
-    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
-    for (int i = 0; i < numData; i++) {
-        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        yTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        zTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        tTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
-        fTruth->data.F64[i] = setData(xTruth->data.F64[i], yTruth->data.F64[i],
-                                      zTruth->data.F64[i], tTruth->data.F64[i]);
-    }
-    psFree(rng);
-
-    if (expectedRC == false) {
-        printf("This test should generate an error message, and return NULL.\n");
-    }
-
-    if (flags & TS00_CLIP_FIT) {
-        printf(" performing a clip-fit\n");
-    } else {
-        printf(" performing a non clip-fit\n");
-    }
-
-    if (flags & TS00_POLY_ORD) {
-        printf(" using ordinary polynomials\n");
-        myPoly = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, polyOrderX, polyOrderY,
-                                     polyOrderZ, polyOrderT);
-
-        #if 1
-
-        for (int ix = 0; ix < polyOrderX + 1; ix++) {
-            for (int iy = 0; iy < polyOrderY + 1; iy++) {
-                for (int iz = 0; iz < polyOrderZ + 1; iz++) {
-                    for (int it = 0; it < polyOrderT + 1; it++) {
-                        myPoly->mask[ix][iy][iz][it] = 0xff; // Mask it out
-                    }
-                }
-            }
-        }
-
-        // Put these back in
-        myPoly->mask[0][0][0][0] = 0;   // A
-        myPoly->mask[1][0][0][0] = 0;   // B * x
-        myPoly->mask[0][1][0][0] = 0;   // C * y
-        myPoly->mask[0][0][1][0] = 0;   // D * z
-        myPoly->mask[0][0][0][1] = 0;   // E * t
-        myPoly->mask[1][1][0][0] = 0;   // F * xy
-        #endif
-
-    }
-
-    if (flags & TS00_X_NULL) {
-        printf(" using a NULL x vector\n");
-    }
-
-    if (flags & TS00_X_F32) {
-        printf(" using a psF32 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_X_S32) {
-        printf(" using a psS32 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_X_F64) {
-        printf(" using a psF64 x vector\n");
-        x = psVectorCopy(NULL, xTruth, PS_TYPE_F64);
-    }
-
-
-    if (flags & TS00_Y_NULL) {
-        printf(" using a NULL y vector\n");
-    }
-
-    if (flags & TS00_Y_F32) {
-        printf(" using a psF32 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_Y_S32) {
-        printf(" using a psS32 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_Y_F64) {
-        printf(" using a psF64 y vector\n");
-        y = psVectorCopy(NULL, yTruth, PS_TYPE_F64);
-    }
-
-    if (flags & TS00_Z_NULL) {
-        printf(" using a NULL z vector\n");
-    }
-
-    if (flags & TS00_Z_F32) {
-        printf(" using a psF32 z vector\n");
-        z = psVectorCopy(NULL, zTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_Z_S32) {
-        printf(" using a psS32 z vector\n");
-        z = psVectorCopy(NULL, zTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_Z_F64) {
-        printf(" using a psF64 z vector\n");
-        z = psVectorCopy(NULL, zTruth, PS_TYPE_F64);
-    }
-
-    if (flags & TS00_T_NULL) {
-        printf(" using a NULL t vector\n");
-    }
-
-    if (flags & TS00_T_F32) {
-        printf(" using a psF32 t vector\n");
-        t = psVectorCopy(NULL, tTruth, PS_TYPE_F32);
-    }
-
-    if (flags & TS00_T_S32) {
-        printf(" using a psS32 t vector\n");
-        t = psVectorCopy(NULL, tTruth, PS_TYPE_S32);
-    }
-
-    if (flags & TS00_T_F64) {
-        printf(" using a psF64 t vector\n");
-        t = psVectorCopy(NULL, tTruth, PS_TYPE_F64);
-    }
-
-
-    if (flags & TS00_F_NULL) {
-        printf(" using a NULL f vector\n");
-    }
-
-    if (flags & TS00_F_F32) {
-        printf(" using a psF32 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_F32);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F32[numData/4] *= 2.0;
-            f->data.F32[numData/2] *= 2.0;
-            f->data.F32[3*numData/4] *= 2.0;
-        }
-    }
-
-    if (flags & TS00_F_S32) {
-        printf(" using a psS32 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_S32);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.S32[numData/4] *= 2.0;
-            f->data.S32[numData/2] *= 2.0;
-            f->data.S32[3*numData/4] *= 2.0;
-        }
-    }
-
-    if (flags & TS00_F_F64) {
-        printf(" using a psF64 f vector\n");
-        f = psVectorCopy(NULL, fTruth, PS_TYPE_F64);
-        // Set a few outliers in the data.
-        if (OUTLIERS && (flags & TS00_CLIP_FIT)) {
-            f->data.F64[numData/4] *= 2.0;
-            f->data.F64[numData/2] *= 2.0;
-            f->data.F64[3*numData/4] *= 2.0;
-        }
-    }
-
-    if (flags & TS00_FERR_NULL) {
-        printf(" using a NULL fErr vector\n");
-    }
-
-    if (flags & TS00_FERR_F32) {
-        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;
-        }
-    }
-
-    if (flags & TS00_FERR_S32) {
-        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;
-        }
-    }
-
-    if (flags & TS00_FERR_F64) {
-        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;
-        }
-    }
-
-    if (flags & TS00_MASK_NULL) {
-        printf(" using a NULL mask vector\n");
-    }
-
-    if (flags & TS00_MASK_U8) {
-        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;
-        }
-    }
-
-    if (flags & TS00_MASK_S32) {
-        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;
-        }
-    }
-
-    psPolynomial4D *rc = NULL;
-    if (flags & TS00_CLIP_FIT) {
-        rc = psVectorClipFitPolynomial4D(myPoly, stats, mask, MASK_VALUE, f, fErr, x, y, z, t);
-    } else {
-        rc = psVectorFitPolynomial4D(myPoly, mask, MASK_VALUE, f, fErr, x, y, z, t);
-    }
-
-    if (rc == NULL) {
-        if (expectedRC == true) {
-            printf("TEST ERROR: the 4D polynomial fitting function returned NULL.\n");
-            testStatus = false;
-        }
-    } else {
-        if (expectedRC == false) {
-            printf("TEST ERROR: the 4D polynomial fitting function returned non-NULL.\n");
-            testStatus = false;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<polyOrderX+1;i++) {
-                for (psS32 j=0;j<polyOrderY+1;j++) {
-                    for (psS32 k=0;k<polyOrderZ+1;k++) {
-                        for (psS32 l=0;l<polyOrderT+1;l++) {
-                            printf("Polynomial coefficient [%d][%d][%d][%d] is %0.1f\n",
-                                   i, j, k, l, myPoly->coeff[i][j][k][l]);
-                        }
-                    }
-                }
-            }
-        }
-
-        psVector *result = psPolynomial4DEvalVector(myPoly, xTruth, yTruth, zTruth, tTruth);
-        for (int i=0;i<numData; i++) {
-            // Skip the outliers.
-            if ((i == numData/4) || (i == numData/2) || (i == 3*numData/4)) {
-                continue;
-            }
-            psF32 expectData = fTruth->data.F64[i];
-            psF32 actualData = result->data.F64[i];
-
-            if (fabs(actualData-expectData) > fabs(ERROR_TOLERANCE * expectData)) {
-                printf("TEST ERROR: Fitted data %d: (%f), expected was (%f)\n",
-                       i, actualData, expectData);
-                testStatus = false;
-            } else {
-                if (VERBOSE) {
-                    printf("GOOD: Fitted data %d: (%.1f), expected was (%.1f)\n",
-                           i, actualData, expectData);
-                }
-            }
-        }
-        psFree(result);
-    }
-
-    psMemCheckCorruption(1);
-    psFree(myPoly);
-    psFree(mask);
-    psFree(x);
-    psFree(y);
-    psFree(z);
-    psFree(t);
-    psFree(f);
-    psFree(xTruth);
-    psFree(yTruth);
-    psFree(zTruth);
-    psFree(tTruth);
-    psFree(fTruth);
-    psFree(fErr);
-    psFree(stats);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout, "psMinimize functions", "4D Polynomial Fitting Functions", testStatus);
-
-    return (testStatus);
-}
-
-/*****************************************************************************
-We test a variety of polynomial fitting routines, types, and polynomial types
-here:
-    F32 tests: Ordinary polys, non-clip fit
-    F64 tests: Ordinary polys, non-clip fit
-    F32 tests: Chebyshev polys, non-clip fit
-    F64 tests: Chebyshev polys, non-clip fit
-    F32 tests: Ordinary polys, clip fit
-    F64 tests: Ordinary polys, clip fit
-    F32 tests: Chebyshev polys, clip fit
-    F64 tests: Chebyshev polys, clip fit
- *****************************************************************************/
-int main()
-{
-    psBool testStatus = true;
-    psLogSetFormat("HLNM");
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psVectorClipFitPolynomial4D", 0);
-    psTraceSetLevel("VectorFitPolynomial4DOrd", 0);
-    psTraceSetLevel("psVectorFitPolynomial4D", 0);
-
-    printPositiveTestHeader(stdout, "psMinimize functions: 4D Polynomial Fitting Functions", "");
-
-    //
-    // F32 tests: Ordinary polys, non-clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32 | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, true);
-
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_NULL | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_NULL
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_NULL | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_NULL | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F64 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F64
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F64 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-
-    //
-    // F64 tests: Ordinary polys, non-clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_NULL | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_NULL
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_NULL | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_NULL | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F32 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F32
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F32 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F32 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD, POLY_ORDER_X, POLY_ORDER_Y, POLY_ORDER_Z,
-                              POLY_ORDER_T, NUM_DATA, false);
-
-    //
-    // F32 tests: Ordinary polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_NULL | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_NULL | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_NULL
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_NULL | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_NULL | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F64 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F64
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F32 | TS00_X_F32 | TS00_Y_F32 | TS00_Z_F32
-                              | TS00_T_F32 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-
-    //
-    // F64 tests: Ordinary polys, clip fit
-    //
-    // All Vectors non-NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, true);
-    // Some Vectors NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_NULL | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, true);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_NULL | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_NULL | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_NULL
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_NULL | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    // F-vector NULL
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_NULL | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_NULL | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    // Mismatch vector types
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F32 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F32 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F32 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F32
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F32 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_U8 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F32 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-    testStatus &= genericTest(TS00_MASK_S32 | TS00_FERR_F64 | TS00_X_F64 | TS00_Y_F64 | TS00_Z_F64
-                              | TS00_T_F64 | TS00_F_F64 | TS00_POLY_ORD | TS00_CLIP_FIT, POLY_ORDER_X, POLY_ORDER_Y,
-                              POLY_ORDER_Z, POLY_ORDER_T, NUM_DATA, false);
-
-    printf("Status: %x\n", testStatus);
-
-    printFooter(stdout, "psMinimize functions: 4D Polynomial Fitting Functions", "", testStatus);
-}
-
Index: trunk/psLib/test/math/tst_psPolynomial.c
===================================================================
--- trunk/psLib/test/math/tst_psPolynomial.c	(revision 42336)
+++ 	(revision )
@@ -1,353 +1,0 @@
-/** tst_Func00.c
-*
-*    This routine must ensure that the psPolynomial structures are
-*    allocated and deallocated by the psPolynomialXXXlloc() procedures.
-*    It also calls the various psPolynomialXXXEval() procedures.
-*
-*    The F32 and F64 polynomials are tested for all orders (1 - 4) and for
-*    both ordinary and chebyshev polynomials.
-*
-*    NOTE: This test code requries the stdout file to verify that the results
-*    are good.
-*
-*    XXX: Modify these tests so that polynomials with a variety of different
-*    orders are created.
-* 
-*    XXX: Compare to FLT_EPSILON
-* 
-*    @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
-*    @date $Date: 2006-02-02 21:05:51 $
-*
-*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
-*
-*****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-
-// Defines
-#define ORDER    3
-
-static psS32 testPolynomial1DAlloc(void);
-static psS32 testPolynomial2DAlloc(void);
-static psS32 testPolynomial3DAlloc(void);
-static psS32 testPolynomial4DAlloc(void);
-
-testDescription tests[] = {
-                              {testPolynomial1DAlloc,578,"psPolynomial1DAlloc",0,false},
-                              {testPolynomial2DAlloc,578,"psPolynomial2DAlloc",0,false},
-                              {testPolynomial3DAlloc,578,"psPolynomial3DAlloc",0,false},
-                              {testPolynomial4DAlloc,578,"psPolynomial4DAlloc",0,false},
-                              {NULL}
-                          };
-
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-
-    return !runTestSuite(stderr,"psPolynomialXD", tests, argc, argv);
-}
-
-
-// This test will allocate a 1D polynomial and verify the structure allocated
-psS32 testPolynomial1DAlloc(void)
-{
-    psPolynomial1D*  my1DPoly  = NULL;
-
-    // Allocate polynomial
-    my1DPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, ORDER);
-    // Verify structure allocated
-    if(my1DPoly == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
-        return 1;
-    }
-    // Verify polynomial structure members set properly
-    if(my1DPoly->nX != ORDER) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my1DPoly->nX, ORDER);
-        return 2;
-    }
-    if(my1DPoly->type != PS_POLYNOMIAL_ORD) {
-        psError(PS_ERR_UNKNOWN,true,"Type %d not as expected %d",
-                my1DPoly->type, PS_POLYNOMIAL_ORD);
-        return 3;
-    }
-    for(psS32 i = 0; i < ORDER+1; i++) {
-        if(my1DPoly->coeff[i] != 0.0) {
-            psError(PS_ERR_UNKNOWN,true,"Coeff[%d] %lg not as expected %lg",
-                    i, my1DPoly->coeff[i], 0.0);
-            return 4;
-        }
-        if(my1DPoly->coeffErr[i] != 0.0) {
-            psError(PS_ERR_UNKNOWN,true,"CoeffErr[%d] %lg not as expected %lg",
-                    i, my1DPoly->coeffErr[i], 0.0);
-            return 5;
-        }
-        if(my1DPoly->mask[i] != 0) {
-            psError(PS_ERR_UNKNOWN,true,"Mask[%d] %d not as expected %d",
-                    i, my1DPoly->mask[i], 0);
-            return 6;
-        }
-    }
-    psFree(my1DPoly);
-
-    if (0) {
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, -1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 7;
-        }
-    }
-
-    return 0;
-}
-
-// This test will allocate a 2D polynomial and verify the structure allocated
-psS32 testPolynomial2DAlloc(void)
-{
-    psPolynomial2D* my2DPoly = NULL;
-
-    // Allocate polynomial
-    my2DPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, ORDER,ORDER+1);
-    // Verify structure allocated
-    if(my2DPoly == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
-        return 1;
-    }
-    // Verify polynomial structure members set properly
-    if(my2DPoly->nX != ORDER) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my2DPoly->nX, ORDER);
-        return 2;
-    }
-    // Verify polynomial structure members set properly
-    if(my2DPoly->nY != ORDER+1) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my2DPoly->nY, ORDER+1);
-        return 3;
-    }
-    if(my2DPoly->type != PS_POLYNOMIAL_ORD) {
-        psError(PS_ERR_UNKNOWN,true,"Type %d not as expected %d",
-                my2DPoly->type, PS_POLYNOMIAL_ORD);
-        return 4;
-    }
-
-    for(psS32 i = 0; i < ORDER+1; i++) {
-        for(psS32 j = 0; j < ORDER+2; j++) {
-            if(fabs(my2DPoly->coeff[i][j]) > FLT_EPSILON) {
-                psError(PS_ERR_UNKNOWN,true,"Coeff[%d][%d] %lg not as expected %lg",
-                        i, j, my2DPoly->coeff[i][j], 0.0);
-                return 5;
-            }
-            if(my2DPoly->coeffErr[i][j] != 0.0) {
-                psError(PS_ERR_UNKNOWN,true,"CoeffErr[%d][%d] %lg not as expected %lg",
-                        i, j, my2DPoly->coeffErr[i][j], 0.0);
-                return 6;
-            }
-            if(my2DPoly->mask[i][j] != 0) {
-                psError(PS_ERR_UNKNOWN,true,"Mask[%d][%d] %d not as expected %d",
-                        i, j, my2DPoly->mask[i][j], 0);
-                return 7;
-            }
-        }
-    }
-    psFree(my2DPoly);
-
-    if (0) {
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, -1, 1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 8;
-        }
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 1, -1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 9;
-        }
-    }
-    return 0;
-}
-
-// This test will allocate a 3D polynomial and verify the structure allocated
-psS32 testPolynomial3DAlloc(void)
-{
-    psPolynomial3D* my3DPoly = NULL;
-
-    // Allocate polynomial
-    my3DPoly = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, ORDER, ORDER+1, ORDER+2);
-    // Verify structure allocated
-    if(my3DPoly == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
-        return 1;
-    }
-    // Verify polynomial structure members set properly
-    if(my3DPoly->nX != ORDER) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my3DPoly->nX, ORDER);
-        return 2;
-    }
-    // Verify polynomial structure members set properly
-    if(my3DPoly->nY != ORDER+1) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my3DPoly->nY, ORDER+1);
-        return 3;
-    }
-    // Verify polynomial structure members set properly
-    if(my3DPoly->nZ != ORDER+2) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my3DPoly->nZ, ORDER+2);
-        return 4;
-    }
-    if(my3DPoly->type != PS_POLYNOMIAL_ORD) {
-        psError(PS_ERR_UNKNOWN,true,"Type %d not as expected %d",
-                my3DPoly->type, PS_POLYNOMIAL_ORD);
-        return 5;
-    }
-    for(psS32 i = 0; i < ORDER+1; i++) {
-        for(psS32 j = 0; j < ORDER+2; j++) {
-            for(psS32 k = 0; k < ORDER+3; k++) {
-                if(my3DPoly->coeff[i][j][k] != 0.0) {
-                    psError(PS_ERR_UNKNOWN,true,"Coeff[%d][%d][%d] %lg not as expected %lg",
-                            i, j, k, my3DPoly->coeff[i][j][k], 0.0);
-                    return 6;
-                }
-                if(my3DPoly->coeffErr[i][j][k] != 0.0) {
-                    psError(PS_ERR_UNKNOWN,true,"CoeffErr[%d][%d][%d] %lg not as expected %lg",
-                            i, j, k, my3DPoly->coeffErr[i][j][k], 0.0);
-                    return 7;
-                }
-                if(my3DPoly->mask[i][j][k] != 0) {
-                    psError(PS_ERR_UNKNOWN,true,"Mask[%d][%d] %d not as expected %d",
-                            i, j, k, my3DPoly->mask[i][j][k], 0);
-                    return 8;
-                }
-            }
-        }
-    }
-    psFree(my3DPoly);
-
-    if (0) {
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, -1, 1, 1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 9;
-        }
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, 1, -1, 1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 10;
-        }
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, 1, 1, -1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 11;
-        }
-    }
-
-    return 0;
-}
-
-// This test will allocate a 4D polynomial and verify the structure allocated
-psS32 testPolynomial4DAlloc(void)
-{
-    psPolynomial4D* my4DPoly = NULL;
-
-    // Allocate polynomial
-    my4DPoly = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, ORDER,ORDER+1,ORDER+2,ORDER+3);
-    // Verify structure allocated
-    if(my4DPoly == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Returned NULL not expected");
-        return 1;
-    }
-    // Verify polynomial structure members set properly
-    if(my4DPoly->nX != ORDER) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my4DPoly->nX, ORDER);
-        return 2;
-    }
-    // Verify polynomial structure members set properly
-    if(my4DPoly->nY != ORDER+1) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my4DPoly->nX, ORDER+1);
-        return 3;
-    }
-    // Verify polynomial structure members set properly
-    if(my4DPoly->nZ != ORDER+2) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my4DPoly->nZ, ORDER+2);
-        return 4;
-    }
-    // Verify polynomial structure members set properly
-    if(my4DPoly->nT != ORDER+3) {
-        psError(PS_ERR_UNKNOWN,true,"Number of terms %d not as expected %d",
-                my4DPoly->nT, ORDER+3);
-        return 5;
-    }
-    if(my4DPoly->type != PS_POLYNOMIAL_ORD) {
-        psError(PS_ERR_UNKNOWN,true,"Type %d not as expected %d",
-                my4DPoly->type, PS_POLYNOMIAL_ORD);
-        return 6;
-    }
-    for(psS32 i = 0; i < ORDER+1; i++) {
-        for(psS32 j = 0; j < ORDER+2; j++) {
-            for(psS32 k = 0; k < ORDER+3; k++) {
-                for(psS32 l = 0; l < ORDER+4; l++) {
-                    if(my4DPoly->coeff[i][j][k][l] != 0.0) {
-                        psError(PS_ERR_UNKNOWN,true,"Coeff[%d][%d][%d][%d] %lg not as expected %lg",
-                                i, j, k, l, my4DPoly->coeff[i][j][k][l], 0.0);
-                        return 7;
-                    }
-                    if(my4DPoly->coeffErr[i][j][k][l] != 0.0) {
-                        psError(PS_ERR_UNKNOWN,true,"CoeffErr[%d][%d][%d][l] %lg not as expected %lg",
-                                i, j, k, l, my4DPoly->coeffErr[i][j][k][l], 0.0);
-                        return 8;
-                    }
-                    if(my4DPoly->mask[i][j][k][l] != 0) {
-                        psError(PS_ERR_UNKNOWN,true,"Mask[%d][%d][%d][%d] %d not as expected %d",
-                                i, j, k, l, my4DPoly->mask[i][j][k][l], 0);
-                        return 9;
-                    }
-                }
-            }
-        }
-    }
-    psFree(my4DPoly);
-
-    if (0) {
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, -1, 1, 1, 1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 10;
-        }
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, -1, 1, 1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 11;
-        }
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, 1, -1, 1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 12;
-        }
-        // Attempt to allocate with negative order
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error msg for negative terms");
-        if(psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, 1, 1, 1, -1) != NULL) {
-            psError(PS_ERR_UNKNOWN,true,"Returned structure but expected NULL");
-            return 13;
-        }
-    }
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psPolynomialEval1D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolynomialEval1D.c	(revision 42336)
+++ 	(revision )
@@ -1,197 +1,0 @@
-/** tst_psFunc08.c
-*
-*  This test driver will exercise the psPolynomialXDEval functions for both
-*  ORD and CHEB type polynomials.
-*
-*  @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
-*  which one diminsion is constant (n == 1).
-*
-*  XXX: define ORDERS, not TERMS
-*
-*
-* Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
-*
-***************************************************************************/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define  TERMS        4
-#define  TESTPOINTS   5
-#define  ERROR_TOL    0.001
-
-static psS32 testPoly1DEval(void);
-static psS32 testPoly1DEvalVector(void);
-
-testDescription tests[] = {
-                              {testPoly1DEval,000,"psPolynomial1DEval",0,false},
-                              {testPoly1DEvalVector,000,"psPolynomial1DEvalVector",0,false},
-                              {NULL}
-                          };
-
-psF32 poly1DCoeff[TERMS]        = { -4.3, 2.3, -3.2, 1.9};
-psF64 Dpoly1DCoeff[TERMS]        = { -4.3, 2.3, -3.2, 1.9};
-psF32 poly1DMask[TERMS]         = {    0,   0,    1,   0  };
-
-psF32 poly1DXValue[TESTPOINTS]   = { 2.550000,    -9.8000,   0.00134,   -12.2500,   0.000};
-psF64 Dpoly1DXValue[TESTPOINTS]  = { 2.550000,    -9.8000,   0.00134,   -12.2500,   0.000};
-psF32 poly1DXResult[TESTPOINTS]  = {33.069613, -1815.1048, -4.296918, -3525.1797, -4.3000};
-psF64 Dpoly1DXResult[TESTPOINTS] = {33.069613, -1815.1048, -4.296918, -3525.1797, -4.3000};
-
-psF32 poly1DXChebValue[TESTPOINTS]   = { -0.99,    -0.33,     0.125,    0.564,    0.875};
-psF64 Dpoly1DXChebValue[TESTPOINTS]  = { -0.99,    -0.33,     0.125,    0.564,    0.875};
-psF32 poly1DXChebResult[TESTPOINTS]  = { -1.401196, 1.016252, 0.257813, 0.089625, 1.429688};
-psF64 Dpoly1DXChebResult[TESTPOINTS] = { -1.401196, 1.016252, 0.257813, 0.089625, 1.429688};
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-
-    return !runTestSuite(stderr,"psPolynomialXDEval", tests, argc, argv);
-}
-
-// This test will verify operation of 1D polynomial evaluation
-psS32 testPoly1DEval(void)
-{
-    psF64  result;
-    psF64  resultCheb;
-
-    // Allocate polynomial structure
-    psPolynomial1D*  polyOrd = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, TERMS-1);
-    psPolynomial1D*  polyCheb = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1);
-    // Set polynomial members
-    for(psS32 i = 0; i < TERMS; i++) {
-        polyOrd->coeff[i] = poly1DCoeff[i];
-        polyOrd->mask[i]  = poly1DMask[i];
-        polyCheb->coeff[i] = 1.0;
-        polyCheb->mask[i]  = poly1DMask[i];
-    }
-    // Evaluate test points and verify results
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        result = psPolynomial1DEval(polyOrd,poly1DXValue[i]);
-        if(fabs(poly1DXResult[i]-result) > ERROR_TOL ) {
-            psError(PS_ERR_UNKNOWN,true,"Evaluated value %g not as expected %g",
-                    result, poly1DXResult[i]);
-            return i;
-        }
-        resultCheb = psPolynomial1DEval(polyCheb,poly1DXChebValue[i]);
-        if(fabs(poly1DXChebResult[i]-resultCheb) > ERROR_TOL ) {
-            psError(PS_ERR_UNKNOWN,true,"Evaluated Chebyshev value %lg not as expected %lg",
-                    resultCheb, poly1DXChebResult[i]);
-            return 5*i;
-        }
-    }
-    psFree(polyOrd);
-    psFree(polyCheb);
-
-    // Allocate polynomial with invalid type
-    polyOrd = psPolynomial1DAlloc(99, TERMS-1);
-    // Attempt to evaluation invalid polynomial type
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message invalid type");
-    result = psPolynomial1DEval(polyOrd,0.0);
-    if ( !isnan(result) ) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return NAN for invalid polynomial type");
-        return 20;
-    }
-    psFree(polyOrd);
-
-    return 0;
-}
-
-
-psS32 testPoly1DEvalVector(void)
-{
-    // Allocate polynomial
-    psPolynomial1D* polyOrd = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, TERMS-1);
-    psPolynomial1D* polyCheb = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1);
-
-    // Set polynomial members
-    for(psS32 i = 0; i < TERMS; i++) {
-        polyOrd->coeff[i] = poly1DCoeff[i];
-        polyOrd->mask[i]  = poly1DMask[i];
-        polyCheb->coeff[i] = 1.0;
-        polyCheb->mask[i]  = poly1DMask[i];
-    }
-
-    // Create input vectors
-    psVector* inputOrd = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputCheb = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        inputOrd->data.F64[i] = poly1DXValue[i];
-        inputCheb->data.F64[i] = poly1DXChebValue[i];
-        inputOrd->n++;
-        inputCheb->n++;
-    }
-
-    // Evaluate the vectors
-    psVector* outputOrd = psPolynomial1DEvalVector(polyOrd, inputOrd);
-    if(outputOrd == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Unexpected return of NULL.");
-        return 1;
-    }
-    if(outputOrd->type.type != PS_TYPE_F64) {
-        psError(PS_ERR_UNKNOWN,true,"Output vector of type %d expected %d",
-                outputOrd->type.type, PS_TYPE_F64);
-        return 2;
-    }
-    psVector* outputCheb = psPolynomial1DEvalVector(polyCheb, inputCheb);
-    if(outputCheb == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Unexpected return of NULL.");
-        return 1;
-    }
-    if(outputCheb->type.type != PS_TYPE_F64) {
-        psError(PS_ERR_UNKNOWN,true,"Output vector of type %d expected %d",
-                outputCheb->type.type, PS_TYPE_F64);
-        return 2;
-    }
-
-    // Verify the results
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        if(fabs(poly1DXResult[i]-outputOrd->data.F64[i]) > ERROR_TOL) {
-            psError(PS_ERR_UNKNOWN,true,"Result[%d] %lg not equal to expected %lg",
-                    i, outputOrd->data.F64[i], poly1DXResult[i]);
-            return i*5;
-        }
-        if(fabs(poly1DXChebResult[i]-outputCheb->data.F64[i]) > ERROR_TOL) {
-            psError(PS_ERR_UNKNOWN,true,"ResultCheb[%d] %lg not equal to expected %lg",
-                    i, outputCheb->data.F64[i], poly1DXChebResult[i]);
-            return i*10;
-        }
-    }
-
-    // Attempt to invoke function with null polynomial
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL polynomial");
-    if(psPolynomial1DEvalVector(NULL, inputOrd) != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Return of NULL expected for NULL polynomial");
-        return 60;
-    }
-
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial1DEvalVector(polyOrd,NULL) != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Return of NULL expected for NULL input vector");
-        return 61;
-    }
-
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrd->type.type = PS_TYPE_U8;
-    if(psPolynomial1DEvalVector(polyOrd,inputOrd) != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Return NULL expected for non-F64 input vector");
-        return 62;
-    }
-    inputOrd->type.type = PS_TYPE_F64;
-
-    psFree(inputOrd);
-    psFree(inputCheb);
-    psFree(outputOrd);
-    psFree(outputCheb);
-    psFree(polyOrd);
-    psFree(polyCheb);
-
-    return 0;
-}
Index: trunk/psLib/test/math/tst_psPolynomialEval2D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolynomialEval2D.c	(revision 42336)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/** tst_psFunc09.c
-*
-*  This test driver will exercise the psPolynomialXDEval functions for both
-*  ORD and CHEB type polynomials.
-*
-*  @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
-*
-***************************************************************************/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define  TERMS        4
-#define  TESTPOINTS   5
-#define  ERROR_TOL    0.001
-
-static psS32 testPoly2DEval(void);
-static psS32 testPoly2DEvalVector(void);
-
-testDescription tests[] = {
-                              {testPoly2DEval,583,"psPolynomial2DEval",true,false},
-                              {testPoly2DEvalVector,000,"psPolynomial2DEvalVector",true,false},
-                              {NULL}
-                          };
-
-psF32 poly2DCoeff[TERMS][TERMS]   = {  { -4.3,  2.3, -3.2,  1.9},
-                                       {  1.2,  0.7, -0.3,  1.3},
-                                       {  0.4, -2.9,  0.8, -3.1},
-                                       { -1.1,  2.1,  1.9,  0.6}
-                                    };
-psF64 Dpoly2DCoeff[TERMS][TERMS]  = {  { -4.3,  2.3, -3.2,  1.9},
-                                       {  1.2,  0.7, -0.3,  1.3},
-                                       {  0.4, -2.9,  0.8, -3.1},
-                                       { -1.1,  2.1,  1.9,  0.6}
-                                    };
-psF32 poly2DMask[TERMS][TERMS]    = {  {  0,    0,    0,    1},
-                                       {  0,    0,    1,    0},
-                                       {  1,    0,    0,    0},
-                                       {  0,    0,    0,    1}
-                                    };
-
-psF32 poly2DXYValue[TESTPOINTS][2] = {  {  1.40,  0.55},
-                                        { -0.55,  1.40},
-                                        {  0.00,  2.34},
-                                        { -0.88,  0.00},
-                                        {  3.45, -0.78}
-                                     };
-psF32 Dpoly2DXYValue[TESTPOINTS][2] = {  {  1.40,  0.55},
-                                      { -0.55,  1.40},
-                                      {  0.00,  2.34},
-                                      { -0.88,  0.00},
-                                      {  3.45, -0.78}
-                                      };
-psF32 poly2DResult[TESTPOINTS] = {  -3.415938, -14.765687, -16.43992, -4.606381, -22.650702 };
-psF64 Dpoly2DResult[TESTPOINTS] = {  -3.415938, -14.765687, -16.43992, -4.606381, -22.650702 };
-
-psF32 poly2DXYChebValue[TESTPOINTS][2] = {  {  0.500,  0.500},
-        {  0.000,  0.250},
-        { -0.250,  0.000},
-        {  0.990,  0.150},
-        {  0.333, -0.666}
-                                         };
-psF32 Dpoly2DXYChebValue[TESTPOINTS][2] = {  {  0.500,  0.500},
-        {  0.000,  0.250},
-        { -0.250,  0.000},
-        {  0.990,  0.150},
-        {  0.333, -0.666}
-                                          };
-psF32 poly2DChebResult[TESTPOINTS] = {  0.750000, 1.687500, 0.625000, -0.113040, 0.386786 };
-psF32 Dpoly2DChebResult[TESTPOINTS] = {  0.750000, 1.687500, 0.625000, -0.113040, 0.386786 };
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-
-    return !runTestSuite(stderr,"psPolynomialXDEval", tests, argc, argv);
-}
-
-// This test will verify operation of 1D polynomial evaluation
-psS32 testPoly2DEval(void)
-{
-    psF64  result;
-    psF64  resultCheb;
-    psBool testStatus = true;
-
-    // Allocate polynomial structure
-    psPolynomial2D*  polyOrd = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1);
-    psPolynomial2D*  polyCheb = psPolynomial2DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1);
-    // Set polynomial members
-    for(psS32 i = 0; i < TERMS; i++) {
-        for(psS32 j = 0; j < TERMS; j++) {
-            polyOrd->coeff[i][j] = poly2DCoeff[i][j];
-            polyOrd->mask[i][j]  = poly2DMask[i][j];
-            polyCheb->coeff[i][j] = 1.0;
-            polyCheb->mask[i][j]  = poly2DMask[i][j];
-        }
-    }
-    // Evaluate test points and verify results
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        result = psPolynomial2DEval(polyOrd,Dpoly2DXYValue[i][0],Dpoly2DXYValue[i][1]);
-        if(fabs(Dpoly2DResult[i]-result) > ERROR_TOL ) {
-            printf("TEST ERROR: Evaluated value %f, should be %f\n", result, Dpoly2DResult[i]);
-            testStatus = false;
-        }
-        resultCheb = psPolynomial2DEval(polyCheb,Dpoly2DXYChebValue[i][0],Dpoly2DXYChebValue[i][1]);
-        if(fabs(Dpoly2DChebResult[i]-resultCheb) > ERROR_TOL ) {
-            printf("TEST ERROR: Evaluated value %f, should be %f\n", resultCheb, Dpoly2DChebResult[i]);
-            testStatus = false;
-        }
-    }
-    psFree(polyOrd);
-    psFree(polyCheb);
-
-    // Allocate polynomial with invalid type
-    polyOrd = psPolynomial2DAlloc(99, TERMS-1, TERMS-1);
-    // Attempt to evaluation invalid polynomial type
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message invalid type");
-    result = psPolynomial2DEval(polyOrd,0.0, 0.0);
-    if ( !isnan(result) ) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return NAN for invalid polynomial type");
-        testStatus = false;
-    }
-    psFree(polyOrd);
-
-    return(testStatus);
-}
-
-psS32 testPoly2DEvalVector(void)
-{
-    psBool testStatus = true;
-    // Allocate polynomial
-    psPolynomial2D* polyOrd = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1);
-    psPolynomial2D* polyCheb = psPolynomial2DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1);
-
-    // Set polynomial members
-    for(psS32 i = 0; i < TERMS; i++) {
-        for(psS32 j = 0; j < TERMS; j++) {
-            polyOrd->coeff[i][j] = poly2DCoeff[i][j];
-            polyOrd->mask[i][j]  = poly2DMask[i][j];
-            polyCheb->coeff[i][j] = 1.0;
-            polyCheb->mask[i][j]  = poly2DMask[i][j];
-        }
-    }
-
-    // Create input vectors
-    psVector* inputOrdX  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputOrdY  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebX = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebY = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        inputOrdX->data.F64[i]  = poly2DXYValue[i][0];
-        inputOrdY->data.F64[i]  = poly2DXYValue[i][1];
-        inputChebX->data.F64[i] = poly2DXYChebValue[i][0];
-        inputChebY->data.F64[i] = poly2DXYChebValue[i][1];
-        inputOrdX->n++;
-        inputOrdY->n++;
-        inputChebX->n++;
-        inputChebY->n++;
-    }
-
-    // Evaluate the vectors
-    psVector* outputOrd = psPolynomial2DEvalVector(polyOrd, inputOrdX, inputOrdY);
-    if(outputOrd == NULL) {
-        printf("TEST ERROR: Unexpected return of NULL.\n");
-        testStatus = false;
-    }
-    if(outputOrd->type.type != PS_TYPE_F64) {
-        printf("TEST ERROR: Output vector of type %d expected %d\n", outputOrd->type.type, PS_TYPE_F64);
-        testStatus = false;
-    }
-    psVector* outputCheb = psPolynomial2DEvalVector(polyCheb, inputChebX, inputChebY);
-    if(outputCheb == NULL) {
-        printf("TEST ERROR: Unexpected return of NULL.\n");
-        testStatus = false;
-    }
-    if(outputCheb->type.type != PS_TYPE_F64) {
-        printf("TEST ERROR: Output vector of type %d expected %d.\n", outputCheb->type.type, PS_TYPE_F64);
-        testStatus = false;
-    }
-
-    // Verify the results
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        if(fabs(poly2DResult[i]-outputOrd->data.F64[i]) > ERROR_TOL) {
-            printf("TEST ERROR: Result[%d] %lg not equal to expected %lg.\n",
-                   i, outputOrd->data.F64[i], poly2DResult[i]);
-            testStatus = false;
-        }
-        if(fabs(poly2DChebResult[i]-outputCheb->data.F64[i]) > ERROR_TOL) {
-            printf("TEST ERROR: ResultCheb[%d] %lg not equal to expected %lg.\n",
-                   i, outputCheb->data.F64[i], poly2DChebResult[i]);
-            testStatus = false;
-        }
-    }
-
-    // Attempt to invoke function with null polynomial
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL polynomial");
-    if(psPolynomial2DEvalVector(NULL, inputOrdX, inputOrdY) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL polynomial.\n");
-        testStatus = false;
-    }
-
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial2DEvalVector(polyOrd,NULL,inputOrdY) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector.\n");
-        testStatus = false;
-    }
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial2DEvalVector(polyOrd,inputOrdX,NULL) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector.\n");
-        testStatus = false;
-    }
-
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdX->type.type = PS_TYPE_U8;
-    if(psPolynomial2DEvalVector(polyOrd,inputOrdX, inputOrdY) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector.\n");
-        testStatus = false;
-    }
-    inputOrdX->type.type = PS_TYPE_F64;
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdY->type.type = PS_TYPE_U8;
-    if(psPolynomial2DEvalVector(polyOrd,inputOrdX, inputOrdY) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector.\n");
-        testStatus = false;
-    }
-    inputOrdY->type.type = PS_TYPE_F64;
-
-    psFree(inputOrdX);
-    psFree(inputOrdY);
-    psFree(inputChebX);
-    psFree(inputChebY);
-    psFree(outputOrd);
-    psFree(outputCheb);
-    psFree(polyOrd);
-    psFree(polyCheb);
-
-    return(testStatus);
-}
-
Index: trunk/psLib/test/math/tst_psPolynomialEval3D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolynomialEval3D.c	(revision 42336)
+++ 	(revision )
@@ -1,330 +1,0 @@
-/** tst_psFunc10.c
-*
-*  This test driver will exercise the psPolynomialXDEval functions for both
-*  ORD and CHEB type polynomials.
-*
-*  @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
-*
-***************************************************************************/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define  TERMS        4
-#define  TESTPOINTS   5
-#define  ERROR_TOL    0.001
-
-static psS32 testPoly3DEval(void);
-static psS32 testPoly3DEvalVector(void);
-
-testDescription tests[] = {
-                              {testPoly3DEval,583,"psPolynomial3DEval",true,false},
-                              {testPoly3DEvalVector,000,"psPolynomial3DEvalVector",true,false},
-                              {NULL}
-                          };
-
-psF32 poly3DCoeff[TERMS][TERMS][TERMS] = {  { { -1.1,  1.2, -1.3,  1.4},
-        {  1.5, -1.6,  1.7, -1.8},
-        {  0.1, -0.2,  0.3, -0.4},
-        { -0.5,  0.6, -0.7,  0.8}
-                                            },
-        { { -2.1,  2.2, -2.3,  2.4},
-          {  2.5, -2.6,  2.7, -2.8},
-          {  3.1, -3.2,  3.3, -3.4},
-          { -3.5,  3.6, -3.7,  3.8}
-        },
-        { { -4.1,  4.2, -4.3,  4.4},
-          {  4.5, -4.6,  4.7, -4.8},
-          {  5.1, -5.2,  5.3, -5.4},
-          { -5.5,  5.6, -5.7,  5.8}
-        },
-        { { -6.1,  6.2, -6.3,  6.4},
-          {  6.5, -6.6,  6.7, -6.8},
-          {  7.1, -7.2,  7.3, -7.4},
-          { -7.5,  7.6, -7.7,  7.8}
-        }
-                                         };
-psF64 Dpoly3DCoeff[TERMS][TERMS][TERMS] = {  { { -1.1,  1.2, -1.3,  1.4},
-        {  1.5, -1.6,  1.7, -1.8},
-        {  0.1, -0.2,  0.3, -0.4},
-        { -0.5,  0.6, -0.7,  0.8}
-                                             },
-        { { -2.1,  2.2, -2.3,  2.4},
-          {  2.5, -2.6,  2.7, -2.8},
-          {  3.1, -3.2,  3.3, -3.4},
-          { -3.5,  3.6, -3.7,  3.8}
-        },
-        { { -4.1,  4.2, -4.3,  4.4},
-          {  4.5, -4.6,  4.7, -4.8},
-          {  5.1, -5.2,  5.3, -5.4},
-          { -5.5,  5.6, -5.7,  5.8}
-        },
-        { { -6.1,  6.2, -6.3,  6.4},
-          {  6.5, -6.6,  6.7, -6.8},
-          {  7.1, -7.2,  7.3, -7.4},
-          { -7.5,  7.6, -7.7,  7.8}
-        }
-                                          };
-
-
-psF32 poly3DMask[TERMS][TERMS][TERMS]    = { {  {  0,    0,    0,    1},
-        {  0,    0,    1,    0},
-        {  1,    0,    0,    0},
-        {  0,    0,    0,    1}
-                                             },
-        {  {  1,    0,    0,    0},
-           {  1,    0,    0,    0},
-           {  1,    0,    0,    0},
-           {  1,    0,    0,    0}
-        },
-        {  {  0,    1,    0,    0},
-           {  0,    0,    1,    0},
-           {  0,    1,    0,    0},
-           {  0,    0,    1,    0}
-        },
-        {  {  1,    0,    0,    0},
-           {  0,    0,    0,    1},
-           {  1,    0,    0,    0},
-           {  0,    0,    0,    1}
-        },
-                                           };
-
-psF32 poly3DXYZValue[TESTPOINTS][3] = {  {  0.450, -0.780,  0.500},
-                                      {  0.297,  0.153, -0.354},
-                                      {  0.000,  0.153, -0.354},
-                                      {  0.297,  0.000, -0.354},
-                                      {  0.297,  0.153,  0.000}
-                                      };
-psF64 Dpoly3DXYZValue[TESTPOINTS][3] = {  {  0.450, -0.780,  0.500},
-                                       {  0.297,  0.153, -0.354},
-                                       {  0.000,  0.153, -0.354},
-                                       {  0.297,  0.000, -0.354},
-                                       {  0.297,  0.153,  0.000}
-                                       };
-psF32 poly3DResult[TESTPOINTS]  = { -1.298691, -2.011591, -1.359247, -2.548266, -1.139072};
-psF64 Dpoly3DResult[TESTPOINTS] = { -1.298691, -2.011591, -1.359247, -2.548266, -1.139072};
-
-
-psF32 poly3DXYZChebValue[TESTPOINTS][3] = {  {  0.000,  0.250, -0.250},
-        { -0.250,  0.000,  0.250},
-        {  0.250, -0.250,  0.000},
-        {  0.100, -0.300, -0.400},
-        {  0.990, -0.010,  0.500}
-                                          };
-psF64 Dpoly3DXYZChebValue[TESTPOINTS][3] = {  {  0.000,  0.250, -0.250},
-        { -0.250,  0.000,  0.250},
-        {  0.250, -0.250,  0.000},
-        {  0.100, -0.300, -0.400},
-        {  0.990, -0.010,  0.500}
-                                           };
-psF32 poly3DChebResult[TESTPOINTS]  = {  1.230469, 1.687500, 0.187500, -1.452707, 2.032344 };
-psF64 Dpoly3DChebResult[TESTPOINTS] = {  1.230469, 1.687500, 0.187500, -1.452707, 2.032344 };
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-
-    return !runTestSuite(stderr,"psPolynomialXDEval", tests, argc, argv);
-}
-
-// This test will verify operation of 1D polynomial evaluation
-psS32 testPoly3DEval(void)
-{
-    psF64  result;
-    psF64  resultCheb;
-    psBool testStatus = true;
-
-    // Allocate polynomial structure
-    psPolynomial3D*  polyOrd = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1, TERMS-1);
-    psPolynomial3D*  polyCheb = psPolynomial3DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1, TERMS-1);
-    // Set polynomial members
-    for(psS32 i = 0; i < TERMS; i++) {
-        for(psS32 j = 0; j < TERMS; j++) {
-            for(psS32 k = 0; k < TERMS; k++) {
-                polyOrd->coeff[i][j][k] = Dpoly3DCoeff[i][j][k];
-                polyOrd->mask[i][j][k]  = poly3DMask[i][j][k];
-                polyCheb->coeff[i][j][k] = 1.0;
-                polyCheb->mask[i][j][k]  = poly3DMask[i][j][k];
-            }
-        }
-    }
-    // Evaluate test points and verify results
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        result = psPolynomial3DEval(polyOrd,Dpoly3DXYZValue[i][0],Dpoly3DXYZValue[i][1],
-                                    Dpoly3DXYZValue[i][2]);
-        if(fabs(Dpoly3DResult[i]-result) > ERROR_TOL ) {
-            printf("TEST ERROR: Evaluated value %lg not as expected %lg.\n",
-                   result, Dpoly3DResult[i]);
-            testStatus = false;
-        }
-        resultCheb = psPolynomial3DEval(polyCheb,Dpoly3DXYZChebValue[i][0],Dpoly3DXYZChebValue[i][1],
-                                        Dpoly3DXYZChebValue[i][2]);
-        if(fabs(Dpoly3DChebResult[i]-resultCheb) > ERROR_TOL ) {
-            printf("TEST ERROR: Evaluated Chebyshev value %lg not as expected %lg.\n",
-                   resultCheb, Dpoly3DChebResult[i]);
-            testStatus = false;
-        }
-    }
-    psFree(polyOrd);
-    psFree(polyCheb);
-
-    // Allocate polynomial with invalid type
-    polyOrd = psPolynomial3DAlloc(99, TERMS-1, TERMS-1, TERMS-1);
-    // Attempt to evaluation invalid polynomial type
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message invalid type");
-    result = psPolynomial3DEval(polyOrd,0.0, 0.0, 0.0);
-    if ( !isnan(result) ) {
-        printf("TEST ERROR: Did not return NAN for invalid polynomial type.\n");
-        testStatus = false;
-    }
-    psFree(polyOrd);
-
-    return(testStatus);
-}
-
-psS32 testPoly3DEvalVector(void)
-{
-    psBool testStatus = true;
-    // Allocate polynomial
-    psPolynomial3D* polyOrd = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1, TERMS-1);
-    psPolynomial3D* polyCheb = psPolynomial3DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1, TERMS-1);
-
-    // Set polynomial members
-    for(psS32 i = 0; i < TERMS; i++) {
-        for(psS32 j = 0; j < TERMS; j++) {
-            for(psS32 k = 0; k < TERMS; k++) {
-                polyOrd->coeff[i][j][k] = Dpoly3DCoeff[i][j][k];
-                polyOrd->mask[i][j][k]  = poly3DMask[i][j][k];
-                polyCheb->coeff[i][j][k] = 1.0;
-                polyCheb->mask[i][j][k]  = poly3DMask[i][j][k];
-            }
-        }
-    }
-
-    // Create input vectors
-    psVector* inputOrdX  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputOrdY  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputOrdZ  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebX = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebY = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebZ = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        inputOrdX->data.F64[i]  = Dpoly3DXYZValue[i][0];
-        inputOrdY->data.F64[i]  = Dpoly3DXYZValue[i][1];
-        inputOrdZ->data.F64[i]  = Dpoly3DXYZValue[i][2];
-        inputChebX->data.F64[i] = Dpoly3DXYZChebValue[i][0];
-        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++;
-    }
-
-    // Evaluate the vectors
-    psVector* outputOrd = psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ);
-    if(outputOrd == NULL) {
-        printf("TEST ERROR: Unexpected return of NULL.\n");
-        testStatus = false;
-    }
-    if(outputOrd->type.type != PS_TYPE_F64) {
-        printf("TEST ERROR: Output vector of type %d expected %d.\n",
-               outputOrd->type.type, PS_TYPE_F64);
-        testStatus = false;
-    }
-    psVector* outputCheb = psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,inputChebZ);
-    if(outputCheb == NULL) {
-        printf("TEST ERROR: Unexpected return of NULL.\n");
-        testStatus = false;
-    }
-    if(outputCheb->type.type != PS_TYPE_F64) {
-        printf("TEST ERROR: Output vector of type %d expected %d.\n",
-               outputCheb->type.type, PS_TYPE_F64);
-        testStatus = false;
-    }
-
-    // Verify the results
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        if(fabs(Dpoly3DResult[i]-outputOrd->data.F64[i]) > ERROR_TOL) {
-            printf("TEST ERROR: Result[%d] %lg not equal to expected %lg.\n",
-                   i, outputOrd->data.F64[i], Dpoly3DResult[i]);
-            testStatus = false;
-        }
-        if(fabs(Dpoly3DChebResult[i]-outputCheb->data.F64[i]) > ERROR_TOL) {
-            printf("TEST ERROR: ResultCheb[%d] %lg not equal to expected %lg.\n",
-                   i, outputCheb->data.F64[i], Dpoly3DChebResult[i]);
-            testStatus = false;
-        }
-    }
-
-    // Attempt to invoke function with null polynomial
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL polynomial");
-    if(psPolynomial3DEvalVector(NULL,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL polynomial.\n");
-        testStatus = false;
-    }
-
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial3DEvalVector(polyOrd,NULL,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector.\n");
-        testStatus = false;
-    }
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial3DEvalVector(polyOrd,inputOrdX,NULL,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector.\n");
-        testStatus = false;
-    }
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,NULL) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector.\n");
-        testStatus = false;
-    }
-
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdX->type.type = PS_TYPE_U8;
-    if(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector.\n");
-        testStatus = false;
-    }
-    inputOrdX->type.type = PS_TYPE_F64;
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdY->type.type = PS_TYPE_U8;
-    if(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector.\n");
-        testStatus = false;
-    }
-    inputOrdY->type.type = PS_TYPE_F64;
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdZ->type.type = PS_TYPE_U8;
-    if(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector.\n");
-        testStatus = false;
-    }
-    inputOrdZ->type.type = PS_TYPE_F64;
-
-    psFree(inputOrdX);
-    psFree(inputOrdY);
-    psFree(inputOrdZ);
-    psFree(inputChebX);
-    psFree(inputChebY);
-    psFree(inputChebZ);
-    psFree(outputOrd);
-    psFree(outputCheb);
-    psFree(polyOrd);
-    psFree(polyCheb);
-
-    return(testStatus);
-}
-
Index: trunk/psLib/test/math/tst_psPolynomialEval4D.c
===================================================================
--- trunk/psLib/test/math/tst_psPolynomialEval4D.c	(revision 42336)
+++ 	(revision )
@@ -1,598 +1,0 @@
-/** tst_psFunc11.c
-*
-*  This test driver will exercise the psPolynomialXDEval functions for both
-*  ORD and CHEB type polynomials.
-*
-*  @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
-*
-***************************************************************************/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define  TERMS        4
-#define  TESTPOINTS   5
-#define  ERROR_TOL    0.001
-
-static psS32 testPoly4DEval(void);
-static psS32 testPoly4DEvalVector(void);
-
-testDescription tests[] = {
-                              {testPoly4DEval,583,"psPolynomial4DEval",true,false},
-                              {testPoly4DEvalVector,000,"psPolynomial4DEvalVector",true,false},
-                              {NULL}
-                          };
-
-psF32 poly4DCoeff[TERMS][TERMS][TERMS][TERMS] = {
-            {
-                {
-                    { -1.1,  1.2, -1.3,  1.4},
-                    {  1.5, -1.6,  1.7, -1.8},
-                    {  0.1, -0.2,  0.3, -0.4},
-                    { -0.5,  0.6, -0.7,  0.8}
-                },
-                {
-                    { -2.1,  2.2, -2.3,  2.4},
-                    {  2.5, -2.6,  2.7, -2.8},
-                    {  3.1, -3.2,  3.3, -3.4},
-                    { -3.5,  3.6, -3.7,  3.8}
-                },
-                { { -4.1,  4.2, -4.3,  4.4},
-                  {  4.5, -4.6,  4.7, -4.8},
-                  {  5.1, -5.2,  5.3, -5.4},
-                  { -5.5,  5.6, -5.7,  5.8}
-                },
-                { { -6.1,  6.2, -6.3,  6.4},
-                  {  6.5, -6.6,  6.7, -6.8},
-                  {  7.1, -7.2,  7.3, -7.4},
-                  { -7.5,  7.6, -7.7,  7.8}
-                }
-            },
-            {
-                {
-                    { -1.1,  1.2, -1.3,  1.4},
-                    {  1.5, -1.6,  1.7, -1.8},
-                    {  0.1, -0.2,  0.3, -0.4},
-                    { -0.5,  0.6, -0.7,  0.8}
-                },
-                {
-                    { -2.1,  2.2, -2.3,  2.4},
-                    {  2.5, -2.6,  2.7, -2.8},
-                    {  3.1, -3.2,  3.3, -3.4},
-                    { -3.5,  3.6, -3.7,  3.8}
-                },
-                { { -4.1,  4.2, -4.3,  4.4},
-                  {  4.5, -4.6,  4.7, -4.8},
-                  {  5.1, -5.2,  5.3, -5.4},
-                  { -5.5,  5.6, -5.7,  5.8}
-                },
-                { { -6.1,  6.2, -6.3,  6.4},
-                  {  6.5, -6.6,  6.7, -6.8},
-                  {  7.1, -7.2,  7.3, -7.4},
-                  { -7.5,  7.6, -7.7,  7.8}
-                }
-            },
-            {
-                {
-                    { -1.1,  1.2, -1.3,  1.4},
-                    {  1.5, -1.6,  1.7, -1.8},
-                    {  0.1, -0.2,  0.3, -0.4},
-                    { -0.5,  0.6, -0.7,  0.8}
-                },
-                {
-                    { -2.1,  2.2, -2.3,  2.4},
-                    {  2.5, -2.6,  2.7, -2.8},
-                    {  3.1, -3.2,  3.3, -3.4},
-                    { -3.5,  3.6, -3.7,  3.8}
-                },
-                { { -4.1,  4.2, -4.3,  4.4},
-                  {  4.5, -4.6,  4.7, -4.8},
-                  {  5.1, -5.2,  5.3, -5.4},
-                  { -5.5,  5.6, -5.7,  5.8}
-                },
-                { { -6.1,  6.2, -6.3,  6.4},
-                  {  6.5, -6.6,  6.7, -6.8},
-                  {  7.1, -7.2,  7.3, -7.4},
-                  { -7.5,  7.6, -7.7,  7.8}
-                }
-            },
-            {
-                {
-                    { -1.1,  1.2, -1.3,  1.4},
-                    {  1.5, -1.6,  1.7, -1.8},
-                    {  0.1, -0.2,  0.3, -0.4},
-                    { -0.5,  0.6, -0.7,  0.8}
-                },
-                {
-                    { -2.1,  2.2, -2.3,  2.4},
-                    {  2.5, -2.6,  2.7, -2.8},
-                    {  3.1, -3.2,  3.3, -3.4},
-                    { -3.5,  3.6, -3.7,  3.8}
-                },
-                { { -4.1,  4.2, -4.3,  4.4},
-                  {  4.5, -4.6,  4.7, -4.8},
-                  {  5.1, -5.2,  5.3, -5.4},
-                  { -5.5,  5.6, -5.7,  5.8}
-                },
-                { { -6.1,  6.2, -6.3,  6.4},
-                  {  6.5, -6.6,  6.7, -6.8},
-                  {  7.1, -7.2,  7.3, -7.4},
-                  { -7.5,  7.6, -7.7,  7.8}
-                }
-            }
-        };
-psF64 Dpoly4DCoeff[TERMS][TERMS][TERMS][TERMS] = {
-            {
-                {
-                    { -1.1,  1.2, -1.3,  1.4},
-                    {  1.5, -1.6,  1.7, -1.8},
-                    {  0.1, -0.2,  0.3, -0.4},
-                    { -0.5,  0.6, -0.7,  0.8}
-                },
-                {
-                    { -2.1,  2.2, -2.3,  2.4},
-                    {  2.5, -2.6,  2.7, -2.8},
-                    {  3.1, -3.2,  3.3, -3.4},
-                    { -3.5,  3.6, -3.7,  3.8}
-                },
-                { { -4.1,  4.2, -4.3,  4.4},
-                  {  4.5, -4.6,  4.7, -4.8},
-                  {  5.1, -5.2,  5.3, -5.4},
-                  { -5.5,  5.6, -5.7,  5.8}
-                },
-                { { -6.1,  6.2, -6.3,  6.4},
-                  {  6.5, -6.6,  6.7, -6.8},
-                  {  7.1, -7.2,  7.3, -7.4},
-                  { -7.5,  7.6, -7.7,  7.8}
-                }
-            },
-            {
-                {
-                    { -1.1,  1.2, -1.3,  1.4},
-                    {  1.5, -1.6,  1.7, -1.8},
-                    {  0.1, -0.2,  0.3, -0.4},
-                    { -0.5,  0.6, -0.7,  0.8}
-                },
-                {
-                    { -2.1,  2.2, -2.3,  2.4},
-                    {  2.5, -2.6,  2.7, -2.8},
-                    {  3.1, -3.2,  3.3, -3.4},
-                    { -3.5,  3.6, -3.7,  3.8}
-                },
-                { { -4.1,  4.2, -4.3,  4.4},
-                  {  4.5, -4.6,  4.7, -4.8},
-                  {  5.1, -5.2,  5.3, -5.4},
-                  { -5.5,  5.6, -5.7,  5.8}
-                },
-                { { -6.1,  6.2, -6.3,  6.4},
-                  {  6.5, -6.6,  6.7, -6.8},
-                  {  7.1, -7.2,  7.3, -7.4},
-                  { -7.5,  7.6, -7.7,  7.8}
-                }
-            },
-            {
-                {
-                    { -1.1,  1.2, -1.3,  1.4},
-                    {  1.5, -1.6,  1.7, -1.8},
-                    {  0.1, -0.2,  0.3, -0.4},
-                    { -0.5,  0.6, -0.7,  0.8}
-                },
-                {
-                    { -2.1,  2.2, -2.3,  2.4},
-                    {  2.5, -2.6,  2.7, -2.8},
-                    {  3.1, -3.2,  3.3, -3.4},
-                    { -3.5,  3.6, -3.7,  3.8}
-                },
-                { { -4.1,  4.2, -4.3,  4.4},
-                  {  4.5, -4.6,  4.7, -4.8},
-                  {  5.1, -5.2,  5.3, -5.4},
-                  { -5.5,  5.6, -5.7,  5.8}
-                },
-                { { -6.1,  6.2, -6.3,  6.4},
-                  {  6.5, -6.6,  6.7, -6.8},
-                  {  7.1, -7.2,  7.3, -7.4},
-                  { -7.5,  7.6, -7.7,  7.8}
-                }
-            },
-            {
-                {
-                    { -1.1,  1.2, -1.3,  1.4},
-                    {  1.5, -1.6,  1.7, -1.8},
-                    {  0.1, -0.2,  0.3, -0.4},
-                    { -0.5,  0.6, -0.7,  0.8}
-                },
-                {
-                    { -2.1,  2.2, -2.3,  2.4},
-                    {  2.5, -2.6,  2.7, -2.8},
-                    {  3.1, -3.2,  3.3, -3.4},
-                    { -3.5,  3.6, -3.7,  3.8}
-                },
-                { { -4.1,  4.2, -4.3,  4.4},
-                  {  4.5, -4.6,  4.7, -4.8},
-                  {  5.1, -5.2,  5.3, -5.4},
-                  { -5.5,  5.6, -5.7,  5.8}
-                },
-                { { -6.1,  6.2, -6.3,  6.4},
-                  {  6.5, -6.6,  6.7, -6.8},
-                  {  7.1, -7.2,  7.3, -7.4},
-                  { -7.5,  7.6, -7.7,  7.8}
-                }
-            }
-        };
-
-psF32 poly4DMask[TERMS][TERMS][TERMS][TERMS]    = {
-            {
-                {
-                    {  0,    0,    0,    1},
-                    {  0,    0,    1,    0},
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1}
-                },
-                {
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0}
-                },
-                {
-                    {  0,    1,    0,    0},
-                    {  0,    0,    1,    0},
-                    {  0,    1,    0,    0},
-                    {  0,    0,    1,    0}
-                },
-                {
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1},
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1}
-                }
-            },
-            {
-                {
-                    {  0,    0,    0,    1},
-                    {  0,    0,    1,    0},
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1}
-                },
-                {
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0}
-                },
-                {
-                    {  0,    1,    0,    0},
-                    {  0,    0,    1,    0},
-                    {  0,    1,    0,    0},
-                    {  0,    0,    1,    0}
-                },
-                {
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1},
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1}
-                }
-            },
-            {
-                {
-                    {  0,    0,    0,    1},
-                    {  0,    0,    1,    0},
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1}
-                },
-                {
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0}
-                },
-                {
-                    {  0,    1,    0,    0},
-                    {  0,    0,    1,    0},
-                    {  0,    1,    0,    0},
-                    {  0,    0,    1,    0}
-                },
-                {
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1},
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1}
-                }
-            },
-            {
-                {
-                    {  0,    0,    0,    1},
-                    {  0,    0,    1,    0},
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1}
-                },
-                {
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0},
-                    {  1,    0,    0,    0}
-                },
-                {
-                    {  0,    1,    0,    0},
-                    {  0,    0,    1,    0},
-                    {  0,    1,    0,    0},
-                    {  0,    0,    1,    0}
-                },
-                {
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1},
-                    {  1,    0,    0,    0},
-                    {  0,    0,    0,    1}
-                }
-            }
-        };
-
-psF32 poly4DWXYZValue[TESTPOINTS][4] = {
-                                           {  0.450, -0.780,  0.500, -0.123},
-                                           {  0.297,  0.153, -0.354,  0.000},
-                                           {  0.000,  0.153, -0.354,  0.321},
-                                           {  0.297,  0.000, -0.354,  0.321},
-                                           {  0.297,  0.153,  0.000,  0.321}
-                                       };
-psF64 Dpoly4DWXYZValue[TESTPOINTS][4] = {
-                                            {  0.450, -0.780,  0.500, -0.123},
-                                            {  0.297,  0.153, -0.354,  0.000},
-                                            {  0.000,  0.153, -0.354,  0.321},
-                                            {  0.297,  0.000, -0.354,  0.321},
-                                            {  0.297,  0.153,  0.000,  0.321}
-                                        };
-
-psF32 poly4DResult[TESTPOINTS]  = { -3.588753, -2.439566, -1.175955, -1.645497, -1.216915};
-psF64 Dpoly4DResult[TESTPOINTS]  = { -3.588753, -2.439566, -1.175955, -1.645497, -1.216915};
-
-psF32 poly4DWXYZChebValue[TESTPOINTS][4] = {
-            {  0.100,  0.000,  0.250, -0.250},
-            {  0.100, -0.250,  0.000,  0.250},
-            {  0.100,  0.250, -0.250,  0.000},
-            {  0.300,  0.200, -0.300, -0.400},
-            { -0.780,  0.990, -0.010,  0.500}
-        };
-psF64 Dpoly4DWXYZChebValue[TESTPOINTS][4] = {
-            {  0.100,  0.000,  0.250, -0.250},
-            {  0.100, -0.250,  0.000,  0.250},
-            {  0.100,  0.250, -0.250,  0.000},
-            {  0.300,  0.200, -0.300, -0.400},
-            { -0.780,  0.990, -0.010,  0.500}
-        };
-psF32 poly4DChebResult[TESTPOINTS]   = { -0.216563, -0.297000, -0.033000, 0.432198, 1.785601 };
-psF64 Dpoly4DChebResult[TESTPOINTS]  = { -0.216563, -0.297000, -0.033000, 0.432198, 1.785601 };
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-
-    return !runTestSuite(stderr,"psPolynomialXDEval", tests, argc, argv);
-}
-
-// This test will verify operation of 4D polynomial evaluation
-psS32 testPoly4DEval(void)
-{
-    psBool testStatus = true;
-    // Allocate polynomial structure
-    psPolynomial4D*  polyOrd = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
-    psPolynomial4D*  polyCheb = psPolynomial4DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
-    // Set polynomial members
-    for(psS32 i = 0; i < TERMS; i++) {
-        for(psS32 j = 0; j < TERMS; j++) {
-            for(psS32 k = 0; k < TERMS; k++) {
-                for(psS32 l = 0; l < TERMS; l++) {
-                    polyOrd->coeff[i][j][k][l] = Dpoly4DCoeff[i][j][k][l];
-                    polyOrd->mask[i][j][k][l]  = poly4DMask[i][j][k][l];
-                    polyCheb->coeff[i][j][k][l] = 1.0;
-                    polyCheb->mask[i][j][k][l]  = poly4DMask[i][j][k][l];
-                }
-            }
-        }
-    }
-
-    // Evaluate test points and verify results
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        psF64 result = psPolynomial4DEval(polyOrd, Dpoly4DWXYZValue[i][0], Dpoly4DWXYZValue[i][1],
-                                          Dpoly4DWXYZValue[i][2], Dpoly4DWXYZValue[i][3]);
-        if(fabs(Dpoly4DResult[i]-result) > ERROR_TOL ) {
-            printf("TEST ERROR: Evaluated value %lg not as expected %lg.\n",
-                   result, Dpoly4DResult[i]);
-            testStatus = false;
-        }
-
-        psF64 resultCheb = psPolynomial4DEval(polyCheb, Dpoly4DWXYZChebValue[i][0], Dpoly4DWXYZChebValue[i][1],
-                                              Dpoly4DWXYZChebValue[i][2], Dpoly4DWXYZChebValue[i][3]);
-        if(fabs(Dpoly4DChebResult[i]-resultCheb) > ERROR_TOL ) {
-            printf("TEST ERROR: Evaluated Chebyshev value %lg not as expected %lg.\n",
-                   resultCheb, Dpoly4DChebResult[i]);
-            testStatus = false;
-        }
-    }
-
-    psFree(polyOrd);
-    psFree(polyCheb);
-
-    // Allocate polynomial with invalid type
-    polyOrd = psPolynomial4DAlloc(99, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
-    // Attempt to evaluation invalid polynomial type
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message invalid type");
-    psF64 result = psPolynomial4DEval(polyOrd,0.0, 0.0, 0.0, 0.0);
-    if ( !isnan(result) ) {
-        printf("TEST ERROR: Did not return NAN for invalid polynomial type");
-        testStatus = false;
-    }
-    psFree(polyOrd);
-
-    return(testStatus);
-}
-
-psS32 testPoly4DEvalVector(void)
-{
-    psBool testStatus = true;
-    // Allocate polynomial
-    psPolynomial4D* polyOrd = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
-    psPolynomial4D* polyCheb = psPolynomial4DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
-
-    // Set polynomial members
-    for(psS32 i = 0; i < TERMS; i++) {
-        for(psS32 j = 0; j < TERMS; j++) {
-            for(psS32 k = 0; k < TERMS; k++) {
-                for(psS32 l = 0; l < TERMS; l++) {
-                    polyOrd->coeff[i][j][k][l] = Dpoly4DCoeff[i][j][k][l];
-                    polyOrd->mask[i][j][k][l]  = poly4DMask[i][j][k][l];
-                    polyCheb->coeff[i][j][k][l] = 1.0;
-                    polyCheb->mask[i][j][k][l]  = poly4DMask[i][j][k][l];
-                }
-            }
-        }
-    }
-
-    // Create input vectors
-    psVector* inputOrdW  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputOrdX  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputOrdY  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputOrdZ  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebW = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebX = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebY = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    psVector* inputChebZ = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        inputOrdW->data.F64[i]  = Dpoly4DWXYZValue[i][0];
-        inputOrdX->data.F64[i]  = Dpoly4DWXYZValue[i][1];
-        inputOrdY->data.F64[i]  = Dpoly4DWXYZValue[i][2];
-        inputOrdZ->data.F64[i]  = Dpoly4DWXYZValue[i][3];
-        inputChebW->data.F64[i] = Dpoly4DWXYZChebValue[i][0];
-        inputChebX->data.F64[i] = Dpoly4DWXYZChebValue[i][1];
-        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++;
-    }
-
-    // Evaluate the vectors
-    psVector* outputOrd = psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ);
-    if(outputOrd == NULL) {
-        printf("TEST ERROR: Unexpected return of NULL.");
-        testStatus = false;
-    }
-    if(outputOrd->type.type != PS_TYPE_F64) {
-        printf("TEST ERROR: Output vector of type %d expected %d",
-               outputOrd->type.type, PS_TYPE_F64);
-        testStatus = false;
-    }
-
-    psVector* outputCheb = psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ);
-    if(outputCheb == NULL) {
-        printf("TEST ERROR: Unexpected return of NULL.");
-        testStatus = false;
-    }
-    if(outputCheb->type.type != PS_TYPE_F64) {
-        printf("TEST ERROR: Output vector of type %d expected %d",
-               outputCheb->type.type, PS_TYPE_F64);
-        testStatus = false;
-    }
-
-    // Verify the results
-    for(psS32 i = 0; i < TESTPOINTS; i++) {
-        if(fabs(Dpoly4DResult[i]-outputOrd->data.F64[i]) > ERROR_TOL) {
-            printf("TEST ERROR: Result[%d] %lg not equal to expected %lg",
-                   i, outputOrd->data.F64[i], Dpoly4DResult[i]);
-            testStatus = false;
-        }
-        if(fabs(Dpoly4DChebResult[i]-outputCheb->data.F64[i]) > ERROR_TOL) {
-            printf("TEST ERROR: ResultCheb[%d] %lg not equal to expected %lg",
-                   i, outputCheb->data.F64[i], Dpoly4DChebResult[i]);
-            testStatus = false;
-        }
-    }
-
-    // Attempt to invoke function with null polynomial
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL polynomial");
-    if(psPolynomial4DEvalVector(NULL,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL polynomial");
-        testStatus = false;
-    }
-
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial4DEvalVector(polyOrd,NULL,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector");
-        testStatus = false;
-    }
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial4DEvalVector(polyOrd,inputOrdW,NULL,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector");
-        testStatus = false;
-    }
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,NULL,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector");
-        testStatus = false;
-    }
-    // Attempt to invoke function with null input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL input vector");
-    if(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,NULL) != NULL) {
-        printf("TEST ERROR: Return of NULL expected for NULL input vector");
-        testStatus = false;
-    }
-
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdX->type.type = PS_TYPE_U8;
-    if(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector");
-        testStatus = false;
-    }
-    inputOrdX->type.type = PS_TYPE_F64;
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdY->type.type = PS_TYPE_U8;
-    if(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector");
-        testStatus = false;
-    }
-    inputOrdY->type.type = PS_TYPE_F64;
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdZ->type.type = PS_TYPE_U8;
-    if(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector");
-        testStatus = false;
-    }
-    inputOrdZ->type.type = PS_TYPE_F64;
-    // Attempt to invoke function with a non F64 type input vector
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid input type");
-    inputOrdW->type.type = PS_TYPE_U8;
-    if(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) != NULL) {
-        printf("TEST ERROR: Return NULL expected for non-F64 input vector");
-        testStatus = false;
-    }
-    inputOrdW->type.type = PS_TYPE_F64;
-
-    psFree(inputOrdX);
-    psFree(inputOrdY);
-    psFree(inputOrdZ);
-    psFree(inputOrdW);
-    psFree(inputChebW);
-    psFree(inputChebX);
-    psFree(inputChebY);
-    psFree(inputChebZ);
-    psFree(outputOrd);
-    psFree(outputCheb);
-    psFree(polyOrd);
-    psFree(polyCheb);
-
-    return(testStatus);
-}
Index: trunk/psLib/test/math/tst_psRandom.c
===================================================================
--- trunk/psLib/test/math/tst_psRandom.c	(revision 42336)
+++ 	(revision )
@@ -1,409 +1,0 @@
-/*****************************************************************************
-This routine must ensure that the various random number generator functions
-work properly.
- 
-    t00(): ensure that psRandom structs are properly allocated by psRandomAllocSpecific().
-    t01(): ensure that psRandomUniform() produces a sequence of numbers with
-    proper mean and stdev.
-    t02(): ensure that psRandomGaussian() produces a sequence of numbers with
-    proper mean and stdev.
-    t03(): ensure that psRandomPoisson() produces a sequence of numbers with
-    proper mean and stdev.
-    t04(): ensure that psRandomReset() properly seeds the random number
-    generator for psRandomUniform().
-    t05(): ensure that psRandomReset() properly seeds the random number
-    generator for psRandomGaussian().
-    t06(): ensure that psRandomReset() properly seeds the random number
-    generator for psRandomPoisson().
- *****************************************************************************/
-#include <stdio.h>
-#include <math.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define NUM_DATA 10000
-#define SEED 54321
-#define SEED2 345
-#define UNIFORM_MEAN 0.5
-#define UNIFORM_STDEV 0.3
-#define GAUSSIAN_MEAN 0.0
-#define GAUSSIAN_STDEV 1.0
-#define POISSON_MEAN 15.0
-#define POISSON_STDEV (POISSON_MEAN / 4)
-#define ERROR_TOLERANCE 0.1
-psS32 testStatus = true;
-
-static psS32 testRandomAlloc(void);
-static psS32 testRandomUniform(void);
-static psS32 testRandomGaussian(void);
-static psS32 testRandomPoisson(void);
-static psS32 testRandomResetUniform(void);
-static psS32 testRandomResetGaussian(void);
-static psS32 testRandomResetPoisson(void);
-
-testDescription tests[] = {
-                              {testRandomAlloc,000,"psRandomAllocSpecific",0,false},
-                              {testRandomUniform,000,"psRandomUniform",0,false},
-                              {testRandomGaussian,000,"psRandomGaussian",0,false},
-                              {testRandomPoisson,000,"psRandomPoisson",0,false},
-                              {testRandomResetUniform,000,"psRandomReset",0,false},
-                              {testRandomResetGaussian,000,"psRandomReset",0,false},
-                              {testRandomResetPoisson,000,"psRandomReset",0,false},
-                              {NULL}
-                          };
-
-psS32 main(psS32 argc, char* argv[])
-{
-    psLogSetFormat("HLNM");
-    if(!runTestSuite(stderr,"psRandom",tests,argc,argv)) {
-        return 1;
-    }
-
-    return 0;
-}
-
-psS32 testRandomAlloc(void)
-{
-    psRandom *myRNG = NULL;
-
-    // Valid type allocation
-    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
-    if (myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
-        return 1;
-    }
-    if (myRNG->type != PS_RANDOM_TAUS) {
-        psError(PS_ERR_UNKNOWN,true,"Type %d not as expected %d",myRNG->type,PS_RANDOM_TAUS);
-        return 2;
-    }
-    psFree(myRNG);
-
-    // Valid type allocation with seed equal to zero
-    int fd1 = creat("seed_msglog1.txt", 0666);
-    //    psLogSetDestination("file:seed_msglog1.txt");
-    psLogSetDestination(fd1);
-    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, 0);
-    //    psLogSetDestination("dest:stderr");
-    psLogSetDestination(2);
-    if (myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
-        return 3;
-    }
-    if (myRNG->type != PS_RANDOM_TAUS) {
-        psError(PS_ERR_UNKNOWN,true,"Type %d not as expected %d",myRNG->type,PS_RANDOM_TAUS);
-        return 4;
-    }
-    psFree(myRNG);
-
-    // Invalid type allocation
-    psLogMsg(__func__,PS_LOG_INFO,"Invalid type, should generate error message");
-    myRNG = psRandomAllocSpecific(100,SEED);
-    if (myRNG != NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return NULL for invalid type");
-        return 5;
-    }
-
-    // Negative seed value
-    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS,-5);
-    if(myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return allocated psRandom");
-        return 6;
-    }
-    close(fd1);
-    psFree(myRNG);
-
-    return 0;
-}
-
-psS32 testRandomUniform(void)
-{
-    psRandom *myRNG = NULL;
-    psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
-    rans->n = rans->nalloc;
-    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
-    if (myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
-        return 1;
-    }
-
-    // Initialize vector data with random number
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans->data.F64[i] = psRandomUniform(myRNG);
-    }
-    // Perform vector stats on random data (mean, stdev)
-    stats = psVectorStats(stats, rans, NULL, NULL, 0);
-    stats->options = PS_STAT_SAMPLE_STDEV;
-    stats = psVectorStats(stats, rans, NULL, NULL, 0);
-    // Verify mean and stdev
-    if ((fabs(stats->sampleMean - UNIFORM_MEAN) / UNIFORM_MEAN) > ERROR_TOLERANCE) {
-        psError(PS_ERR_UNKNOWN,true,"psRandomUniform mean is %.2f, should be %.2f",
-                stats->sampleMean, UNIFORM_MEAN);
-        return 2;
-    }
-    if ((fabs(stats->sampleStdev - UNIFORM_STDEV) / UNIFORM_STDEV) > ERROR_TOLERANCE) {
-        psError(PS_ERR_UNKNOWN,true,"psRandomUniform stdev is %.2f, should be %.2f",
-                stats->sampleStdev, UNIFORM_STDEV);
-        return 3;
-    }
-
-    psFree(myRNG);
-    psFree(rans);
-    psFree(stats);
-
-    psLogMsg(__func__,PS_LOG_INFO,"NULL psRandom variable, should generate error message");
-    if(psRandomUniform(NULL) != 0) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return zero for null psRandom");
-        return 4;
-    }
-
-    return 0;
-}
-
-psS32 testRandomGaussian(void)
-{
-    psRandom *myRNG = NULL;
-    psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
-    rans->n = rans->nalloc;
-    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
-    if (myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
-        return 1;
-    }
-
-    // Initialize vector with random data
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans->data.F64[i] = psRandomGaussian(myRNG);
-    }
-
-    // Perform vector stats on data (mean, stdev)
-    stats = psVectorStats(stats, rans, NULL, NULL, 0);
-    stats->options = PS_STAT_SAMPLE_STDEV;
-    stats = psVectorStats(stats, rans, NULL, NULL, 0);
-
-    // Verify statistics
-    if ((fabs(stats->sampleMean - GAUSSIAN_MEAN) / 1.0) > ERROR_TOLERANCE) {
-        psError(PS_ERR_UNKNOWN,true,"psRandomGaussian mean is %.2f, should be %.2f",
-                stats->sampleMean, GAUSSIAN_MEAN);
-        return 2;
-    }
-    if ((fabs(stats->sampleStdev - GAUSSIAN_STDEV) / GAUSSIAN_STDEV) > ERROR_TOLERANCE) {
-        psError(PS_ERR_UNKNOWN,true,"psRandomGaussian stdev is %.2f, should be %.2f",
-                stats->sampleStdev, GAUSSIAN_STDEV);
-        return 3;
-    }
-
-    psFree(myRNG);
-    psFree(rans);
-    psFree(stats);
-
-    psLogMsg(__func__,PS_LOG_INFO,"NULL psRandom variable, should generate error message");
-    if(psRandomGaussian(NULL) != 0) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return zero for null psRandom");
-        return 4;
-    }
-
-    return 0;
-}
-
-psS32 testRandomPoisson(void)
-{
-    psRandom *myRNG = NULL;
-    psVector *rans = psVectorAlloc(NUM_DATA, PS_TYPE_F64);
-    rans->n = rans->nalloc;
-    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-
-    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
-    if (myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
-        return 1;
-    }
-
-    // Initialize vector with random data
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN);
-    }
-
-    // Perform statistics on data
-    stats = psVectorStats(stats, rans, NULL, NULL, 0);
-    stats->options = PS_STAT_SAMPLE_STDEV;
-    stats = psVectorStats(stats, rans, NULL, NULL, 0);
-    if ((fabs(stats->sampleMean - POISSON_MEAN) / POISSON_MEAN) > ERROR_TOLERANCE) {
-        psError(PS_ERR_UNKNOWN,true,"psRandomPoisson mean is %.2f, should be %.2f",
-                stats->sampleMean, POISSON_MEAN);
-        return 2;
-    }
-    if ((fabs(stats->sampleStdev - POISSON_STDEV) / POISSON_STDEV) > ERROR_TOLERANCE) {
-        psError(PS_ERR_UNKNOWN,true,"psRandomPoisson stdev is %.2f, should be %.2f",
-                stats->sampleStdev, POISSON_STDEV);
-        return 3;
-    }
-
-    psFree(myRNG);
-    psFree(rans);
-    psFree(stats);
-
-    psLogMsg(__func__,PS_LOG_INFO,"NULL psRandom variable, should generate error message");
-    if(psRandomPoisson(NULL, POISSON_MEAN) != 0) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return zero for null psRandom");
-        return 4;
-    }
-
-    return 0;
-}
-
-psS32 testRandomResetUniform(void)
-{
-    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 = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
-    if (myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
-        return 1;
-    }
-
-    // Random reset
-    psRandomReset(myRNG, SEED);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans00->data.F64[i] = psRandomUniform(myRNG);
-    }
-    psRandomReset(myRNG, SEED2);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans01->data.F64[i] = psRandomUniform(myRNG);
-    }
-    psRandomReset(myRNG, SEED);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans02->data.F64[i] = psRandomUniform(myRNG);
-    }
-
-    // Verify reset to original seed produces same results
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        if (rans00->data.F64[i] != rans02->data.F64[i]) {
-            psError(PS_ERR_UNKNOWN,true,"psRandomUniform did not produce the same results with the same seed");
-            return i+1;
-        }
-    }
-
-    psFree(myRNG);
-    psFree(rans00);
-    psFree(rans01);
-    psFree(rans02);
-
-    psRandom *myRNG1 = NULL;
-    myRNG1 = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
-    //    psLogSetDestination("dest:stderr");
-    psLogSetDestination(0);
-    psRandomReset(myRNG1,0);
-    //    psLogSetDestination("dest:stderr");
-    psLogSetDestination(2);
-    psFree(myRNG1);
-
-    psLogMsg(__func__,PS_LOG_INFO,"Reset a NULL psRandom variable, should generate an error message");
-    psRandomReset(NULL,SEED);
-
-    return 0;
-}
-
-psS32 testRandomResetGaussian(void)
-{
-    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 = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
-    if (myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
-        return 1;
-    }
-
-    // Initialize random data in vectors
-    psRandomReset(myRNG, SEED);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans00->data.F64[i] = psRandomGaussian(myRNG);
-    }
-    psRandomReset(myRNG, SEED2);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans01->data.F64[i] = psRandomGaussian(myRNG);
-    }
-    psRandomReset(myRNG, SEED);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans02->data.F64[i] = psRandomGaussian(myRNG);
-    }
-
-    // Verify data from original seed produces same data after reset
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        if (rans00->data.F64[i] != rans02->data.F64[i]) {
-            psError(PS_ERR_UNKNOWN,true,"psRandomGaussian did not produce the same results with the same seed");
-            return 2;
-        }
-    }
-
-    psFree(myRNG);
-    psFree(rans00);
-    psFree(rans01);
-    psFree(rans02);
-
-    return 0;
-}
-
-psS32 testRandomResetPoisson(void)
-{
-    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 = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
-    if (myRNG == NULL) {
-        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
-        return 1;
-    }
-
-    // Initialize vectors with random data
-    psRandomReset(myRNG, SEED);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans00->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN);
-    }
-    psRandomReset(myRNG, SEED2);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans01->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN);
-    }
-    psRandomReset(myRNG, SEED);
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        rans02->data.F64[i] = psRandomPoisson(myRNG, POISSON_MEAN);
-    }
-
-    // Verify the original seed produces same data after reset
-    for (psS32 i = 0 ; i < NUM_DATA ; i++) {
-        if (rans00->data.F64[i] != rans02->data.F64[i]) {
-            psError(PS_ERR_UNKNOWN,true,"psRandomPoisson did not produce the same results with the same seed");
-            return 2;
-        }
-    }
-
-    psFree(myRNG);
-    psFree(rans00);
-    psFree(rans01);
-    psFree(rans02);
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psSparse.c
===================================================================
--- trunk/psLib/test/math/tst_psSparse.c	(revision 42336)
+++ 	(revision )
@@ -1,59 +1,0 @@
-
-void psSparseMatrixTest ()
-{
-
-    // build a sparse matrix
-    psSparse *sparse = psSparseAlloc (3, 9);
-
-    psSparseMatrixElement (sparse, 0, 0, 3.0);
-    psSparseMatrixElement (sparse, 1, 1, 2.0);
-    psSparseMatrixElement (sparse, 2, 2, 1.0);
-
-    psSparseMatrixElement (sparse, 1, 0, 0.1);
-    psSparseMatrixElement (sparse, 2, 0, -0.1);
-
-    psSparseResort (sparse);
-    for (int i = 0; i < sparse->Nelem; i++) {
-        fprintf (stderr, "%d %d %f\n",
-                 sparse->Si->data.S32[i],
-                 sparse->Sj->data.S32[i],
-                 sparse->Aij->data.F32[i]);
-    }
-
-    psVector *x = psVectorAlloc (3, PS_DATA_F32);
-    x->data.F32[0] = 3;
-    x->data.F32[1] = 5;
-    x->data.F32[2] = 7;
-    x->n = 3;
-    fprintf (stderr, "x: %f %f %f\n", x->data.F32[0], x->data.F32[1], x->data.F32[2]);
-
-
-    psVector *B = psSparseMatrixTimesVector (NULL, sparse, x);
-    fprintf (stderr, "B: %f %f %f\n", B->data.F32[0], B->data.F32[1], B->data.F32[2]);
-
-    sparse->Bfj->data.F32[0] = B->data.F32[0];
-    sparse->Bfj->data.F32[1] = B->data.F32[1];
-    sparse->Bfj->data.F32[2] = B->data.F32[2];
-
-    psSparseConstraint constraint;
-    constraint.paramMin   = -1e8;
-    constraint.paramMax   = +1e8;
-    constraint.paramDelta = +1e8;
-
-    x = psSparseSolve (x, constraint, sparse, 0);
-    fprintf (stderr, "x: %f %f %f\n", x->data.F32[0], x->data.F32[1], x->data.F32[2]);
-
-    x = psSparseSolve (x, constraint, sparse, 1);
-    fprintf (stderr, "x: %f %f %f\n", x->data.F32[0], x->data.F32[1], x->data.F32[2]);
-
-    x = psSparseSolve (x, constraint, sparse, 2);
-    fprintf (stderr, "x: %f %f %f\n", x->data.F32[0], x->data.F32[1], x->data.F32[2]);
-
-    x = psSparseSolve (x, constraint, sparse, 3);
-    fprintf (stderr, "x: %f %f %f\n", x->data.F32[0], x->data.F32[1], x->data.F32[2]);
-
-    x = psSparseSolve (x, constraint, sparse, 4);
-    fprintf (stderr, "x: %f %f %f\n", x->data.F32[0], x->data.F32[1], x->data.F32[2]);
-    return;
-}
-
Index: trunk/psLib/test/math/tst_psSpline1D.c
===================================================================
--- trunk/psLib/test/math/tst_psSpline1D.c	(revision 42336)
+++ 	(revision )
@@ -1,892 +1,0 @@
-/* @file  tst_psImageManip.c
-*
-*  @brief This file will contain tests for all of the public psLib functions
-*         that implement 1-D spline functionality:
-* psSpline1DAlloc()
-* psSpline1DEval()
-* psSpline1DEvalVector()
-* psVectorFitSpline1D()
-*
-*         This file is composed of the tests formerly in tst_psFunc02.c,
-*         tst_psFunc03.c, tst_psFunc04.c, tst_psFunc05.c, and tst_psFunc07.c.
-*
-*  @author GLG, MHPCC
-*
-*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-02-07 23:52:54 $
-*
-*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
-*/
-
-#include "psTest.h"
-#include "pslib_strict.h"
-
-static psS32 psSplineAllocTest( void );
-static psS32 psSplineEvalTest( void );
-static psS32 psSplineEvalVectorTest( void );
-
-// {testFunction, testpointNumber, description, expected rc, boolean-ignore this test}
-testDescription tests[] = {
-                              {psSplineAllocTest, 665, "(TEST A) psSplineAllocTest",true, false},
-                              {psSplineEvalTest, 666, "(TEST B) psSplineEvalTest",true, false},
-                              {psSplineEvalVectorTest,667,"(TEST C) psSplineEvalVectorTest",true,false},
-                              {NULL}
-                          };
-
-#define  ERROR_TOLERANCE_PERCENT    1.00
-/*********************************************************************************
-CheckErrorF32(psF32 actual, psF32 expect): this routine returns FALSE if the
-actual and expect arguments are with ERROR_TOLERANCE_PERCENT of each other,
-otherwise it returns TRUE.
- ********************************************************************************/
-psBool CheckErrorF32(
-    psF32 actual,
-    psF32 expect)
-{
-    if ((fabs(actual - expect) / fabs(expect)) > ERROR_TOLERANCE_PERCENT) {
-        return(true);
-    } else {
-        return(false);
-    }
-}
-
-psS32 main(
-    psS32 argc,
-    char* argv[])
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel( PS_LOG_INFO );
-    //
-    // Set the following trace levels to track what is happening in the
-    // various functions in psSpline.c
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("spline1DFree", 0);
-    psTraceSetLevel("calculateSecondDerivs", 0);
-    psTraceSetLevel("vectorBinDisectF32", 0);
-    psTraceSetLevel("vectorBinDisectF64", 0);
-    psTraceSetLevel("p_psVectorBinDisect", 0);
-    psTraceSetLevel("psSpline1DAlloc", 0);
-    psTraceSetLevel("psVectorFitSpline1D", 0);
-    psTraceSetLevel("psSpline1DEval", 0);
-    psTraceSetLevel("psSpline1DEvalVector", 0);
-
-    return ( ! runTestSuite( stderr, "psSpline1D", tests, argc, argv ) );
-}
-
-psS32 psSplineAllocTest()
-{
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("spline1DFree", 0);
-    psTraceSetLevel("calculateSecondDerivs", 0);
-    psTraceSetLevel("vectorBinDisectF32", 0);
-    psTraceSetLevel("vectorBinDisectF64", 0);
-    psTraceSetLevel("p_psVectorBinDisect", 0);
-    psTraceSetLevel("psSpline1DAlloc", 0);
-    psTraceSetLevel("psVectorFitSpline1D", 0);
-    psTraceSetLevel("psSpline1DEval", 0);
-    psTraceSetLevel("psSpline1DEvalVector", 0);
-
-    psS32 testStatus = true;
-    psS32  currentId = psMemGetId();
-
-    psSpline1D *tmpSpline = psSpline1DAlloc();
-    if (tmpSpline == NULL) {
-        printf("TEST ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != 0) {
-        printf("TEST ERROR: psSpline1DAlloc() did not properly set the psSpline1D->n member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->spline != NULL) {
-        printf("TEST ERROR: psSpline1DAlloc() did not properly set the psSpline1D->spline member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->knots != NULL) {
-        printf("TEST ERROR: psSpline1DAlloc() did not properly set the psSpline1D->knots member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->p_psDeriv2 != NULL) {
-        printf("TEST ERROR: psSpline1DAlloc() did not properly set the psSpline1D->p_psDeriv2 member.\n");
-        testStatus = false;
-    }
-    /*
-     XXX: Must allocate these members.
-        tmpSline->spline = (psPolynomial1D **) psAlloc(numSplines * sizeof(psPolynomial1D *));
-        for (psS32 i=0;i<numSplines;i++) {
-            spline->spline[i] = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 3);
-        }
-    */
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    psS32 memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    return(testStatus);
-}
-
-
-/*********************************************************************************
-psSplineEvalTest_sub(): We psVectorFitSpline1D with NULL arguments. psSpline1DEval()
- ********************************************************************************/
-psS32 psSplineEvalTest_sub(psS32 NumSplines)
-{
-    psS32 testStatus = true;
-    psS32 memLeaks=0;
-    psS32  currentId = psMemGetId();
-
-    printf("\n");
-    printf("Calling psVectorFitSpline1D() with NULL y-vector.  Should generate error.\n");
-    psSpline1D *tmpSpline = psVectorFitSpline1D(NULL, NULL);
-    if (tmpSpline != NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not return NULL.\n");
-        testStatus = false;
-        psFree(tmpSpline);
-    }
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    return (testStatus);
-}
-
-
-/*********************************************************************************
-psSplineEvalTest_sub00(): We test the psVectorFitSpline1D, psSpline1DEval()
-functions with a very simple x->y mapping (defined by myFunc00() below).  We
-do this for both F32 and F64 versions of the input x and y vectors.
- ********************************************************************************/
-psF32 myFunc00(psF32 x)
-{
-    return(x);
-}
-
-psS32 psSplineEvalTest_sub00(psS32 NumSplines)
-{
-    psS32 testStatus = true;
-    psS32 memLeaks=0;
-    psF32 x;
-    psF32 y;
-    psS32  currentId = psMemGetId();
-    psVector *xF32 = NULL;
-    psVector *xF64 = NULL;
-    psVector *yF32 = NULL;
-    psVector *yF64 = NULL;
-    psSpline1D *tmpSpline = NULL;
-
-    printf("\n");
-    printf("psSplineEvalTest_sub00(): We test the psVectorFitSpline1D, psSpline1DEval() functions with a very\n");
-    printf("simple x->y mapping (defined by myFunc00()).  We do this for both F32\n");
-    printf("and F64 versions of the input x and y vectors.\n");
-    printf("    Number of splines: %d\n", NumSplines);
-    /****************************************************************************/
-    /*    PS_TYPE_F32, PS_TYPE_F32 test          */
-    /****************************************************************************/
-    printf("Performing the F32 test....\n");
-    xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
-    xF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
-    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++) {
-        xF32->data.F32[i] = (psF32) i;
-        xF64->data.F64[i] = (psF64) i;
-        yF32->data.F32[i] = (psF32) myFunc00(xF32->data.F32[i]);
-        yF64->data.F64[i] = (psF64) myFunc00(xF32->data.F32[i]);
-    }
-
-    tmpSpline = psVectorFitSpline1D(xF32, yF32);
-    if (tmpSpline == NULL) {
-        printf("TEST ERROR: Could not allocate psSpline1D data structure (1)\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != NumSplines) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->n member.\n");
-        printf("            psSpline1D->NumSplines was %d, should be %d.\n", tmpSpline->n, NumSplines);
-        testStatus = false;
-    }
-
-    if (tmpSpline->spline == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline member.\n");
-        testStatus = false;
-    } else {
-        for (psS32 i = 0 ; i < NumSplines ; i++) {
-            if (tmpSpline->spline[i] == NULL) {
-                printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline[%d] member.\n", i);
-                testStatus = false;
-            } else {
-                if (psTraceGetLevel(__func__) >= 6) {
-                    PS_POLY_PRINT_1D(tmpSpline->spline[i]);
-                }
-            }
-        }
-    }
-
-    if (tmpSpline->knots == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->knots member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->p_psDeriv2 == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->p_psDeriv2 member.\n");
-        testStatus = false;
-    }
-
-    if (testStatus == true) {
-        for (psS32 i=0;i<NumSplines;i++) {
-            x = 0.5 + (float) i;
-            y = psSpline1DEval(tmpSpline, x);
-            if (CheckErrorF32(y, myFunc00(x))) {
-                printf("TEST ERROR: f(%f) is %f, should be %f\n", x, y, myFunc00(x));
-                testStatus = false;
-            }
-        }
-    }
-
-    psFree(tmpSpline);
-    psFree(xF32);
-    psFree(xF64);
-    psFree(yF32);
-    psFree(yF64);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    /****************************************************************************/
-    /*    PS_TYPE_F64, PS_TYPE_F64 test          */
-    /****************************************************************************/
-    printf("Performing the F64 test....\n");
-    xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
-    xF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
-    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++) {
-        xF32->data.F32[i] = (psF32) i;
-        xF64->data.F64[i] = (psF64) i;
-        yF32->data.F32[i] = (psF32) myFunc00(xF32->data.F32[i]);
-        yF64->data.F64[i] = (psF64) myFunc00(xF32->data.F32[i]);
-    }
-
-    tmpSpline = psVectorFitSpline1D(xF64, yF64);
-    if (tmpSpline == NULL) {
-        printf("TEST ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != NumSplines) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->n member.\n");
-        printf("            psSpline1D->NumSplines was %d, should be %d.\n", tmpSpline->n, NumSplines);
-        testStatus = false;
-    }
-
-    if (tmpSpline->spline == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline member.\n");
-        testStatus = false;
-    } else {
-        for (psS32 i = 0 ; i < NumSplines ; i++) {
-            if (tmpSpline->spline[i] == NULL) {
-                printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline[%d] member.\n", i);
-                testStatus = false;
-            } else {
-                if (psTraceGetLevel(__func__) >= 6) {
-                    PS_POLY_PRINT_1D(tmpSpline->spline[i]);
-                }
-            }
-        }
-    }
-
-    if (tmpSpline->knots == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->knots member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->p_psDeriv2 == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->p_psDeriv2 member.\n");
-        testStatus = false;
-    }
-
-    if (testStatus == true) {
-        for (psS32 i=0;i<NumSplines;i++) {
-            x = 0.5 + (float) i;
-            y = psSpline1DEval(tmpSpline, x);
-            if (CheckErrorF32(y, myFunc00(x))) {
-                printf("TEST ERROR: f(%f) is %f, should be %f\n", x, y, myFunc00(x));
-                testStatus = false;
-            }
-        }
-    }
-
-    psFree(tmpSpline);
-    psFree(xF32);
-    psFree(xF64);
-    psFree(yF32);
-    psFree(yF64);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    return (testStatus);
-}
-
-/*********************************************************************************
-psSplineEvalTest_sub00b(): We test the psVectorFitSpline1D, psSpline1DEval()
-functions with a more complicated x->y mapping (defined by myFunc00b() below).
-We do this for both F32 and F64 versions of the input x and y vectors.
- ********************************************************************************/
-#define A 4.0
-#define B -3.0
-#define C 0.2
-#define D 0.1
-psF32 myFunc00b(psF32 x)
-{
-    return(A + x * (B + x * (C + x * (D))));
-}
-
-psS32 psSplineEvalTest_sub00b(psS32 NumSplines)
-{
-    printf("\n");
-    printf("psSplineEvalTest_sub00b(): We test the psVectorFitSpline1D, psSpline1DEval() functions with a\n");
-    printf("more complicated x->y mapping (defined by myFunc00b()).  We do this for\n");
-    printf("both F32 and F64 versions of the input x and y vectors.\n");
-    printf("    Number of splines: %d\n", NumSplines);
-    psS32 testStatus = true;
-    psS32 memLeaks=0;
-    psF32 x;
-    psF32 y;
-    psS32  currentId = psMemGetId();
-    psVector *xF32 = NULL;
-    psVector *xF64 = NULL;
-    psVector *yF32 = NULL;
-    psVector *yF64 = NULL;
-    psSpline1D *tmpSpline = NULL;
-
-    /****************************************************************************/
-    /*    PS_TYPE_F32, PS_TYPE_F32 test          */
-    /****************************************************************************/
-    printf("Performing the F32 test....\n");
-    xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
-    xF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
-    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++) {
-        xF32->data.F32[i] = (psF32) i;
-        xF64->data.F64[i] = (psF64) i;
-        yF32->data.F32[i] = (psF32) myFunc00b(xF32->data.F32[i]);
-        yF64->data.F64[i] = (psF64) myFunc00b(xF32->data.F32[i]);
-    }
-
-    tmpSpline = psVectorFitSpline1D(xF32, yF32);
-    if (tmpSpline == NULL) {
-        printf("TEST ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != NumSplines) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->n member.\n");
-        printf("            psSpline1D->NumSplines was %d, should be %d.\n", tmpSpline->n, NumSplines);
-        testStatus = false;
-    }
-
-    if (tmpSpline->spline == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline member.\n");
-        testStatus = false;
-    } else {
-        for (psS32 i = 0 ; i < NumSplines ; i++) {
-            if (tmpSpline->spline[i] == NULL) {
-                printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline[%d] member.\n", i);
-                testStatus = false;
-            } else {
-                if (psTraceGetLevel(__func__) >= 6) {
-                    PS_POLY_PRINT_1D(tmpSpline->spline[i]);
-                }
-            }
-        }
-    }
-
-    if (tmpSpline->knots == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->knots member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->p_psDeriv2 == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->p_psDeriv2 member.\n");
-        testStatus = false;
-    }
-
-    if (testStatus == true) {
-        for (psS32 i=0;i<NumSplines;i++) {
-            x = 0.5 + (float) i;
-            y = psSpline1DEval(tmpSpline, x);
-            if (CheckErrorF32(y, myFunc00b(x))) {
-                printf("TEST ERROR: f(%f) is %f, should be %f\n", x, y, myFunc00b(x));
-                testStatus = false;
-            }
-        }
-    }
-
-    psFree(tmpSpline);
-    psFree(xF32);
-    psFree(xF64);
-    psFree(yF32);
-    psFree(yF64);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    /****************************************************************************/
-    /*    PS_TYPE_F64, PS_TYPE_F64 test          */
-    /****************************************************************************/
-    printf("Performing the F64 test....\n");
-    xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
-    xF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
-    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++) {
-        xF32->data.F32[i] = (psF32) i;
-        xF64->data.F64[i] = (psF64) i;
-        yF32->data.F32[i] = (psF32) myFunc00b(xF32->data.F32[i]);
-        yF64->data.F64[i] = (psF64) myFunc00b(xF32->data.F32[i]);
-    }
-
-    tmpSpline = psVectorFitSpline1D(xF64, yF64);
-    if (tmpSpline == NULL) {
-        printf("TEST ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != NumSplines) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->n member.\n");
-        printf("            psSpline1D->NumSplines was %d, should be %d.\n", tmpSpline->n, NumSplines);
-        testStatus = false;
-    }
-
-    if (tmpSpline->spline == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline member.\n");
-        testStatus = false;
-    } else {
-        for (psS32 i = 0 ; i < NumSplines ; i++) {
-            if (tmpSpline->spline[i] == NULL) {
-                printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline[%d] member.\n", i);
-                testStatus = false;
-            } else {
-                if (psTraceGetLevel(__func__) >= 6) {
-                    PS_POLY_PRINT_1D(tmpSpline->spline[i]);
-                }
-            }
-        }
-    }
-
-    if (tmpSpline->knots == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->knots member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->p_psDeriv2 == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->p_psDeriv2 member.\n");
-        testStatus = false;
-    }
-
-    if (testStatus == true) {
-        for (psS32 i=0;i<NumSplines;i++) {
-            x = 0.5 + (float) i;
-            y = psSpline1DEval(tmpSpline, x);
-            if (CheckErrorF32(y, myFunc00b(x))) {
-                printf("TEST ERROR: f(%f) is %f, should be %f\n", x, y, myFunc00b(x));
-                testStatus = false;
-            }
-        }
-    }
-
-    psFree(tmpSpline);
-    psFree(xF32);
-    psFree(xF64);
-    psFree(yF32);
-    psFree(yF64);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    return (testStatus);
-}
-
-
-/*********************************************************************************
-psSplineEvalTest_sub00b():  This is similar to psSplineEvalTest_sub00b()
-except that the x vector is NULL.
- ********************************************************************************/
-psS32 psSplineEvalTest_sub00c(psS32 NumSplines)
-{
-    printf("\n");
-    printf("psSplineEvalTest_sub00c(): This is similar to psSplineEvalTest_sub00b()\n");
-    printf("except that the x vector is NULL.\n");
-    printf("    Number of splines: %d\n", NumSplines);
-    psS32 testStatus = true;
-    psS32 memLeaks=0;
-    psF32 x;
-    psF32 y;
-    psS32  currentId = psMemGetId();
-    psVector *xF32 = NULL;
-    psVector *xF64 = NULL;
-    psVector *yF32 = NULL;
-    psVector *yF64 = NULL;
-    psSpline1D *tmpSpline = NULL;
-
-    /****************************************************************************/
-    /*    PS_TYPE_F32, PS_TYPE_F32 test          */
-    /****************************************************************************/
-    printf("Performing the F32 test....\n");
-    xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
-    xF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
-    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++) {
-        xF32->data.F32[i] = (psF32) i;
-        xF64->data.F64[i] = (psF64) i;
-        yF32->data.F32[i] = (psF32) myFunc00b(xF32->data.F32[i]);
-        yF64->data.F64[i] = (psF64) myFunc00b(xF32->data.F32[i]);
-    }
-
-    tmpSpline = psVectorFitSpline1D(NULL, yF32);
-    if (tmpSpline == NULL) {
-        printf("TEST ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != NumSplines) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->n member.\n");
-        printf("            psSpline1D->NumSplines was %d, should be %d.\n", tmpSpline->n, NumSplines);
-        testStatus = false;
-    }
-
-    if (tmpSpline->spline == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline member.\n");
-        testStatus = false;
-    } else {
-        for (psS32 i = 0 ; i < NumSplines ; i++) {
-            if (tmpSpline->spline[i] == NULL) {
-                printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline[%d] member.\n", i);
-                testStatus = false;
-            } else {
-                if (psTraceGetLevel(__func__) >= 6) {
-                    PS_POLY_PRINT_1D(tmpSpline->spline[i]);
-                }
-            }
-        }
-    }
-
-    if (tmpSpline->knots == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->knots member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->p_psDeriv2 == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->p_psDeriv2 member.\n");
-        testStatus = false;
-    }
-
-    if (testStatus == true) {
-        for (psS32 i=0;i<NumSplines;i++) {
-            x = 0.5 + (float) i;
-            y = psSpline1DEval(tmpSpline, x);
-            if (CheckErrorF32(y, myFunc00b(x))) {
-                printf("TEST ERROR: f(%f) is %f, should be %f\n", x, y, myFunc00b(x));
-                testStatus = false;
-            }
-        }
-    }
-
-    psFree(tmpSpline);
-    psFree(xF32);
-    psFree(xF64);
-    psFree(yF32);
-    psFree(yF64);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    /****************************************************************************/
-    /*    PS_TYPE_F64, PS_TYPE_F64 test          */
-    /****************************************************************************/
-    printf("Performing the F64 test....\n");
-    xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
-    xF64 = psVectorAlloc(NumSplines+1, PS_TYPE_F64);
-    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++) {
-        xF32->data.F32[i] = (psF32) i;
-        xF64->data.F64[i] = (psF64) i;
-        yF32->data.F32[i] = (psF32) myFunc00b(xF32->data.F32[i]);
-        yF64->data.F64[i] = (psF64) myFunc00b(xF32->data.F32[i]);
-    }
-
-    tmpSpline = psVectorFitSpline1D(NULL, yF64);
-    if (tmpSpline == NULL) {
-        printf("TEST ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != NumSplines) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->n member.\n");
-        printf("            psSpline1D->NumSplines was %d, should be %d.\n", tmpSpline->n, NumSplines);
-        testStatus = false;
-    }
-
-    if (tmpSpline->spline == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline member.\n");
-        testStatus = false;
-    } else {
-        for (psS32 i = 0 ; i < NumSplines ; i++) {
-            if (tmpSpline->spline[i] == NULL) {
-                printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline[%d] member.\n", i);
-                testStatus = false;
-            } else {
-                if (psTraceGetLevel(__func__) >= 6) {
-                    PS_POLY_PRINT_1D(tmpSpline->spline[i]);
-                }
-            }
-        }
-    }
-
-    if (tmpSpline->knots == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->knots member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->p_psDeriv2 == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->p_psDeriv2 member.\n");
-        testStatus = false;
-    }
-
-    if (testStatus == true) {
-        for (psS32 i=0;i<NumSplines;i++) {
-            x = 0.5 + (float) i;
-            y = psSpline1DEval(tmpSpline, x);
-            if (CheckErrorF32(y, myFunc00b(x))) {
-                printf("TEST ERROR: f(%f) is %f, should be %f\n", x, y, myFunc00b(x));
-                testStatus = false;
-            }
-        }
-    }
-
-    psFree(tmpSpline);
-    psFree(xF32);
-    psFree(xF64);
-    psFree(yF32);
-    psFree(yF64);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    return (testStatus);
-}
-
-
-
-psS32 psSplineEvalTest()
-{
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("spline1DFree", 0);
-    psTraceSetLevel("calculateSecondDerivs", 0);
-    psTraceSetLevel("vectorBinDisectF32", 0);
-    psTraceSetLevel("vectorBinDisectF64", 0);
-    psTraceSetLevel("p_psVectorBinDisect", 0);
-    psTraceSetLevel("psSpline1DAlloc", 0);
-    psTraceSetLevel("psVectorFitSpline1D", 0);
-    psTraceSetLevel("psSpline1DEval", 0);
-    psTraceSetLevel("psSpline1DEvalVector", 0);
-
-    psS32 testStatus = psSplineEvalTest_sub(10);
-
-    // HEY: XXX: Test with empty psVectors.
-    //    testStatus |= psSplineEvalTest_sub00(0);
-    //    testStatus |= psSplineEvalTest_sub00b(0);
-    //    testStatus |= psSplineEvalTest_sub00c(0);
-
-    testStatus |= psSplineEvalTest_sub00(1);
-    testStatus |= psSplineEvalTest_sub00b(1);
-    testStatus |= psSplineEvalTest_sub00c(1);
-
-    testStatus |= psSplineEvalTest_sub00(95);
-    testStatus |= psSplineEvalTest_sub00b(95);
-    testStatus |= psSplineEvalTest_sub00c(95);
-
-    return(testStatus);
-}
-
-
-
-psS32 psSplineEvalVectorTest_sub00(psS32 NumSplines)
-{
-    psS32 testStatus = true;
-    psS32 memLeaks=0;
-
-    psS32  currentId = psMemGetId();
-    psVector *xF32 = NULL;
-    psVector *yF32 = NULL;
-    psSpline1D *tmpSpline = NULL;
-    /****************************************************************************/
-    /*    PS_TYPE_F32, PS_TYPE_F32 test          */
-    /****************************************************************************/
-    printf("Performing the F32 test....\n");
-    xF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
-    yF32 = psVectorAlloc(NumSplines+1, PS_TYPE_F32);
-    psVector *xF32Test = psVectorAlloc(NumSplines, PS_TYPE_F32);
-    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++) {
-        xF32->data.F32[i] = (psF32) i;
-        yF32->data.F32[i] = (psF32) i;
-    }
-
-    tmpSpline = psVectorFitSpline1D(xF32, yF32);
-    if (tmpSpline == NULL) {
-        printf("TEST ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != NumSplines) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->n member.\n");
-        printf("            psSpline1D->NumSplines was %d, should be %d.\n", tmpSpline->n, NumSplines);
-        testStatus = false;
-    }
-
-    if (tmpSpline->spline == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline member.\n");
-        testStatus = false;
-    } else {
-        for (psS32 i = 0 ; i < NumSplines ; i++) {
-            if (tmpSpline->spline[i] == NULL) {
-                printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->spline[%d] member.\n", i);
-                testStatus = false;
-            } else {
-                if (psTraceGetLevel(__func__) >= 6) {
-                    PS_POLY_PRINT_1D(tmpSpline->spline[i]);
-                }
-            }
-        }
-    }
-
-    if (tmpSpline->knots == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->knots member.\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->p_psDeriv2 == NULL) {
-        printf("TEST ERROR: psVectorFitSpline1D() did not properly set the psSpline1D->p_psDeriv2 member.\n");
-        testStatus = false;
-    }
-
-    printf("Testing psSpline1DEvalVector() with an F32 vector.\n");
-    if (testStatus == true) {
-        for (psS32 i=0;i<NumSplines;i++) {
-            xF32Test->data.F32[i] = 0.5 + (psF32) i;
-        }
-        yF32Test = psSpline1DEvalVector(tmpSpline, xF32Test);
-
-        for (psS32 i=0;i<NumSplines;i++) {
-            if (CheckErrorF32(yF32Test->data.F32[i], xF32Test->data.F32[i])) {
-                printf("TEST ERROR: f(%f) is %f\n", xF32Test->data.F32[i], yF32Test->data.F32[i]);
-                testStatus = false;
-            }
-        }
-        psFree(yF32Test);
-    }
-
-    printf("Testing psSpline1DEvalVector() with an F64 vector.\n");
-    if (testStatus == true) {
-        for (psS32 i=0;i<NumSplines;i++) {
-            xF64Test->data.F64[i] = 0.5 + (psF64) i;
-        }
-        yF32Test = psSpline1DEvalVector(tmpSpline, xF64Test);
-
-        for (psS32 i=0;i<NumSplines;i++) {
-            if (CheckErrorF32(yF32Test->data.F32[i], (psF32) xF64Test->data.F64[i])) {
-                printf("TEST ERROR: f(%f) is %f\n", (psF32) xF64Test->data.F64[i], yF32Test->data.F32[i]);
-                testStatus = false;
-            }
-        }
-    }
-
-    psFree(tmpSpline);
-    psFree(xF32);
-    psFree(yF32);
-    psFree(xF32Test);
-    psFree(yF32Test);
-    psFree(xF64Test);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    return (testStatus);
-}
-
-psS32 psSplineEvalVectorTest()
-{
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("spline1DFree", 0);
-    psTraceSetLevel("calculateSecondDerivs", 0);
-    psTraceSetLevel("vectorBinDisectF32", 0);
-    psTraceSetLevel("vectorBinDisectF64", 0);
-    psTraceSetLevel("p_psVectorBinDisect", 0);
-    psTraceSetLevel("psSpline1DAlloc", 0);
-    psTraceSetLevel("psVectorFitSpline1D", 0);
-    psTraceSetLevel("psSpline1DEval", 0);
-    psTraceSetLevel("psSpline1DEvalVector", 0);
-
-    return(psSplineEvalVectorTest_sub00(10));
-}
-
Index: trunk/psLib/test/math/tst_psStats00.c
===================================================================
--- trunk/psLib/test/math/tst_psStats00.c	(revision 42336)
+++ 	(revision )
@@ -1,435 +1,0 @@
-/** @file  tst_psStats00.c
-*
-*  @brief Contains tests for psVectorStats with sample mean calculations
-*
-*  We extensively test the code with data type PS_TYPE_F32.  If these pass, we
-*  do a much simpler test with data type PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64.
-*
-*  If the psStats,c code ever changes such that vectors of different type
-*  are handled by different routines, then these tests must be extended.
-*
-*  @author GLG, MHPCC
-*
-*  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
-*  @date $Date: 2006-07-28 00:44:05 $
-*
-*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
-*/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define ERROR_TOL  0.0001
-#define N 15
-#define VERBOSE 1
-static psS32 testStatsSampleMeanF32(void);
-static psS32 testStatsSampleMeanS8(void);
-static psS32 testStatsSampleMeanU16(void);
-static psS32 testStatsSampleMeanF64(void);
-
-testDescription tests[] = {
-                              {testStatsSampleMeanF32, 512, "psVectorStats",0,false},
-                              {testStatsSampleMeanS8, 512, "psVectorStats",0,false},
-                              {testStatsSampleMeanU16, 512, "psVectorStats",0,false},
-                              {testStatsSampleMeanF64, 512, "psVectorStats",0,false},
-                              {NULL}
-                          };
-
-static psF32 samplesF32[N] = { 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0,
-                               11.01, -12.02, 13.03, 14.04, -15.05 };
-static psS8  samplesS8[N]  = {1, 2, -3, 4, 5, -6, 7, 8, -9, 10, 11, -12, 13, 14, -15};
-static psU16 samplesU16[N] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
-static psF64 samplesF64[N] = { 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0,
-                               11.01, -12.02, 13.03, 14.04, -15.05 };
-static psF32 errorsF32[N] = { -0.10,  0.11, -0.12,  0.13, -0.14,  0.15, -0.16,  0.17,
-                              -0.18,  0.19, -0.20,  0.21, -0.22,  0.23, -0.24 };
-
-static psF64 expectedMeanNoMaskF32              =  2.060667;
-static psF64 expectedMeanWithMaskF32            =  2.123846;
-static psF64 expectedMeanNoMaskS8               =  2.000000;
-static psF64 expectedMeanNoMaskU16              =  8.000000;
-static psF64 expectedMeanNoMaskF64              =  2.060667;
-static psF64 expectedMeanRangeNoMaskF32         =  0.137500;
-static psF64 expectedMeanRangeWithMaskF32       = -0.366667;
-static psF64 expectedWeightMeanNoMaskF32        =  1.807210;
-static psF64 expectedWeightMeanWithMaskF32      =  1.890217;
-static psF64 expectedWeightMeanNoMaskRangeF32   =  0.640952;
-static psF64 expectedWeightMeanWithMaskRangeF32 =  0.046574;
-
-psF64 rtc(void);
-psF64 sT, eT;
-psF64 diff;
-
-#include <unistd.h>
-psS32 main(psS32 argc, char* argv[] )
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorSampleMean", 10);
-    psTraceSetLevel("p_psVectorMax", 0);
-    psTraceSetLevel("p_psVectorMin", 0);
-    psTraceSetLevel("p_psVectorNValues", 0);
-    psTraceSetLevel("p_psNormalizeVectorRange", 0);
-    psTraceSetLevel("psStatsAlloc", 0);
-    psTraceSetLevel("p_psConvertToF32", 0);
-    psTraceSetLevel("psVectorStats", 0);
-
-    return ( ! runTestSuite(stderr, "psVectorStats",tests,argc,argv) );
-}
-
-psS32 testStatsSampleMeanF32(void)
-{
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    psVector *myVector = psVectorAlloc(N, PS_TYPE_F32);
-    myVector->n = N;
-    psVector *myErrors = psVectorAlloc(N, PS_TYPE_F32);
-    myErrors->n = N;
-    psVector *maskVector = psVectorAlloc(N, PS_TYPE_U8);
-    maskVector->n = N;
-
-    psF64 mean = 0.0;
-    // Set the appropriate values for the vector data.
-    for (long i = 0; i < N; i++) {
-        myVector->data.F32[i] =  samplesF32[i];
-        myErrors->data.F32[i] =  errorsF32[i];
-    }
-
-    // Set the mask vector and calculate the expected maximum.
-    for (psS32 i = 0; i < N; i++) {
-
-        if (i > 1) {
-            maskVector->data.U8[i] = 0;
-        } else {
-            maskVector->data.U8[i] = 1;
-        }
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanNoMaskF32);
-    }
-    if (isnan(myStats->sampleMean) || (fabs(mean - expectedMeanNoMaskF32) > ERROR_TOL)) {
-        psError(PS_ERR_UNKNOWN,true,"Returned value %f not as expected %f",
-                mean, expectedMeanNoMaskF32);
-        return 1;
-    }
-
-    // Invoke psVectorStats with no vector mask and error vector
-    myStats = psVectorStats(myStats, myVector, myErrors, NULL, 0);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedWeightMeanNoMaskF32);
-    }
-    if (isnan(myStats->sampleMean) || (fabs(mean - expectedWeightMeanNoMaskF32) > ERROR_TOL)) {
-        psError(PS_ERR_UNKNOWN,true,"Returned value %f not as expected %f",
-                mean, expectedWeightMeanNoMaskF32);
-        return 10;
-    }
-
-    // Invoke psVectorStats with no vector mask and data range
-    myStats->min = -10.0;
-    myStats->max =   8.0;
-    myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE;
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanRangeNoMaskF32);
-    }
-    if ( fabs(mean - expectedMeanRangeNoMaskF32) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Return value %f not as expected %f",
-                mean, expectedMeanRangeNoMaskF32);
-        return 2;
-    }
-
-    // Invoke psVectorStats with no vector mask, errors and data range
-    myStats = psVectorStats(myStats, myVector, myErrors, NULL, 0);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedWeightMeanNoMaskRangeF32);
-    }
-    if ( fabs(mean - expectedWeightMeanNoMaskRangeF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Return value %f not as expected %f",
-                mean, expectedWeightMeanNoMaskRangeF32);
-        return 20;
-    }
-    myStats->options = PS_STAT_SAMPLE_MEAN;
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with vector mask=1.                             */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    mean = myStats->sampleMean;
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanWithMaskF32);
-    }
-    if ( fabs(mean - expectedMeanWithMaskF32) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Returned value %f not as expected %f",
-                mean, expectedMeanWithMaskF32);
-        return 3;
-    }
-
-    // Invoke psVectorStats with vector mask and error vector
-    myStats = psVectorStats(myStats, myVector, myErrors, maskVector, 1);
-    mean = myStats->sampleMean;
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedWeightMeanWithMaskF32);
-    }
-    if ( fabs(mean - expectedWeightMeanWithMaskF32) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Returned value %f not as expected %f",
-                mean, expectedWeightMeanWithMaskF32);
-        return 30;
-    }
-
-    // Invoke psVectorStats with vector mask and data range
-    myStats->options = PS_STAT_SAMPLE_MEAN | PS_STAT_USE_RANGE;
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanRangeWithMaskF32);
-    }
-    if ( fabs(mean - expectedMeanRangeWithMaskF32) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Return value %f not as expected %f",
-                mean, expectedMeanRangeWithMaskF32);
-        return 4;
-    }
-
-    // Invoke psVectorStats with vector mask, errors, and data range
-    myStats = psVectorStats(myStats, myVector, myErrors, maskVector, 1);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedWeightMeanWithMaskRangeF32);
-    }
-    if ( fabs(mean - expectedWeightMeanWithMaskRangeF32) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Return value %f not as expected %f",
-                mean, expectedWeightMeanWithMaskRangeF32);
-        return 40;
-    }
-    myStats->options = PS_STAT_SAMPLE_MEAN;
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with vector mask=2.                             */
-    /*************************************************************************/
-    // Set the mask vector and calculate the expected maximum.
-    // Set the mask vector.
-    for (psS32 i = 0; i < N; i++) {
-        if (maskVector->data.U8[i] == 1) {
-            maskVector->data.U8[i] = 2;
-        }
-    }
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 2);
-    mean = myStats->sampleMean;
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanWithMaskF32);
-    }
-    if (fabs(mean - expectedMeanWithMaskF32) > ERROR_TOL )  {
-        psError(PS_ERR_UNKNOWN,true,"Returned value %f not as expected %f",
-                mean,expectedMeanWithMaskF32);
-        return 5;
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with vector mask=3.                             */
-    /*************************************************************************/
-    // Set the mask vector and calculate the expected maximum.
-    // Set the mask vector.
-    for (psS32 i = 0; i < N; i++) {
-        if (maskVector->data.U8[i] == 2) {
-            maskVector->data.U8[i] = 3;
-        }
-    }
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 4);
-    mean = myStats->sampleMean;
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanNoMaskF32);
-    }
-    if (fabs(mean - expectedMeanNoMaskF32) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Return value %f not as expected %f",
-                mean,expectedMeanNoMaskF32);
-        return 6;
-    }
-
-    // Mask all values and verify return is NAN
-    for(psS32 i = 0; i < N; i++) {
-        maskVector->data.U8[i] = 1;
-    }
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate warning message");
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    mean = myStats->sampleMean;
-    if( !isnan(mean) ) {
-        psError(PS_ERR_UNKNOWN,true,"Did not return NAN with all values masked");
-        return 7;
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with NULL inputs.                               */
-    /*************************************************************************/
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
-    if( psVectorStats(myStats, NULL, NULL, NULL, 0) != NULL ) {
-        psError(PS_ERR_UNKNOWN,true,"psVectorStats did not return NULL");
-        return 8;
-    }
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message.");
-    psStats *myStats2 = psVectorStats(NULL, myVector, NULL, NULL, 0);
-    if ( myStats2 != NULL ) {
-        psError(PS_ERR_UNKNOWN,true,"psVectorStats did not return NULL");
-        return 9;
-    }
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                           */
-    /*************************************************************************/
-    psFree(myStats);
-    psFree(myVector);
-    psFree(myErrors);
-    psFree(maskVector);
-    psFree(myStats2);
-
-    return 0;
-}
-
-psS32 testStatsSampleMeanS8(void)
-{
-    psStats*  myStats  = NULL;
-    psVector* myVector = NULL;
-    psF64     mean     = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    myVector = psVectorAlloc(N, PS_TYPE_S8);
-    myVector->n = N;
-
-    mean = 0.0;
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.S8[i] =  samplesS8[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanNoMaskS8);
-    }
-    if ( fabs(mean - expectedMeanNoMaskS8) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Returned value %f not as expected %f",
-                mean, expectedMeanNoMaskS8);
-        return 1;
-    }
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                           */
-    /*************************************************************************/
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
-psS32 testStatsSampleMeanU16(void)
-{
-    psStats*  myStats  = NULL;
-    psVector* myVector = NULL;
-    psF64     mean     = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    myVector = psVectorAlloc(N, PS_TYPE_U16);
-    myVector->n = N;
-
-    mean = 0.0;
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.U16[i] =  samplesU16[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanNoMaskU16);
-    }
-    if ( fabs(mean - expectedMeanNoMaskU16) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Returned value %f not as expected %f",
-                mean, expectedMeanNoMaskU16);
-        return 1;
-    }
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                           */
-    /*************************************************************************/
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
-psS32 testStatsSampleMeanF64(void)
-{
-    psStats*  myStats  = NULL;
-    psVector* myVector = NULL;
-    psF64     mean     = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    myVector = psVectorAlloc(N, PS_TYPE_F64);
-    myVector->n = N;
-
-    mean = 0.0;
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.F64[i] =  samplesF64[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    mean = myStats->sampleMean;
-    // Verify return value is as expected
-    if (VERBOSE) {
-        printf("psVectorStats() returned %.2f: expected was %.2f\n", mean, expectedMeanNoMaskF64);
-    }
-    if ( fabs(mean - expectedMeanNoMaskF64) > ERROR_TOL ) {
-        psError(PS_ERR_UNKNOWN,true,"Returned value %f not as expected %f",
-                mean, expectedMeanNoMaskF64);
-        return 1;
-    }
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                           */
-    /*************************************************************************/
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psStats01.c
===================================================================
--- trunk/psLib/test/math/tst_psStats01.c	(revision 42336)
+++ 	(revision )
@@ -1,276 +1,0 @@
-/** @file  tst_psStats01.c
-*
-*  @brief Contains tests for psVectorStats with max calculations.
-*
-*  We extensively test the code with data type PS_TYPE_F32.  If these pass, we
-*  do a much simpler test with data types PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64.
-*
-*  If the psStats,c code every changes such that vectors of different type
-*  are handled by different routines, then these tests must be extended.
-*
-*  @author GLG, MHPCC
-*
-*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
-*  @date $Date: 2006-07-28 00:44:05 $
-*
-* Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
-*/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define N 15
-#define ERROR_TOL  0.0001
-
-static psS32 testStatsMaxF32(void);
-static psS32 testStatsMaxS8(void);
-static psS32 testStatsMaxU16(void);
-static psS32 testStatsMaxF64(void);
-
-testDescription tests[] = {
-                              {testStatsMaxF32, 518, "psVectorStats", 0, false},
-                              {testStatsMaxS8, 518, "psVectorStats", 0, false},
-                              {testStatsMaxU16, 518, "psVectorStats", 0, false},
-                              {testStatsMaxF64, 518, "psVectorStats", 0, false},
-                              {NULL}
-                          };
-
-static psF32 samplesF32[N] = { 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0,
-                               11.01, -12.02, 13.03, 14.04, -15.05 };
-static psS8  samplesS8[N]  = {1, 2, -3, 4, 5, -6, 7, 8, -9, 10, 11, -12, 13, 14, -15};
-static psU16 samplesU16[N] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
-static psF64 samplesF64[N] = { 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0,
-                               11.01, -12.02, 13.03, 14.04, -15.05 };
-
-static psF64 expectedMaxNoMaskF32                = 14.04;
-static psF64 expectedMaxNoMaskS8                 = 14.00;
-static psF64 expectedMaxNoMaskU16                = 15.00;
-static psF64 expectedMaxNoMaskF64                = 14.04;
-
-static psF64 expectedMaxWithMaskF32              = 13.03;
-static psF64 expectedMaxRangeNoMaskF32           = 10.00;
-static psF64 expectedMaxRangeWithMaskF32         = 13.03;
-
-psS32 main(psS32 argc, char* argv[] )
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorMax", 0);
-    psTraceSetLevel("p_psVectorMin", 0);
-    psTraceSetLevel("p_psVectorCheckNonEmpty", 0);
-    psTraceSetLevel("p_psVectorNValues", 0);
-    psTraceSetLevel("psStatsAlloc", 0);
-    psTraceSetLevel("p_psConvertToF32", 0);
-    psTraceSetLevel("psVectorStats", 0);
-
-    return ( ! runTestSuite(stderr, "psVectorStats", tests, argc, argv) );
-}
-
-psS32 testStatsMaxF32(void)
-{
-    psStats*  myStats    = NULL;
-    psVector* myVector   = NULL;
-    psVector* maskVector = NULL;
-    psF64     max        = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_MAX);
-    myVector = psVectorAlloc(N, PS_TYPE_F32);
-    myVector->n = N;
-    maskVector = psVectorAlloc(N, PS_TYPE_U8);
-    maskVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.F32[i] = samplesF32[i];
-    }
-
-    // Set the mask vector and calculate the expected maximum.
-    for (psS32 i = 0; i < N; i++) {
-        if (i < 13) {
-            maskVector->data.U8[i] = 0;
-        } else {
-            maskVector->data.U8[i] = 1;
-        }
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    max = myStats->max;
-
-    if (fabs(max - expectedMaxNoMaskF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Max no mask return value %lf not as expected %lf",
-                max, expectedMaxNoMaskF32);
-        return 1;
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with vector mask.                       */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    max = myStats->max;
-    if (fabs(max - expectedMaxWithMaskF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Max with mask return value %lf not as expected %lf",
-                max, expectedMaxWithMaskF32);
-        return 2;
-    }
-
-    // Invoke function with data range with no mask
-    myStats->options = PS_STAT_MAX | PS_STAT_USE_RANGE;
-    myStats->max = 10.1;
-    myStats->min = 0.0;
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    max = myStats->max;
-
-    if(fabs(max - expectedMaxRangeNoMaskF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Max with range no mask %lf not as expected %lf",
-                max, expectedMaxRangeNoMaskF32);
-        return 3;
-    }
-
-    // Invoke function with data range and mask
-    myStats->max = 14.0;
-    myStats->min = 0.0;
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    max = myStats->max;
-    if(fabs(max - expectedMaxRangeWithMaskF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Max with range with mask %lf not as expected %lf",
-                max, expectedMaxRangeWithMaskF32);
-        return 3;
-    }
-
-    // Invoke function with data range with no valid data
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
-    myStats->max = 100.00;
-    myStats->min = 90.00;
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    max = myStats->max;
-
-    if(!isnan(max)) {
-        psError(PS_ERR_UNKNOWN,true,"Max with range with no valid elemenets did not return NAN");
-        return 4;
-    }
-
-    psFree(myStats);
-    psFree(myVector);
-    psFree(maskVector);
-
-    return 0;
-}
-
-psS32 testStatsMaxS8(void)
-{
-    psStats*  myStats    = NULL;
-    psVector* myVector   = NULL;
-    psF64     max        = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_MAX);
-    myVector = psVectorAlloc(N, PS_TYPE_S8);
-    myVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.S8[i] = samplesS8[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    max = myStats->max;
-
-    if (fabs(max - expectedMaxNoMaskS8) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Max no mask return value %lf not as expected %lf",
-                max, expectedMaxNoMaskS8);
-        return 1;
-    }
-
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
-psS32 testStatsMaxU16(void)
-{
-    psStats*  myStats    = NULL;
-    psVector* myVector   = NULL;
-    psF64     max        = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_MAX);
-    myVector = psVectorAlloc(N, PS_TYPE_U16);
-    myVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.U16[i] = samplesU16[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    max = myStats->max;
-
-    if (fabs(max - expectedMaxNoMaskU16) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Max no mask return value %lf not as expected %lf",
-                max, expectedMaxNoMaskU16);
-        return 1;
-    }
-
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
-psS32 testStatsMaxF64(void)
-{
-    psStats*  myStats    = NULL;
-    psVector* myVector   = NULL;
-    psF64     max        = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_MAX);
-    myVector = psVectorAlloc(N, PS_TYPE_F64);
-    myVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.F64[i] = samplesF64[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    max = myStats->max;
-
-    if (fabs(max - expectedMaxNoMaskF64) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Max no mask return value %lf not as expected %lf",
-                max, expectedMaxNoMaskF64);
-        return 1;
-    }
-
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psStats02.c
===================================================================
--- trunk/psLib/test/math/tst_psStats02.c	(revision 42336)
+++ 	(revision )
@@ -1,277 +1,0 @@
-/** @file  tst_psStats02.c
-*
-*  @brief Contains tests for psVectorStats with min calculations
-*
-*  We extensively test the code with data type PS_TYPE_F32.  If these pass, we
-*  do a much simpler test with data types PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_F64.
-*
-*  If the psStats,c code every changes such that vectors of different type
-*  are handled by different routines, then these tests must be extended.
-*
-*  @author GLG, MHPCC
-*
-*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
-*  @date $Date: 2006-07-28 00:44:05 $
-*
-* Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
-*/
-
-#include "pslib_strict.h"
-#include "psTest.h"
-
-#define N 15
-#define ERROR_TOL  0.0001
-
-static psS32 testStatsMinF32(void);
-static psS32 testStatsMinS8(void);
-static psS32 testStatsMinU16(void);
-static psS32 testStatsMinF64(void);
-
-testDescription tests[] = {
-                              {testStatsMinF32, 518, "psVectorStats", 0, false},
-                              {testStatsMinS8, 518, "psVectorStats", 0, false},
-                              {testStatsMinU16, 518, "psVectorStats", 0, false},
-                              {testStatsMinF64, 518, "psVectorStats", 0, false},
-                              {NULL}
-                          };
-
-static psF32 samplesF32[N] = { 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0,
-                               11.01, -12.02, 13.03, 14.04, -15.05 };
-static psS8  samplesS8[N]  = {1, 2, -3, 4, 5, -6, 7, 8, -9, 10, 11, -12, 13, 14, -15};
-static psU16 samplesU16[N] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
-static psF64 samplesF64[N] = { 1.1, 2.2, -3.3, 4.4, 5.5, -6.6, 7.7, 8.8, -9.9, 10.0,
-                               11.01, -12.02, 13.03, 14.04, -15.05 };
-
-static psF64 expectedMinNoMaskF32                = -15.05;
-static psF64 expectedMinNoMaskS8                 = -15.00;
-static psF64 expectedMinNoMaskU16                = 1.00;
-static psF64 expectedMinNoMaskF64                = -15.05;
-
-static psF64 expectedMinWithMaskF32              = -12.02;
-static psF64 expectedMinRangeNoMaskF32           =   1.10;
-static psF64 expectedMinRangeWithMaskF32         = -12.02;
-
-psS32 main(psS32 argc, char* argv[] )
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorMax", 0);
-    psTraceSetLevel("p_psVectorMin", 0);
-    psTraceSetLevel("p_psVectorCheckNonEmpty", 0);
-    psTraceSetLevel("p_psVectorNValues", 0);
-    psTraceSetLevel("p_psNormalizeVectorRange", 0);
-    psTraceSetLevel("psStatsAlloc", 0);
-    psTraceSetLevel("p_psConvertToF32", 0);
-    psTraceSetLevel("psVectorStats", 0);
-
-    return ( ! runTestSuite(stderr, "psVectorStats", tests, argc, argv) );
-}
-
-psS32 testStatsMinF32(void)
-{
-    psStats*  myStats    = NULL;
-    psVector* myVector   = NULL;
-    psVector* maskVector = NULL;
-    psF64     min        = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_MIN);
-    myVector = psVectorAlloc(N, PS_TYPE_F32);
-    myVector->n = N;
-    maskVector = psVectorAlloc(N, PS_TYPE_U8);
-    maskVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.F32[i] = samplesF32[i];
-    }
-
-    // Set the mask vector and calculate the expected maximum.
-    for (psS32 i = 0; i < N; i++) {
-        if (i < 13) {
-            maskVector->data.U8[i] = 0;
-        } else {
-            maskVector->data.U8[i] = 1;
-        }
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    min = myStats->min;
-
-    if (fabs(min - expectedMinNoMaskF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Min no mask return value %lf not as expected %lf",
-                min, expectedMinNoMaskF32);
-        return 1;
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with vector mask.                       */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    min = myStats->min;
-    if (fabs(min - expectedMinWithMaskF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Min with mask return value %lf not as expected %lf",
-                min, expectedMinWithMaskF32);
-        return 2;
-    }
-
-    // Invoke function with data range with no mask
-    myStats->options = PS_STAT_MIN | PS_STAT_USE_RANGE;
-    myStats->max = 10.1;
-    myStats->min = 0.0;
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    min = myStats->min;
-
-    if(fabs(min - expectedMinRangeNoMaskF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Min with range no mask %lf not as expected %lf",
-                min, expectedMinRangeNoMaskF32);
-        return 3;
-    }
-
-    // Invoke function with data range and mask
-    myStats->max = 10.1;
-    myStats->min = -15.00;
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    min = myStats->min;
-    if(fabs(min - expectedMinRangeWithMaskF32) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Min with range with mask %lf not as expected %lf",
-                min, expectedMinRangeWithMaskF32);
-        return 3;
-    }
-
-    // Invoke function with data range with no valid data
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
-    myStats->max = 100.00;
-    myStats->min = 90.00;
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    min = myStats->min;
-
-    if(!isnan(min)) {
-        psError(PS_ERR_UNKNOWN,true,"Min with range with no valid elemenets did not return NAN");
-        return 4;
-    }
-
-    psFree(myStats);
-    psFree(myVector);
-    psFree(maskVector);
-
-    return 0;
-}
-
-psS32 testStatsMinS8(void)
-{
-    psStats*  myStats    = NULL;
-    psVector* myVector   = NULL;
-    psF64     min        = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_MIN);
-    myVector = psVectorAlloc(N, PS_TYPE_S8);
-    myVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.S8[i] = samplesS8[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    min = myStats->min;
-
-    if (fabs(min - expectedMinNoMaskS8) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Min no mask return value %lf not as expected %lf",
-                min, expectedMinNoMaskS8);
-        return 1;
-    }
-
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
-psS32 testStatsMinU16(void)
-{
-    psStats*  myStats    = NULL;
-    psVector* myVector   = NULL;
-    psF64     min        = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_MAX);
-    myVector = psVectorAlloc(N, PS_TYPE_U16);
-    myVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.U16[i] = samplesU16[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    min = myStats->min;
-
-    if (fabs(min - expectedMinNoMaskU16) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Min no mask return value %lf not as expected %lf",
-                min, expectedMinNoMaskU16);
-        return 1;
-    }
-
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
-psS32 testStatsMinF64(void)
-{
-    psStats*  myStats    = NULL;
-    psVector* myVector   = NULL;
-    psF64     min        = 0.0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_MIN);
-    myVector = psVectorAlloc(N, PS_TYPE_F64);
-    myVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (psS32 i = 0; i < N; i++) {
-        myVector->data.F64[i] = samplesF64[i];
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    min = myStats->min;
-
-    if (fabs(min - expectedMinNoMaskF64) > ERROR_TOL) {
-        psError(PS_ERR_UNKNOWN,true,"Min no mask return value %lf not as expected %lf",
-                min, expectedMinNoMaskF64);
-        return 1;
-    }
-
-    psFree(myStats);
-    psFree(myVector);
-
-    return 0;
-}
-
Index: trunk/psLib/test/math/tst_psStats03.c
===================================================================
--- trunk/psLib/test/math/tst_psStats03.c	(revision 42336)
+++ 	(revision )
@@ -1,136 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that PS_STAT_SAMPLE_MEDIAN is correctly computed
-    by the procedure psVectorStats().
- 
-    XXX: Must add tests for various data types, other than psF32.  Copy code
-    from tst_psStats00.c-tst_psStats02.c.
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#define N1 1029   // This should be an odd number.
-#define N ((4 * N1) + 1)
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorSampleMean", 0);
-    psTraceSetLevel("p_psVectorCheckNonEmpty", 0);
-    psTraceSetLevel("p_psVectorNValues", 0);
-    psTraceSetLevel("p_psVectorSampleMedian", 0);
-    psTraceSetLevel("psStatsAlloc", 0);
-    psTraceSetLevel("p_psConvertToF32", 0);
-    psTraceSetLevel("psVectorStats", 0);
-
-    psStats *myStats    = NULL;
-    psS32 testStatus      = true;
-    psS32 globalTestStatus = true;
-    psS32 i               = 0;
-    psVector *myVector  = NULL;
-    psVector *maskVector= NULL;
-    float median        = 1e99;
-    float realMedianWithMask = (float) (N-3)/4;
-    float realMedianNoMask = (float) (N-1)/2;
-    psS32 currentId       = psMemGetId();
-    psS32 memLeaks        = 0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
-    myVector = psVectorAlloc(N, PS_TYPE_F32);
-    myVector->n = N;
-    maskVector = psVectorAlloc(N, PS_TYPE_U8);
-    maskVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (i=0;i<N;i++) {
-        myVector->data.F32[i] = (float) i;
-    }
-
-    // Set the mask vector and calculate the expected median.
-    for (i=0;i<N;i++) {
-        if (i < (N/2)) {
-            maskVector->data.U8[i] = 0;
-        } else {
-            maskVector->data.U8[i] = 1;
-        }
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_MEDIAN: no vector mask");
-
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    median = myStats->sampleMedian;
-
-    printf("Called psVectorStats() on a vector with no elements masked.\n");
-    printf("The expected median was %f.  The calculated median was %f.\n",
-           realMedianNoMask, median);
-    if (median == realMedianNoMask) {
-        testStatus = true;
-    } else {
-        testStatus = false;
-        globalTestStatus = false;
-    }
-
-    printFooter(stdout,
-                "psStats functions",
-                "PS_STAT_SAMPLE_MEDIAN: no vector mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with vector mask.                       */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_MEDIAN: with vector mask");
-
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    median = myStats->sampleMedian;
-    printf("Called psVectorStats() on a vector with last N/2 elements masked.\n");
-    printf("The expected median was %f.  The calculated median was %f.\n",
-           realMedianWithMask, median);
-    if (median == realMedianWithMask) {
-        testStatus = true;
-    } else {
-        testStatus = false;
-        globalTestStatus = false;
-    }
-
-    printFooter(stdout,
-                "psStats functions",
-                "PS_STAT_SAMPLE_MEDIAN: with vector mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "psStats(): deallocating memory");
-
-    psFree(myStats);
-    psFree(myVector);
-    psFree(maskVector);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psStats functions",
-                "psStats(): deallocating memory",
-                testStatus);
-
-    return (!globalTestStatus);
-}
Index: trunk/psLib/test/math/tst_psStats05.c
===================================================================
--- trunk/psLib/test/math/tst_psStats05.c	(revision 42336)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that the psStats structure is correctly
-    allocated and deallocated by the procedure psStatsAlloc().
- 
-    XXX: This should be test 00.
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#define MISC_FLOAT_NUMBER 345.0
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("psStatsAlloc", 0);
-
-    psStats *myStats    = NULL;
-    psS32 testStatus      = true;
-    psS32 currentId       = psMemGetId();
-    psS32 memLeaks        = 0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "Allocate the psStats structure.");
-
-    myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-    myStats->sampleMean = MISC_FLOAT_NUMBER;
-    myStats->sampleMedian = MISC_FLOAT_NUMBER;
-    myStats->sampleStdev = MISC_FLOAT_NUMBER;
-    myStats->sampleUQ = MISC_FLOAT_NUMBER;
-    myStats->sampleLQ = MISC_FLOAT_NUMBER;
-    myStats->robustMedian = MISC_FLOAT_NUMBER;
-    myStats->robustStdev = MISC_FLOAT_NUMBER;
-    myStats->robustUQ = MISC_FLOAT_NUMBER;
-    myStats->robustLQ = MISC_FLOAT_NUMBER;
-    myStats->robustN50 = MISC_FLOAT_NUMBER;
-    myStats->fittedMean = MISC_FLOAT_NUMBER;
-    myStats->fittedStdev = MISC_FLOAT_NUMBER;
-    myStats->fittedNfit = MISC_FLOAT_NUMBER;
-    myStats->clippedMean = MISC_FLOAT_NUMBER;
-    myStats->clippedStdev = MISC_FLOAT_NUMBER;
-    myStats->clippedNvalues = MISC_FLOAT_NUMBER;
-    myStats->clipSigma = MISC_FLOAT_NUMBER;
-    myStats->clipIter = MISC_FLOAT_NUMBER;
-    myStats->min = MISC_FLOAT_NUMBER;
-    myStats->max = MISC_FLOAT_NUMBER;
-    myStats->binsize = MISC_FLOAT_NUMBER;
-    myStats->nSubsample = MISC_FLOAT_NUMBER;
-    myStats->options = 0x0;
-
-    psMemCheckCorruption(1);
-
-    printFooter(stdout,
-                "psStats functions",
-                "Allocate the psStats structure.",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "Deallocate the psStats structure.");
-    psFree(myStats);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-    psMemCheckCorruption(1);
-
-    printFooter(stdout,
-                "psStats functions",
-                "Deallocate the psStats structure.",
-                testStatus);
-
-    return (!testStatus);
-}
Index: trunk/psLib/test/math/tst_psStats06.c
===================================================================
--- trunk/psLib/test/math/tst_psStats06.c	(revision 42336)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that PS_STAT_SAMPLE_STDEV is correctly computed
-    by the procedure psArrayStats().
- 
-    XXX: Must add tests for various data types, other than psF32.  Copy code
-    from tst_psStats00.c-tst_psStats02.c.
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "psTest.h"
-#include "float.h"
-#include <math.h>
-
-#define N 15
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorSampleMean", 0);
-    psTraceSetLevel("p_psVectorMax", 0);
-    psTraceSetLevel("p_psVectorMin", 0);
-    psTraceSetLevel("p_psVectorCheckNonEmpty", 0);
-    psTraceSetLevel("p_psVectorNValues", 0);
-    psTraceSetLevel("p_psVectorSampleStdevOLD", 0);
-    psTraceSetLevel("p_psVectorSampleStdev", 0);
-    psTraceSetLevel("psStatsAlloc", 0);
-    psTraceSetLevel("p_psConvertToF32", 0);
-    psTraceSetLevel("psVectorStats", 0);
-
-    psStats *myStats    = NULL;
-    psS32 testStatus      = true;
-    psS32 globalTestStatus = true;
-    psS32 i               = 0;
-    psVector *myVector  = NULL;
-    psVector *maskVector= NULL;
-    float stdev         = 0.0;
-    // NOTE: These values were calculated by running the function on the data.
-    // A: They must be changed if we adjust the number of data points.
-    // B: We don't really know that they are correct.
-    float realStdevNoMask   = 4.472136;
-    float realStdevWithMask = 2.160247;
-    psS32 count           = 0;
-    psS32 currentId       = psMemGetId();
-    psS32 memLeaks        = 0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_SAMPLE_STDEV);
-    myVector = psVectorAlloc(N, PS_TYPE_F32);
-    myVector->n = N;
-    maskVector = psVectorAlloc(N, PS_TYPE_U8);
-    maskVector->n = N;
-
-    stdev = 0.0;
-    // Set the appropriate values for the vector data.
-    for (i=0;i<N;i++) {
-        myVector->data.F32[i] = (float) i;
-    }
-
-    // Set the mask vector and calculate the expected maximum.
-    for (i=0;i<N;i++) {
-        if (i < (N/2)) {
-            maskVector->data.U8[i] = 0;
-            count++;
-        } else {
-            maskVector->data.U8[i] = 1;
-        }
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_STDEV: no vector mask");
-
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-    stdev = myStats->sampleStdev;
-
-    printf("Called psVectorStats() on a vector with no elements masked.\n");
-    printf("The expected stdev was %f; the calculated stdev was %f\n",
-           realStdevNoMask, stdev);
-    if (fabs(stdev - realStdevNoMask) <= 2.0 * FLT_EPSILON) {
-        testStatus = true;
-    } else {
-        testStatus = false;
-        globalTestStatus = false;
-    }
-    printFooter(stdout,
-                "psVector functions",
-                "PS_STAT_SAMPLE_STDEV: no vector mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with vector mask.                       */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_STDEV: with vector mask");
-
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-    stdev = myStats->sampleStdev;
-    printf("Called psVectorStats() on a vector with last N/2 elements masked.\n");
-    printf("The expected stdev was %f; the calculated stdev was %f\n",
-           realStdevWithMask, stdev);
-    if (fabs(stdev - realStdevWithMask) <= 2.0 * FLT_EPSILON) {
-        testStatus = true;
-    } else {
-        testStatus = false;
-        globalTestStatus = false;
-    }
-
-    printFooter(stdout,
-                "psVector functions",
-                "PS_STAT_SAMPLE_STDEV: with vector mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "psStats(): deallocating memory");
-
-    psFree(myStats);
-    psFree(myVector);
-    psFree(maskVector);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psVector functions",
-                "psStats(): deallocating memory",
-                testStatus);
-
-    return (!globalTestStatus);
-}
Index: trunk/psLib/test/math/tst_psStats07.c
===================================================================
--- trunk/psLib/test/math/tst_psStats07.c	(revision 42336)
+++ 	(revision )
@@ -1,491 +1,0 @@
-/*****************************************************************************
-   This routine must ensure that PS_STAT_ROBUST_QUARTILE is correctly computed
-   by the procedure psArrayStats().
- 
-   XXX: Must add tests for various data types, other than psF32.  Copy code
-   from tst_psStats00.c-tst_psStats02.c.
-*****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "psTest.h"
-#include "float.h"
-#include <math.h>
-
-#define NUM_DATA 1000
-#define MEAN 32.0
-#define STDEV 2.0
-#define PERCENT_OUTLIERS 1
-#define OUTLIER_MAGNITUDE (NUM_DATA * 10)
-#define ERROR_TOLERANCE .10
-#define ERRORS 1000.0
-#define SEED 1995
-#define VERBOSE 0
-
-#define TST_IN_NULL             0x00000001
-#define TST_IN_F32              0x00000002
-#define TST_IN_F64              0x00000004
-#define TST_IN_S8               0x00000008
-#define TST_IN_U16              0x00000010
-#define TST_IN_S32              0x00000020
-#define TST_ERRORS_NULL         0x00000040
-#define TST_ERRORS_F32          0x00000080
-#define TST_ERRORS_F64          0x00000100
-#define TST_ERRORS_S8           0x00000200
-#define TST_ERRORS_U16          0x00000400
-#define TST_ERRORS_S32          0x00000800
-#define TST_MASK_NULL           0x00001000
-#define TST_MASK_U8             0x00002000
-#define TST_MASK_S32            0x00004000
-
-psBool genericRobustStatsTest(
-    unsigned int flags,
-    psS32 numData,
-    psU32 maskValue,
-    psBool expectedRC)
-{
-    psS32 currentId = psMemGetId();
-    psBool testStatus = true;
-    psS32 memLeaks = 0;
-    psVector *in = NULL;
-    psVector *errors = NULL;
-    psVector *mask = NULL;
-    srand(SEED);
-    printPositiveTestHeader(stdout, "psMathUtils functions", "psVectorStats Robust Stats Routine");
-
-    if (expectedRC == true) {
-        printf("This test should not generate any errors.\n");
-    }
-    if (expectedRC == false) {
-        printf("This test should generate an error message, and return NULL.\n");
-    }
-    psVector *gaussVector = p_psGaussianDev(MEAN, STDEV, numData);
-
-
-    if (flags & TST_IN_NULL) {
-        printf("        using a NULL in vector\n");
-    }
-
-    if (flags & TST_IN_F32) {
-        printf("        using a psF32 in vector\n");
-        in = psVectorAlloc(numData, PS_TYPE_F32);
-        for (psS32 i=0;i<numData;i++) {
-            in->data.F32[i] = gaussVector->data.F32[i];
-            in->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%.1f)\n", i, in->data.F32[i]);
-            }
-        }
-    }
-
-    if (flags & TST_IN_F64) {
-        printf("        using a psF64 in vector\n");
-        in = psVectorAlloc(numData, PS_TYPE_F64);
-        for (psS32 i=0;i<numData;i++) {
-            in->data.F64[i] = (psF64) gaussVector->data.F32[i];
-            in->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%.1f)\n", i, in->data.F64[i]);
-            }
-        }
-    }
-
-    if (flags & TST_IN_S8) {
-        printf("        using a psS8 in vector\n");
-        in = psVectorAlloc(numData, PS_TYPE_S8);
-        for (psS32 i=0;i<numData;i++) {
-            in->data.S8[i] = (psS8) gaussVector->data.F32[i];
-            in->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%d)\n", i, in->data.S8[i]);
-            }
-        }
-    }
-
-    if (flags & TST_IN_U16) {
-        printf("        using a psU16 in vector\n");
-        in = psVectorAlloc(numData, PS_TYPE_U16);
-        for (psS32 i=0;i<numData;i++) {
-            in->data.U16[i] = (psU16) gaussVector->data.F32[i];
-            in->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%d)\n", i, in->data.U16[i]);
-            }
-        }
-    }
-
-    if (flags & TST_IN_S32) {
-        printf("        using a psS32 in vector\n");
-        in = psVectorAlloc(numData, PS_TYPE_S32);
-        for (psS32 i=0;i<numData;i++) {
-            in->data.S32[i] = (psS32) gaussVector->data.F32[i];
-            in->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%d)\n", i, in->data.S32[i]);
-            }
-        }
-    }
-    psFree(gaussVector);
-
-    //    in->n = in->nalloc;
-    if (flags & TST_ERRORS_NULL) {
-        printf("        using a NULL errors vector\n");
-    }
-
-    if (flags & TST_ERRORS_F32) {
-        printf("        using a psF32 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_F32);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.F32[i] = ERRORS;
-            errors->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original errors data %d: (%.1f)\n", i, errors->data.F32[i]);
-            }
-        }
-    }
-
-    if (flags & TST_ERRORS_F64) {
-        printf("        using a psF64 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_F64);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.F64[i] = ERRORS;
-            errors->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original errors data %d: (%.1f)\n", i, errors->data.F64[i]);
-            }
-        }
-    }
-
-    if (flags & TST_ERRORS_S8) {
-        printf("        using a psS8 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_S8);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.S8[i] = (psS8) ERRORS;
-            errors->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original errors data %d: (%d)\n", i, errors->data.S8[i]);
-            }
-        }
-    }
-
-    if (flags & TST_ERRORS_U16) {
-        printf("        using a psU16 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_U16);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.U16[i] = (psU16) ERRORS;
-            errors->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original errors data %d: (%d)\n", i, errors->data.U16[i]);
-            }
-        }
-    }
-
-    if (flags & TST_ERRORS_S32) {
-        printf("        using a psS32 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_S32);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.S32[i] = (psS32) ERRORS;
-            errors->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original errors data %d: (%d)\n", i, errors->data.S32[i]);
-            }
-        }
-    }
-
-
-    if (flags & TST_MASK_NULL) {
-        printf("        using a NULL mask vector\n");
-    }
-
-    if (flags & TST_MASK_U8) {
-        printf("        using a psU8 mask vector\n");
-        mask = psVectorAlloc(numData, PS_TYPE_U8);
-        for (psS32 i=0;i<numData;i++) {
-            mask->data.U8[i] = (psU8) 0;
-            mask->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original mask data %d: (%d)\n", i, mask->data.U8[i]);
-            }
-        }
-    }
-
-    if (flags & TST_MASK_S32) {
-        printf("        using a psS32 mask vector\n");
-        mask = psVectorAlloc(numData, PS_TYPE_S32);
-        for (psS32 i=0;i<numData;i++) {
-            mask->data.S32[i] = (psS32) 0;
-            mask->n++;
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original mask data %d: (%d)\n", i, mask->data.S32[i]);
-            }
-        }
-    }
-
-
-    //
-    // We calculate the sample mean and stdev without and outliers in the data.
-    // We will use this later in determining if the clipped stats are correct.
-    //
-    psF32 sampleMean;
-    psF32 sampleStdev;
-    psF32 sampleMedian;
-    psF32 sampleLQ;
-    psF32 sampleUQ;
-    if (expectedRC == true) {
-        psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV | PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_QUARTILE);
-        psStats *rc = psVectorStats(myStats, in, NULL, NULL, maskValue);
-        if (rc == NULL) {
-            printf("TEST ERROR: the psVectorStats() function returned NULL.\n");
-            testStatus = false;
-        } else {
-            sampleMean = myStats->sampleMean;
-            sampleStdev = myStats->sampleStdev;
-            sampleMedian = myStats->sampleMedian;
-            sampleLQ = myStats->sampleLQ;
-            sampleUQ = myStats->sampleUQ;
-        }
-        psFree(myStats);
-    }
-
-    //
-    // We add a few outliers to the input data.
-    //
-    if (flags & TST_IN_F32) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.F32[i] = (psF32) OUTLIER_MAGNITUDE;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%.1f)\n", i, in->data.F32[i]);
-            }
-        }
-    }
-    if (flags & TST_IN_F64) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.F64[i] = (psF64) OUTLIER_MAGNITUDE;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%.1f)\n", i, in->data.F64[i]);
-            }
-        }
-    }
-    if (flags & TST_IN_S8) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.S8[i] = (psS8) OUTLIER_MAGNITUDE;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%d)\n", i, in->data.S8[i]);
-            }
-        }
-    }
-    if (flags & TST_IN_U16) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.U16[i] = (psU16) OUTLIER_MAGNITUDE;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%d)\n", i, in->data.U16[i]);
-            }
-        }
-    }
-    if (flags & TST_IN_S32) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.S32[i] = (psS32) OUTLIER_MAGNITUDE;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Original in data %d: (%d)\n", i, in->data.S32[i]);
-            }
-        }
-    }
-
-    //
-    // We call psVectorStats() and calculate the clipped stats.
-    //
-    psStats *myStats = psStatsAlloc(
-                           PS_STAT_ROBUST_MEDIAN |
-                           PS_STAT_ROBUST_STDEV |
-                           PS_STAT_ROBUST_QUARTILE |
-                           PS_STAT_FITTED_MEAN |
-                           PS_STAT_FITTED_STDEV);
-    psStats *rc = psVectorStats(myStats, in, errors, mask, maskValue);
-
-    if (rc == NULL) {
-        if (expectedRC == true) {
-            printf("TEST ERROR: the psVectorStats() function returned NULL.\n");
-            testStatus = false;
-        }
-    } else {
-        if (expectedRC == false) {
-            printf("TEST ERROR: the psVectorStats() function returned non-NULL.\n");
-            testStatus = false;
-        }
-
-        //
-        // Fitted Mean
-        //
-        if (fabs(myStats->fittedMean - sampleMean) > (ERROR_TOLERANCE * sampleMean)) {
-            printf("TEST ERROR: the fitted mean was %.2f, should have been %.2f\n", myStats->fittedMean, sampleMean);
-            testStatus = false;
-        } else if (VERBOSE) {
-            printf("GOOD: the fitted mean was %.2f, should have been %.2f\n", myStats->fittedMean, sampleMean);
-        }
-
-        //
-        // Fitted Stdev
-        //
-        if (fabs(myStats->fittedStdev - sampleStdev) > (ERROR_TOLERANCE * sampleStdev)) {
-            printf("TEST ERROR: the fitted stdev was %.2f, should have been %.2f\n", myStats->fittedStdev, sampleStdev);
-            testStatus = false;
-        } else if (VERBOSE) {
-            printf("GOOD: the fitted stdev was %.2f, should have been %.2f\n", myStats->fittedStdev, sampleStdev);
-        }
-
-        //
-        // Robust Stdev
-        //
-        if (fabs(myStats->robustStdev - sampleStdev) > (ERROR_TOLERANCE * sampleStdev)) {
-            printf("TEST ERROR: the robust stdev was %.2f, should have been %.2f\n", myStats->robustStdev, sampleStdev);
-            testStatus = false;
-        } else if (VERBOSE) {
-            printf("GOOD: the robust stdev was %.2f, should have been %.2f\n", myStats->robustStdev, sampleStdev);
-        }
-
-        //
-        // Robust Median
-        //
-        if (fabs(myStats->robustMedian - sampleMedian) > (ERROR_TOLERANCE * sampleMedian)) {
-            printf("TEST ERROR: the robust median was %.2f, should have been %.2f\n", myStats->robustMedian, sampleMedian);
-            testStatus = false;
-        } else if (VERBOSE) {
-            printf("GOOD: the robust median was %.2f, should have been %.2f\n", myStats->robustMedian, sampleMedian);
-        }
-
-        //
-        // Robust LQ
-        //
-        if (fabs(myStats->robustLQ - sampleLQ) > (ERROR_TOLERANCE * sampleLQ)) {
-            printf("TEST ERROR: the robust LQ was %.2f, should have been %.2f\n", myStats->robustLQ, sampleLQ);
-            testStatus = false;
-        } else if (VERBOSE) {
-            printf("GOOD: the robust LQ was %.2f, should have been %.2f\n", myStats->robustLQ, sampleLQ);
-        }
-
-        //
-        // Robust UQ
-        //
-        if (fabs(myStats->robustUQ - sampleUQ) > (ERROR_TOLERANCE * sampleUQ)) {
-            printf("TEST ERROR: the robust UQ was %.2f, should have been %.2f\n", myStats->robustUQ, sampleUQ);
-            testStatus = false;
-        } else if (VERBOSE) {
-            printf("GOOD: the robust UQ was %.2f, should have been %.2f\n", myStats->robustUQ, sampleUQ);
-        }
-    }
-
-    psFree(myStats);
-    psFree(in);
-    psFree(errors);
-    psFree(mask);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    return(testStatus);
-}
-
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    psLogSetLevel(PS_LOG_INFO);
-    psBool testStatus = true;
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    #define TRACE_LEVEL 0
-
-    psTraceSetLevel(".", TRACE_LEVEL);
-    psTraceSetLevel("psGaussian", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorMax", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorMin", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorCheckNonEmpty", TRACE_LEVEL);
-    psTraceSetLevel("p_psNormalizeVectorRange", TRACE_LEVEL);
-    psTraceSetLevel("p_ps1DPolyMedian", TRACE_LEVEL);
-    psTraceSetLevel("fitQuadraticSearchForYThenReturnX", TRACE_LEVEL);
-    psTraceSetLevel("PsVectorDup", TRACE_LEVEL);
-    psTraceSetLevel("psMinimizeLMChi2Gauss1D", TRACE_LEVEL);
-    psTraceSetLevel("LinInterpolate", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorRobustStats", TRACE_LEVEL);
-    psTraceSetLevel("psStatsAlloc", TRACE_LEVEL);
-    psTraceSetLevel("psHistogramAlloc", TRACE_LEVEL);
-    psTraceSetLevel("psHistogramAllocGeneric", TRACE_LEVEL);
-    psTraceSetLevel("UpdateHistogramBins", TRACE_LEVEL);
-    psTraceSetLevel("psVectorHistogram", TRACE_LEVEL);
-    psTraceSetLevel("p_psConvertToF32", TRACE_LEVEL);
-    psTraceSetLevel("psVectorStats", TRACE_LEVEL);
-
-    testStatus &= genericRobustStatsTest(TST_IN_F32 | TST_ERRORS_NULL | TST_MASK_NULL, NUM_DATA, 1, true);
-    testStatus &= genericRobustStatsTest(TST_IN_F32 | TST_ERRORS_NULL | TST_MASK_U8, NUM_DATA, 1, true);
-
-    if (testStatus) {
-        printf("TEST PASSED.\n");
-    } else {
-        printf("TEST FAILED.\n");
-    }
-}
-
Index: trunk/psLib/test/math/tst_psStats08.c
===================================================================
--- trunk/psLib/test/math/tst_psStats08.c	(revision 42336)
+++ 	(revision )
@@ -1,190 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that PS_STAT_SAMPLE_QUARTILE is correctly computed
-    by the procedure psArrayStats().
- 
-    XXX: Must add tests for various data types, other than psF32.  Copy code
-    from tst_psStats00.c-tst_psStats02.c.
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "psTest.h"
-#include "float.h"
-#include <math.h>
-
-#define N1 25  //
-#define N (8 * N1) // Don't change this (N must be a multiple of 8)
-
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", 0);
-    psTraceSetLevel("p_psVectorMax", 0);
-    psTraceSetLevel("p_psVectorMin", 0);
-    psTraceSetLevel("p_psVectorCheckNonEmpty", 0);
-    psTraceSetLevel("p_psVectorNValues", 0);
-    psTraceSetLevel("p_psVectorSampleQuartiles", 0);
-    psTraceSetLevel("psStatsAlloc", 0);
-    psTraceSetLevel("p_psConvertToF32", 0);
-    psTraceSetLevel("psVectorStats", 0);
-
-
-    psStats *myStats    = NULL;
-    psS32 testStatus      = true;
-    psS32 globalTestStatus = true;
-    psS32 i               = 0;
-    psVector *myVector  = NULL;
-    psVector *maskVector= NULL;
-    // NOTE: These values were calculated by running the function on the data.
-    // A: They must be changed if we adjust the number of data points.
-    // B: We don't really know that they are correct.
-    float realLQNoMask   = N/4.0;
-    float realUQNoMask   = 3.0 * (N/4.0);
-    float realLQWithMask   = N/8.0;
-    float realUQWithMask   = 3.0 * (N/8.0);
-    psS32 count           = 0;
-    psS32 currentId       = psMemGetId();
-    psS32 memLeaks        = 0;
-
-    /*************************************************************************/
-    /*  Allocate and initialize data structures                      */
-    /*************************************************************************/
-    myStats = psStatsAlloc(PS_STAT_SAMPLE_QUARTILE);
-    myVector = psVectorAlloc(N, PS_TYPE_F32);
-    myVector->n = N;
-    maskVector = psVectorAlloc(N, PS_TYPE_U8);
-    maskVector->n = N;
-
-    // Set the appropriate values for the vector data.
-    for (i=0;i<N;i++) {
-        myVector->data.F32[i] = (float) i;
-    }
-
-    // Set the mask vector and calculate the expected maximum.
-    for (i=0;i<N;i++) {
-        if (i < (N/2)) {
-            maskVector->data.U8[i] = 0;
-            count++;
-        } else {
-            maskVector->data.U8[i] = 1;
-        }
-    }
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with no vector mask.                    */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_LQ: no vector mask");
-
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-
-    printf("Called psVectorStats() on a vector with no elements masked.\n");
-    printf("The expected sampleLQ was %f; the calculated sampleLQ was %f\n",
-           realLQNoMask, myStats->sampleLQ);
-    if (fabs(realLQNoMask - myStats->sampleLQ) <= 2.0 * FLT_EPSILON) {
-        testStatus = true;
-    } else {
-        testStatus = false;
-        globalTestStatus = false;
-    }
-    printFooter(stdout,
-                "psVector functions",
-                "PS_STAT_SAMPLE_LQ: no vector mask",
-                testStatus);
-
-
-
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_UQ: no vector mask");
-
-    myStats = psVectorStats(myStats, myVector, NULL, NULL, 0);
-
-    printf("Called psVectorStats() on a vector with no elements masked.\n");
-    printf("The expected sampleUQ was %f; the calculated sampleUQ was %f\n",
-           realUQNoMask, myStats->sampleUQ);
-    if (fabs(realUQNoMask - myStats->sampleUQ) <= 2.0 * FLT_EPSILON) {
-        testStatus = true;
-    } else {
-        testStatus = false;
-        globalTestStatus = false;
-    }
-    printFooter(stdout,
-                "psVector functions",
-                "PS_STAT_SAMPLE_UQ: no vector mask",
-                testStatus);
-
-    /*************************************************************************/
-    /*  Call psVectorStats() with vector mask.                       */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_LQ: with vector mask");
-
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-
-    printf("Called psVectorStats() on a vector with elements masked.\n");
-    printf("The expected sampleLQ was %f; the calculated sampleLQ was %f\n",
-           realLQWithMask, myStats->sampleLQ);
-    if (fabs(realLQWithMask - myStats->sampleLQ) <= 2.0 * FLT_EPSILON) {
-        testStatus = true;
-    } else {
-        testStatus = false;
-        globalTestStatus = false;
-    }
-    printFooter(stdout,
-                "psVector functions",
-                "PS_STAT_SAMPLE_LQ: with vector mask",
-                testStatus);
-
-
-
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "PS_STAT_SAMPLE_UQ: with vector mask");
-
-    myStats = psVectorStats(myStats, myVector, NULL, maskVector, 1);
-
-    printf("Called psVectorStats() on a vector with elements masked.\n");
-    printf("The expected sampleUQ was %f; the calculated sampleUQ was %f\n",
-           realUQWithMask, myStats->sampleUQ);
-    if (fabs(realUQWithMask - myStats->sampleUQ) <= 2.0 * FLT_EPSILON) {
-        testStatus = true;
-    } else {
-        testStatus = false;
-        globalTestStatus = false;
-    }
-    printFooter(stdout,
-                "psVector functions",
-                "PS_STAT_SAMPLE_UQ: with vector mask",
-                testStatus);
-
-
-    /*************************************************************************/
-    /*  Deallocate data structures                                   */
-    /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psStats functions",
-                            "psStats(): deallocating memory");
-
-    psFree(myStats);
-    psFree(myVector);
-    psFree(maskVector);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psVector functions",
-                "psStats(): deallocating memory",
-                testStatus);
-
-    return (!globalTestStatus);
-}
Index: trunk/psLib/test/math/tst_psStats09.c
===================================================================
--- trunk/psLib/test/math/tst_psStats09.c	(revision 42336)
+++ 	(revision )
@@ -1,359 +1,0 @@
-/*****************************************************************************
-    This routine must ensure that PS_STAT_CLIPPED_MEAN and
-    PS_STAT_CLIPPED_STDEV is calculate correctly by the procedure
-    psVectorStats().
- 
-    XXX: The capability is here to test a wide variety of input parameters.
-    We must do this, later.
- *****************************************************************************/
-#include <stdio.h>
-#include "pslib_strict.h"
-#include "psTest.h"
-#include "float.h"
-#include <math.h>
-
-#define NUM_DATA 1000
-#define VERBOSE 1
-#define PERCENT_OUTLIERS 2
-#define ERROR_TOLERANCE .10
-#define ERRORS 1.0
-#define SEED 1995
-
-#define TST_IN_NULL  0x00000001
-#define TST_IN_F32  0x00000002
-#define TST_IN_F64  0x00000004
-#define TST_IN_S8  0x00000008
-#define TST_IN_U16  0x00000010
-#define TST_IN_S32  0x00000020
-#define TST_ERRORS_NULL  0x00000040
-#define TST_ERRORS_F32  0x00000080
-#define TST_ERRORS_F64  0x00000100
-#define TST_ERRORS_S8  0x00000200
-#define TST_ERRORS_U16  0x00000400
-#define TST_ERRORS_S32  0x00000800
-#define TST_MASK_NULL  0x00001000
-#define TST_MASK_U8  0x00002000
-#define TST_MASK_S32  0x00004000
-
-
-psBool genericClippedStatsTest(
-    unsigned int flags,
-    psS32 numData,
-    psU32 maskValue,
-    psBool expectedRC)
-{
-    psS32 currentId = psMemGetId();
-    psBool testStatus = true;
-    psS32 memLeaks = 0;
-    psVector *in = NULL;
-    psVector *errors = NULL;
-    psVector *mask = NULL;
-    srand(SEED);
-    printPositiveTestHeader(stdout, "psMathUtils functions", "psVectorStats Clipped Stats Routine");
-
-    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
-    psVector *truth = psVectorAlloc(numData, PS_TYPE_F64);
-    truth->n = numData;
-    for (long i = 0; i < numData; i++) {
-        truth->data.F64[i] = psRandomGaussian(rng);
-    }
-    psFree(rng);
-
-    if (expectedRC == true) {
-        printf("This test should not generate any errors.\n");
-    }
-    if (expectedRC == false) {
-        printf("This test should generate an error message, and return NULL.\n");
-    }
-
-    if (flags & TST_IN_NULL) {
-        printf("        using a NULL in vector\n");
-    }
-
-    if (flags & TST_IN_F32) {
-        printf("        using a psF32 in vector\n");
-        in = psVectorCopy(in, truth, PS_TYPE_F32);
-    }
-
-    if (flags & TST_IN_F64) {
-        printf("        using a psF64 in vector\n");
-        in = psVectorCopy(in, truth, PS_TYPE_F64);
-    }
-
-    if (flags & TST_IN_S8) {
-        printf("        using a psS8 in vector\n");
-        in = psVectorCopy(in, truth, PS_TYPE_S8);
-    }
-
-    if (flags & TST_IN_U16) {
-        printf("        using a psU16 in vector\n");
-        in = psVectorCopy(in, truth, PS_TYPE_U16);
-    }
-
-    if (flags & TST_IN_S32) {
-        printf("        using a psS32 in vector\n");
-        in = psVectorCopy(in, truth, PS_TYPE_S32);
-    }
-
-    if (flags & TST_ERRORS_NULL) {
-        printf("        using a NULL errors vector\n");
-    }
-
-    if (flags & TST_ERRORS_F32) {
-        printf("        using a psF32 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_F32);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.F32[i] = ERRORS;
-            errors->n++;
-        }
-    }
-
-    if (flags & TST_ERRORS_F64) {
-        printf("        using a psF64 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_F64);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.F64[i] = ERRORS;
-            errors->n++;
-        }
-    }
-
-    if (flags & TST_ERRORS_S8) {
-        printf("        using a psS8 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_S8);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.S8[i] = (psS8) ERRORS;
-            errors->n++;
-        }
-    }
-
-    if (flags & TST_ERRORS_U16) {
-        printf("        using a psU16 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_U16);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.U16[i] = (psU16) ERRORS;
-            errors->n++;
-        }
-    }
-
-    if (flags & TST_ERRORS_S32) {
-        printf("        using a psS32 errors vector\n");
-        errors = psVectorAlloc(numData, PS_TYPE_S32);
-        for (psS32 i=0;i<numData;i++) {
-            errors->data.S32[i] = (psS32) ERRORS;
-            errors->n++;
-        }
-    }
-
-
-    if (flags & TST_MASK_NULL) {
-        printf("        using a NULL mask vector\n");
-    }
-
-    if (flags & TST_MASK_U8) {
-        printf("        using a psU8 mask vector\n");
-        mask = psVectorAlloc(numData, PS_TYPE_U8);
-        for (psS32 i=0;i<numData;i++) {
-            mask->data.U8[i] = (psU8) 0;
-            mask->n++;
-        }
-    }
-
-    if (flags & TST_MASK_S32) {
-        printf("        using a psS32 mask vector\n");
-        mask = psVectorAlloc(numData, PS_TYPE_S32);
-        for (psS32 i=0;i<numData;i++) {
-            mask->data.S32[i] = (psS32) 0;
-            mask->n++;
-        }
-    }
-
-
-    //
-    // We add a few outliers to the input data.
-    //
-    psVector *outliers = psVectorAlloc(numData, PS_TYPE_U8);
-    outliers->n = numData;
-    psVectorInit(outliers, 0);
-    long numOutliers = 0;
-    if (flags & TST_IN_F32) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.F32[i] = 100.0;
-                outliers->data.U8[i] = 1;
-                numOutliers++;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Data %d: (%f)\n", i, in->data.F32[i]);
-            }
-        }
-    }
-    if (flags & TST_IN_F64) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.F64[i] = 100.0;
-                outliers->data.U8[i] = 1;
-                numOutliers++;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Data %d: (%f)\n", i, in->data.F64[i]);
-            }
-        }
-    }
-    if (flags & TST_IN_S8) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.S8[i] = 100;
-                outliers->data.U8[i] = 1;
-                numOutliers++;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Data %d: (%d)\n", i, in->data.S8[i]);
-            }
-        }
-    }
-    if (flags & TST_IN_U16) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.U16[i] = 100;
-                outliers->data.U8[i] = 1;
-                numOutliers++;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Data %d: (%d)\n", i, in->data.U16[i]);
-            }
-        }
-    }
-    if (flags & TST_IN_S32) {
-        for (psS32 i=0;i<numData;i++) {
-            if (PERCENT_OUTLIERS > (random() % 100)) {
-                in->data.S32[i] = 100;
-                outliers->data.U8[i] = 1;
-                numOutliers++;
-            }
-        }
-
-        if (VERBOSE) {
-            for (psS32 i=0;i<numData;i++) {
-                printf("Data %d: (%d)\n", i, in->data.S32[i]);
-            }
-        }
-    }
-
-    printf("%ld outliers.\n", numOutliers);
-
-    //
-    // We calculate the sample mean and stdev without and outliers in the data.
-    // We will use this later in determining if the clipped stats are correct.
-    //
-    psF32 sampleMean;
-    psF32 sampleStdev;
-    if (expectedRC == true) {
-        psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
-        psStats *rc = psVectorStats(myStats, in, errors, outliers, 1);
-        if (rc == NULL) {
-            printf("TEST ERROR: the psVectorStats() function returned NULL.\n");
-            testStatus = false;
-        } else {
-            sampleMean = myStats->sampleMean;
-            sampleStdev = myStats->sampleStdev;
-        }
-        psFree(myStats);
-    }
-    psFree(outliers);
-
-    //
-    // We call psVectorStats() and calculate the clipped stats.
-    //
-    psStats *myStats = psStatsAlloc(PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
-    myStats->clipSigma = 5.0;
-    myStats->clipIter = 2;
-    psStats *rc = psVectorStats(myStats, in, errors, mask, maskValue);
-    if (rc == NULL) {
-        if (expectedRC == true) {
-            printf("TEST ERROR: the psVectorStats() function returned NULL.\n");
-            testStatus = false;
-        }
-    } else {
-        if (expectedRC == false) {
-            printf("TEST ERROR: the psVectorStats() function returned non-NULL.\n");
-            testStatus = false;
-        }
-
-        printf("Used %ld data points after clipping %ld.\n", myStats->clippedNvalues,
-               in->n - myStats->clippedNvalues);
-
-        if (fabs(myStats->clippedMean - sampleMean) > (ERROR_TOLERANCE * sampleMean)) {
-            printf("TEST ERROR: the clipped mean was %f, should have been %f\n", myStats->clippedMean, sampleMean);
-            testStatus = false;
-        } else if (VERBOSE) {
-            printf("GOOD: the clipped mean was %f, should have been %f\n", myStats->clippedMean, sampleMean);
-        }
-
-        if (fabs(myStats->clippedStdev - sampleStdev) > (ERROR_TOLERANCE * sampleStdev)) {
-            printf("TEST ERROR: the clipped stdev was %f, should have been %f\n", myStats->clippedStdev, sampleStdev);
-            testStatus = false;
-        } else if (VERBOSE) {
-            printf("GOOD: the clipped stdev was %f, should have been %f\n", myStats->clippedStdev, sampleStdev);
-        }
-
-    }
-
-    psFree(myStats);
-    psFree(truth);
-    psFree(in);
-    psFree(errors);
-    psFree(mask);
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
-    if (0 != memLeaks) {
-        psAbort("Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    return(testStatus);
-}
-
-#define TRACE_LEVEL 0
-psS32 main()
-{
-    psLogSetFormat("HLNM");
-    psBool testStatus = true;
-
-    //
-    // We list pertinent psStats.c functions here for debugging ease.
-    //
-    psTraceSetLevel(".", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorSampleMean", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorMax", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorMin", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorCheckNonEmpty", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorNValues", TRACE_LEVEL);
-    psTraceSetLevel("p_psVectorClippedStats", TRACE_LEVEL);
-    psTraceSetLevel("p_psNormalizeVectorRange", TRACE_LEVEL);
-    psTraceSetLevel("psStatsAlloc", TRACE_LEVEL);
-    psTraceSetLevel("p_psConvertToF32", TRACE_LEVEL);
-    psTraceSetLevel("psVectorStats", TRACE_LEVEL);
-
-    testStatus &= genericClippedStatsTest(TST_IN_NULL | TST_ERRORS_NULL | TST_MASK_NULL, NUM_DATA, 1, false);
-    testStatus &= genericClippedStatsTest(TST_IN_F32 | TST_ERRORS_NULL | TST_MASK_NULL, NUM_DATA, 1, true);
-    testStatus &= genericClippedStatsTest(TST_IN_F64 | TST_ERRORS_NULL | TST_MASK_NULL, NUM_DATA, 1, true);
-    testStatus &= genericClippedStatsTest(TST_IN_F32 | TST_ERRORS_F32 | TST_MASK_NULL, NUM_DATA, 1, true);
-    testStatus &= genericClippedStatsTest(TST_IN_F32 | TST_ERRORS_NULL | TST_MASK_U8, NUM_DATA, 1, true);
-
-    if (testStatus) {
-        printf("TEST PASSED\n");
-    } else {
-        printf("TEST FAILED\n");
-    }
-}
Index: trunk/psLib/test/sys/tap_psMemory.c
===================================================================
--- trunk/psLib/test/sys/tap_psMemory.c	(revision 42336)
+++ trunk/psLib/test/sys/tap_psMemory.c	(revision 42822)
@@ -428,5 +428,5 @@
 
         psPlaneTransform *planeTransform;
-        planeTransform = psPlaneTransformAlloc(1, 1);
+        planeTransform = psPlaneTransformAlloc(1, 1, PS_POLYNOMIAL_ORD);
         okay = psMemCheckType(PS_DATA_PLANETRANSFORM, planeTransform);
         if (!okay ) psFree(planeTransform);
Index: trunk/psLib/test/types/tap_psMetadataConfigFormat.c
===================================================================
--- trunk/psLib/test/types/tap_psMetadataConfigFormat.c	(revision 42336)
+++ trunk/psLib/test/types/tap_psMetadataConfigFormat.c	(revision 42822)
@@ -101,5 +101,5 @@
             "containing a NULL time.");
         char configTest[32];
-        strncpy(configTest, "time             TAI       NULL", 31);
+        ps_strncpy_nowarn(configTest, "time             TAI       NULL", 31);
         is_strn(configTest, out, 31,
                 "psMetadataConfigFormat:         return correct output string.");
Index: trunk/psLib/test/types/tap_psMetadataConfigWrite.c
===================================================================
--- trunk/psLib/test/types/tap_psMetadataConfigWrite.c	(revision 42336)
+++ trunk/psLib/test/types/tap_psMetadataConfigWrite.c	(revision 42822)
@@ -74,6 +74,5 @@
         FILE *mdcfg = fopen("mdcfg.wrt", "r");
         fgets(fileStr, 61, mdcfg);
-        strncpy(configTest,
-                "item1-1          BOOL      T                # I am a boolean", 60);
+        ps_strncpy_nowarn(configTest, "item1-1          BOOL      T                # I am a boolean", 60);
         is_strn(configTest, fileStr, 60,
                 "return correct output.");
