Index: /trunk/psLib/test/math/tap_psMatrixVectorArithmetic01.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrixVectorArithmetic01.c	(revision 11397)
+++ /trunk/psLib/test/math/tap_psMatrixVectorArithmetic01.c	(revision 11397)
@@ -0,0 +1,274 @@
+/** @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.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2007-01-30 00:11:31 $
+ *
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include "tap.h"
+#include "pstap.h"
+#define VERBOSE 1
+
+#define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE)                \
+psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE);   \
+{                                                                  \
+    ps##TYPE tmpScalar = VALUE;                                    \
+    for(psS32 i=0; i<SIZE; i++) {                                  \
+        NAME->data.TYPE[i] = tmpScalar;                            \
+        tmpScalar+= (ps##TYPE) 1;                                  \
+    }                                                              \
+}                                                                  \
+NAME->n = SIZE;
+
+
+#define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS)          \
+psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE);\
+{                                                                  \
+    ps##TYPE tmpScalar = VALUE;                                    \
+    for (psS32 i=0; i<NAME->numRows; i++) {                        \
+        for(psS32 j=0; j<NAME->numCols; j++) {                     \
+            NAME->data.TYPE[i][j] = tmpScalar;                     \
+            tmpScalar+= (ps##TYPE) 1;                              \
+        }                                                          \
+    }                                                              \
+}
+
+#define testBinaryOpMM(OP,TYPE,VALUE1,VALUE2,NROWS,NCOLS,ERRORFLAG,MEMORYFLAG) \
+{                                                                              \
+    psMemId id = psMemGetId();                                                 \
+    ERRORFLAG = false;                                                         \
+    MEMORYFLAG = false;                                                        \
+    CREATE_AND_SET_IMAGE(in1,TYPE,VALUE1,NROWS,NCOLS);                         \
+    CREATE_AND_SET_IMAGE(in2,TYPE,VALUE2,NROWS,NCOLS);                         \
+    psImage *out = (psImage*)psBinaryOp(NULL, in1, #OP, in2);                  \
+    for (psS32 i = 0 ; i < NROWS ; i++) {                                      \
+        for (psS32 j = 0 ; j < NCOLS ; j++) {                                  \
+            ps##TYPE expect = in1->data.TYPE[i][j] OP in2->data.TYPE[i][j];    \
+            if (fabs((psF32) (out->data.TYPE[i][j] - expect)) > 0.1) {         \
+                errorFlag = true;                                              \
+                if (VERBOSE) {                                                 \
+                    printf("TEST ERROR: outImage[%d][%d] is %f, should be %f\n", i, j, (psF32) out->data.TYPE[i][j], (psF32) expect); \
+                }                                                              \
+            }                                                                  \
+        }                                                                      \
+    }                                                                          \
+    psFree(in1);                                                               \
+    psFree(in2);                                                               \
+    psFree(out);                                                               \
+    MEMORYFLAG = psMemCheckLeaks(id, NULL, NULL, false);                       \
+}
+
+#define testBinaryOpMV(OP,TYPE,VALUE1,VALUE2,NROWS,NCOLS,ERRORFLAG,MEMORYFLAG) \
+{                                                                              \
+    psMemId id = psMemGetId();                                                 \
+    ERRORFLAG = false;                                                         \
+    MEMORYFLAG = false;                                                        \
+    CREATE_AND_SET_IMAGE(in,TYPE,VALUE1,NROWS,NCOLS);                          \
+    CREATE_AND_SET_VECTOR(inVector,TYPE,VALUE2,NROWS);                         \
+    psImage *out = (psImage*)psBinaryOp(NULL, in, #OP, inVector);              \
+    for (psS32 i = 0 ; i < NROWS ; i++) {                                      \
+        for (psS32 j = 0 ; j < NCOLS ; j++) {                                  \
+            ps##TYPE expect = in->data.TYPE[i][j] OP inVector->data.TYPE[i];   \
+            if (fabs((psF32) (out->data.TYPE[i][j] - expect)) > 0.1) {         \
+                errorFlag = true;                                              \
+                if (VERBOSE) {                                                 \
+                    printf("TEST ERROR: outImage[%d][%d] is %f, should be %f\n", i, j, (psF32) out->data.TYPE[i][j], (psF32) expect); \
+                }                                                              \
+            }                                                                  \
+        }                                                                      \
+    }                                                                          \
+    psFree(in);                                                                \
+    psFree(inVector);                                                          \
+    psFree(out);                                                               \
+    MEMORYFLAG = psMemCheckLeaks(id, NULL, NULL, false);                       \
+}
+
+#define testBinaryOpMS(OP,TYPE,VALUE1,VALUE2,NROWS,NCOLS,ERRORFLAG,MEMORYFLAG) \
+{                                                                              \
+    psMemId id = psMemGetId();                                                 \
+    ERRORFLAG = false;                                                         \
+    MEMORYFLAG = false;                                                        \
+    CREATE_AND_SET_IMAGE(in,TYPE,VALUE1,NROWS,NCOLS);                          \
+    psScalar *inScalar = (psScalar*)psScalarAlloc(VALUE2,PS_TYPE_##TYPE);      \
+    psImage *out = (psImage*)psBinaryOp(NULL, in, #OP, psScalarCopy(inScalar));\
+    for (psS32 i = 0 ; i < NROWS ; i++) {                                      \
+        for (psS32 j = 0 ; j < NCOLS ; j++) {                                  \
+            ps##TYPE expect = in->data.TYPE[i][j] OP inScalar->data.TYPE;      \
+            if (fabs((psF32) (out->data.TYPE[i][j] - expect)) > 0.1) {         \
+                errorFlag = true;                                              \
+                if (VERBOSE) {                                                 \
+                    printf("TEST ERROR: outImage[%d][%d] is %f, should be %f\n", i, j, (psF32) out->data.TYPE[i][j], (psF32) expect); \
+                }                                                              \
+            }                                                                  \
+        }                                                                      \
+    }                                                                          \
+    psFree(inScalar);                                                          \
+    psFree(in);                                                                \
+    psFree(out);                                                               \
+    MEMORYFLAG = psMemCheckLeaks(id, NULL, NULL, false);                       \
+}
+
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    bool errorFlag = false;
+    bool memoryFlag = false;
+    plan_tests(90);
+
+    //Test matrix-matrix binary operations
+    testBinaryOpMM(+,S32,10,20,5,4,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, +, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(+,F32,10.0,10.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, +, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(+,F64,10.0,10.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, +, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(+,C32,10.0+10.0i,10.0+10.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, +, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(-,S32,20,10,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, -, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(-,F32,20.0,10.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, -, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(-,F64,20.0,10.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, -, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(*,S32,20,10,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, *, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(*,F32,20.0,10.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, *, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(*,F64,20.0,10.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, *, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(*,C32,20.0+20.0i,10.0+10.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, *, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(/,S32,20,10,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, /, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(/,F32,20.0,10.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, /, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(/,F64,20.0,10.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, /, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMM(/,C32,20.0+20.0i,10.0+10.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-matrix, /, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+
+    // Test Matrix-Vector binary operations
+    testBinaryOpMV(+,S32,10,5,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, +, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(+,F32,10.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, +, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(+,F64,10.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, +, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(+,C32,10.0+10.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, +, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(-,S32,20,5,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, -, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(-,F32,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, -, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(-,F64,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, -, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(*,S32,20,5,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, *, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(*,F32,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, *, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(*,F64,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, *, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(*,C32,20.0+20.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, *, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(/,S32,20,5,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, /, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(/,F32,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, /, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(/,F64,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, /, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMV(/,C32,20.0+20.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-vector, /, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+
+    // Test Matrix-Scalar binary operations
+    testBinaryOpMS(+,S32,10,5,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, +, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(+,F32,10.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, +, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(+,F64,10.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, +, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(+,C32,10.0+10.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, +, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(-,S32,20,5,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, -, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(-,F32,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, -, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(-,F64,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, -, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(*,S32,20,5,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, *, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(*,F32,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, *, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(*,F64,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, *, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(*,C32,20.0+20.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, *, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(/,S32,20,5,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, /, S32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(/,F32,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, /, F32)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(/,F64,20.0,5.0,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, /, F64)");
+    ok(memoryFlag== false, "no memory leaks");
+    testBinaryOpMS(/,C32,20.0+20.0i,5.0+5.0i,3,2,errorFlag,memoryFlag);
+    ok(errorFlag== false, "psBinaryOp(): was successful: (matrix-scalar, /, C32)");
+    ok(memoryFlag== false, "no memory leaks");
+    return 0;
+}
+
Index: /trunk/psLib/test/math/tap_psPolynomialEval1D.c
===================================================================
--- /trunk/psLib/test/math/tap_psPolynomialEval1D.c	(revision 11396)
+++ /trunk/psLib/test/math/tap_psPolynomialEval1D.c	(revision 11397)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.3 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2007-01-29 21:32:50 $
+*  @version  $Revision: 1.4 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-01-30 00:11:31 $
 *
 *  XXX: Probably should test single- and multi-dimensional polynomials in
@@ -73,7 +73,6 @@
         }
         ok(!errorFlag, "psPolynomial1DEval() successful (Ordinary)");
-
+        skip_end();
         psFree(polyOrd);
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -85,6 +84,5 @@
         psPolynomial1D*  polyCheb = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1);
         ok(polyCheb != NULL, "Chebyshev psPolynomial1D successfully allocated");
-        skip_start(polyCheb == NULL, 2, "Skipping tests because psPolynomial1DAlloc() failed");
-
+        skip_start(polyCheb == NULL, 1, "Skipping tests because psPolynomial1DAlloc() failed");
         // Set polynomial members
         for(psS32 i = 0; i < TERMS; i++)
@@ -103,6 +101,6 @@
         }
         ok(!errorFlag, "psPolynomial1DEval() successful (Chebyshev)");
+        skip_end();
         psFree(polyCheb);
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -127,8 +125,15 @@
     {
         psMemId id = psMemGetId();
+        // Create input vectors
+        psVector* inputOrd = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
+        for(psS32 i = 0; i < TESTPOINTS; i++)
+        {
+            inputOrd->data.F64[i] = poly1DXValue[i];
+            inputOrd->n++;
+        }
+
         psPolynomial1D* polyOrd = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, TERMS-1);
         ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
         skip_start(polyOrd == NULL, 6, "Skipping tests because psPolynomial1DAlloc() failed");
-
         // Set polynomial members
         for(psS32 i = 0; i < TERMS; i++)
@@ -136,12 +141,4 @@
             polyOrd->coeff[i] = poly1DCoeff[i];
             polyOrd->mask[i]  = poly1DMask[i];
-        }
-
-        // Create input vectors
-        psVector* inputOrd = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-        for(psS32 i = 0; i < TESTPOINTS; i++)
-        {
-            inputOrd->data.F64[i] = poly1DXValue[i];
-            inputOrd->n++;
         }
 
@@ -172,10 +169,8 @@
         inputOrd->type.type = PS_TYPE_U8;
         ok(psPolynomial1DEvalVector(polyOrd,inputOrd) == NULL, "psPolynomial1DEvalVector() produced NULL when called with non F64 input vector");
-
+        psFree(outputOrd);
+        skip_end();
         psFree(inputOrd);
-        psFree(outputOrd);
         psFree(polyOrd);
-
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -184,8 +179,15 @@
     {
         psMemId id = psMemGetId();
+        // Create input vectors
+        psVector* inputCheb = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
+        for(psS32 i = 0; i < TESTPOINTS; i++)
+        {
+            inputCheb->data.F64[i] = poly1DXChebValue[i];
+            inputCheb->n++;
+        }
+
         psPolynomial1D* polyCheb = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1);
         ok(polyCheb != NULL, "Ordinary polynomial allocation successful");
-        skip_start(polyCheb == NULL, 6, "Skipping tests because psPolynomial1DAlloc() failed");
-
+        skip_start(polyCheb == NULL, 5, "Skipping tests because psPolynomial1DAlloc() failed");
         // Set polynomial members
         for(psS32 i = 0; i < TERMS; i++)
@@ -193,12 +195,4 @@
             polyCheb->coeff[i] = 1.0;
             polyCheb->mask[i]  = poly1DMask[i];
-        }
-
-        // Create input vectors
-        psVector* inputCheb = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
-        for(psS32 i = 0; i < TESTPOINTS; i++)
-        {
-            inputCheb->data.F64[i] = poly1DXChebValue[i];
-            inputCheb->n++;
         }
 
@@ -226,9 +220,8 @@
         inputCheb->type.type = PS_TYPE_U8;
         ok(psPolynomial1DEvalVector(polyCheb,inputCheb) == NULL, "psPolynomial1DEvalVector() produced NULL when called with non F64 input vector");
-
+        psFree(outputCheb);
+        skip_end();
         psFree(inputCheb);
-        psFree(outputCheb);
         psFree(polyCheb);
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
Index: /trunk/psLib/test/math/tap_psPolynomialEval2D.c
===================================================================
--- /trunk/psLib/test/math/tap_psPolynomialEval2D.c	(revision 11396)
+++ /trunk/psLib/test/math/tap_psPolynomialEval2D.c	(revision 11397)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.2 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-12-29 04:38:42 $
+*  @version  $Revision: 1.3 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-01-30 00:11:31 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -101,7 +101,6 @@
         }
         ok(!errorFlag, "psPolynomial2DEval() successful (Ordinary)");
-
+        skip_end();
         psFree(polyOrd);
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -137,7 +136,6 @@
         }
         ok(!errorFlag, "psPolynomial2DEval() successful (Chebyshev)");
-
+        skip_end();
         psFree(polyCheb);
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -148,14 +146,11 @@
         psMemId id = psMemGetId();
         psPolynomial2D* polyOrd = psPolynomial2DAlloc(99, TERMS-1, TERMS-1);
-        ok(polyOrd == NULL, "Ordinary polynomial allocation successful");
+        ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
         skip_start(polyOrd == NULL, 1, "Skipping tests because psPolynomial2DAlloc() failed");
-
-        // Attempt to evaluation invalid polynomial type
+        // Attempt to evaluate invalid polynomial type
         psF64 result = psPolynomial2DEval(polyOrd,0.0, 0.0);
         ok(isnan(result), "psPolynomial2DEval() did not return NAN, as expected");
-
         skip_end();
         psFree(polyOrd);
-
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -165,17 +160,4 @@
     {
         psMemId id = psMemGetId();
-        psPolynomial2D* polyOrd = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1);
-        ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
-        skip_start(polyOrd == NULL, 8, "Skipping tests because psPolynomial2DAlloc() failed");
-
-        // 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];
-            }
-        }
-
         // Create input vectors
         psVector* inputOrdX  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
@@ -189,4 +171,16 @@
         }
 
+        psPolynomial2D* polyOrd = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1);
+        ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
+        skip_start(polyOrd == NULL, 8, "Skipping tests because psPolynomial2DAlloc() failed");
+        // 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];
+            }
+        }
+
         // Evaluate the vectors
         psVector* outputOrd = psPolynomial2DEvalVector(polyOrd, inputOrdX, inputOrdY);
@@ -223,11 +217,9 @@
         inputOrdY->type.type = PS_TYPE_U8;
         ok(psPolynomial2DEvalVector(polyOrd,inputOrdX, inputOrdY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
-
+        psFree(outputOrd);
+        skip_end();
         psFree(inputOrdX);
         psFree(inputOrdY);
-        psFree(outputOrd);
         psFree(polyOrd);
-
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
 
@@ -241,17 +233,4 @@
     {
         psMemId id = psMemGetId();
-        psPolynomial2D* polyCheb = psPolynomial2DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1);
-        ok(polyCheb != NULL, "Cheby polynomial allocation successful");
-        skip_start(polyCheb == NULL, 8, "Skipping tests because psPolynomial2DAlloc() failed");
-
-        // Set polynomial members
-        for(psS32 i = 0; i < TERMS; i++)
-        {
-            for(psS32 j = 0; j < TERMS; j++) {
-                polyCheb->coeff[i][j] = 1.0;
-                polyCheb->mask[i][j]  = poly2DMask[i][j];
-            }
-        }
-
         // Create input vectors
         psVector* inputChebX = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
@@ -265,4 +244,16 @@
         }
 
+        psPolynomial2D* polyCheb = psPolynomial2DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1);
+        ok(polyCheb != NULL, "Cheby polynomial allocation successful");
+        skip_start(polyCheb == NULL, 8, "Skipping tests because psPolynomial2DAlloc() failed");
+        // Set polynomial members
+        for(psS32 i = 0; i < TERMS; i++)
+        {
+            for(psS32 j = 0; j < TERMS; j++) {
+                polyCheb->coeff[i][j] = 1.0;
+                polyCheb->mask[i][j]  = poly2DMask[i][j];
+            }
+        }
+
         // Evaluate the vectors
         psVector* outputCheb = psPolynomial2DEvalVector(polyCheb, inputChebX, inputChebY);
@@ -300,11 +291,9 @@
         inputChebY->type.type = PS_TYPE_U8;
         ok(psPolynomial2DEvalVector(polyCheb,inputChebX, inputChebY) == NULL, "psPolynomial2DEvalVector() produced NULL when called with non F64 input vector");
-
+        psFree(outputCheb);
+        skip_end();
         psFree(inputChebX);
         psFree(inputChebY);
-        psFree(outputCheb);
         psFree(polyCheb);
-
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
Index: /trunk/psLib/test/math/tap_psPolynomialEval3D.c
===================================================================
--- /trunk/psLib/test/math/tap_psPolynomialEval3D.c	(revision 11396)
+++ /trunk/psLib/test/math/tap_psPolynomialEval3D.c	(revision 11397)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.2 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-12-29 04:38:42 $
+*  @version  $Revision: 1.3 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-01-30 00:11:31 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -207,7 +207,6 @@
         psMemId id = psMemGetId();
         psPolynomial3D* polyOrd = psPolynomial3DAlloc(99, TERMS-1, TERMS-1, TERMS-1);
-        ok(polyOrd == NULL, "Ordinary polynomial allocation successful");
+        ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
         skip_start(polyOrd == NULL, 1, "Skipping tests because psPolynomial3DAlloc() failed");
-
         // Attempt to evaluation invalid polynomial type
         psF64 result = psPolynomial3DEval(polyOrd,0.0, 0.0, 0.0);
@@ -222,19 +221,4 @@
     {
         psMemId id = psMemGetId();
-        psPolynomial3D* polyOrd = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1, TERMS-1);
-        ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
-        skip_start(polyOrd == NULL, 8, "Skipping tests because psPolynomial3DAlloc() failed");
-
-        // 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];
-                }
-            }
-        }
-
         // Create input vectors
         psVector* inputOrdX  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
@@ -251,4 +235,18 @@
         }
 
+        psPolynomial3D* polyOrd = psPolynomial3DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1, TERMS-1);
+        ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
+        skip_start(polyOrd == NULL, 10, "Skipping tests because psPolynomial3DAlloc() failed");
+        // 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];
+                }
+            }
+        }
+
         // Evaluate the vectors
         psVector* outputOrd = psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ);
@@ -293,11 +291,10 @@
         inputOrdZ->type.type = PS_TYPE_U8;
         ok(psPolynomial3DEvalVector(polyOrd,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
-
+        psFree(outputOrd);
+        skip_end();
         psFree(inputOrdX);
         psFree(inputOrdY);
         psFree(inputOrdZ);
-        psFree(outputOrd);
         psFree(polyOrd);
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -309,19 +306,4 @@
     {
         psMemId id = psMemGetId();
-        psPolynomial3D* polyCheb = psPolynomial3DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1, TERMS-1);
-        ok(polyCheb != NULL, "Ordinary polynomial allocation successful");
-        skip_start(polyCheb == NULL, 8, "Skipping tests because psPolynomial3DAlloc() failed");
-
-        // Set polynomial members
-        for(psS32 i = 0; i < TERMS; i++)
-        {
-            for(psS32 j = 0; j < TERMS; j++) {
-                for(psS32 k = 0; k < TERMS; k++) {
-                    polyCheb->coeff[i][j][k] = 1.0;
-                    polyCheb->mask[i][j][k]  = poly3DMask[i][j][k];
-                }
-            }
-        }
-
         // Create input vectors
         psVector* inputChebX = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
@@ -337,4 +319,17 @@
             inputChebZ->n++;
         }
+        psPolynomial3D* polyCheb = psPolynomial3DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1, TERMS-1);
+        ok(polyCheb != NULL, "Ordinary polynomial allocation successful");
+        skip_start(polyCheb == NULL, 10, "Skipping tests because psPolynomial3DAlloc() failed");
+        // Set polynomial members
+        for(psS32 i = 0; i < TERMS; i++)
+        {
+            for(psS32 j = 0; j < TERMS; j++) {
+                for(psS32 k = 0; k < TERMS; k++) {
+                    polyCheb->coeff[i][j][k] = 1.0;
+                    polyCheb->mask[i][j][k]  = poly3DMask[i][j][k];
+                }
+            }
+        }
 
         // Evaluate the vectors
@@ -380,11 +375,10 @@
         inputChebZ->type.type = PS_TYPE_U8;
         ok(psPolynomial3DEvalVector(polyCheb,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial3DEvalVector() produced NULL when called with non F64 input vector");
-
+        psFree(outputCheb);
+        skip_end();
         psFree(inputChebX);
         psFree(inputChebY);
         psFree(inputChebZ);
-        psFree(outputCheb);
         psFree(polyCheb);
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
Index: /trunk/psLib/test/math/tap_psPolynomialEval4D.c
===================================================================
--- /trunk/psLib/test/math/tap_psPolynomialEval4D.c	(revision 11396)
+++ /trunk/psLib/test/math/tap_psPolynomialEval4D.c	(revision 11397)
@@ -4,6 +4,6 @@
 *  ORD and CHEB type polynomials.
 *
-*  @version  $Revision: 1.2 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2006-12-29 04:38:42 $
+*  @version  $Revision: 1.3 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2007-01-30 00:11:31 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -462,22 +462,4 @@
     {
         psMemId id = psMemGetId();
-        // Allocate polynomial
-        psPolynomial4D* polyOrd = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
-        ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
-        skip_start(polyOrd == NULL, 8, "Skipping tests because psPolynomial4DAlloc() failed");
-
-        // 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];
-                    }
-                }
-            }
-        }
-
         // Create input vectors
         psVector* inputOrdW  = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
@@ -497,4 +479,21 @@
         }
 
+        // Allocate polynomial
+        psPolynomial4D* polyOrd = psPolynomial4DAlloc(PS_POLYNOMIAL_ORD, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
+        ok(polyOrd != NULL, "Ordinary polynomial allocation successful");
+        skip_start(polyOrd == NULL, 12, "Skipping tests because psPolynomial4DAlloc() failed");
+        // 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];
+                    }
+                }
+            }
+        }
+
         // Evaluate the vectors
         psVector* outputOrd = psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ);
@@ -548,13 +547,11 @@
         ok(psPolynomial4DEvalVector(polyOrd,inputOrdW,inputOrdX,inputOrdY,inputOrdZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
         inputOrdW->type.type = PS_TYPE_F64;
-
+        psFree(outputOrd);
+        skip_end();
         psFree(inputOrdX);
         psFree(inputOrdY);
         psFree(inputOrdZ);
         psFree(inputOrdW);
-        psFree(outputOrd);
         psFree(polyOrd);
-
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
@@ -563,22 +560,4 @@
     {
         psMemId id = psMemGetId();
-        // Allocate polynomial
-        psPolynomial4D* polyCheb = psPolynomial4DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
-        ok(polyCheb != NULL, "Ordinary polynomial allocation successful");
-        skip_start(polyCheb == NULL, 8, "Skipping tests because psPolynomial4DAlloc() failed");
-
-        // 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++) {
-                        polyCheb->coeff[i][j][k][l] = 1.0;
-                        polyCheb->mask[i][j][k][l]  = poly4DMask[i][j][k][l];
-                    }
-                }
-            }
-        }
-
         // Create input vectors
         psVector* inputChebW = psVectorAlloc(TESTPOINTS, PS_TYPE_F64);
@@ -598,4 +577,22 @@
         }
 
+        // Allocate polynomial
+        psPolynomial4D* polyCheb = psPolynomial4DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1, TERMS-1, TERMS-1, TERMS-1);
+        ok(polyCheb != NULL, "Ordinary polynomial allocation successful");
+        skip_start(polyCheb == NULL, 12, "Skipping tests because psPolynomial4DAlloc() failed");
+
+        // 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++) {
+                        polyCheb->coeff[i][j][k][l] = 1.0;
+                        polyCheb->mask[i][j][k][l]  = poly4DMask[i][j][k][l];
+                    }
+                }
+            }
+        }
+
         // Evaluate the vectors
         psVector* outputCheb = psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ);
@@ -649,13 +646,11 @@
         ok(psPolynomial4DEvalVector(polyCheb,inputChebW,inputChebX,inputChebY,inputChebZ) == NULL, "psPolynomial4DEvalVector() produced NULL when called with non F64 input vector");
         inputChebW->type.type = PS_TYPE_F64;
-
+        psFree(outputCheb);
+        skip_end();
         psFree(inputChebW);
         psFree(inputChebX);
         psFree(inputChebY);
         psFree(inputChebZ);
-        psFree(outputCheb);
         psFree(polyCheb);
-
-        skip_end();
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
