Index: /trunk/psLib/test/math/tap_psMatrix01.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrix01.c	(revision 10816)
+++ /trunk/psLib/test/math/tap_psMatrix01.c	(revision 10816)
@@ -0,0 +1,120 @@
+/** @file  tst_psMatrix_01.c
+*
+*  @brief Test driver for psMatrix transpose function
+*
+*  This test driver contains the following tests:
+*     Create input images
+*     Transpose input image into output image
+*     Transpose input image into auto allocated NULL output image
+*     Free input images
+*
+*  @author  Ross Harman, MHPCC
+*
+*  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2006-12-20 20:02:29 $
+*
+*  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 TOLERANCE 0.000001
+double truthMatrix[3][3] = {{1, 4, 7},
+                            {2, 5, 8},
+                            {3, 6, 9}};
+
+bool check_matrix(psImage *img)
+{
+    bool errorFlag = false;
+
+    for(psU32 i=0; i<img->numRows; i++) {
+        for(psU32 j=0; j<img->numCols; j++) {
+            if(img->type.type == PS_TYPE_F64) {
+                if(fabs(img->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,
+                         img->data.F64[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            } else if(img->type.type == PS_TYPE_F32) {
+                if(fabs(img->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,
+                         img->data.F32[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            }
+        }
+    }
+    return(errorFlag);
+}
+
+psS32 main( psS32 argc, char* argv[] )
+{
+    plan_tests(10);
+    // Preliminary: Create input 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;
+
+    // Test A - Transpose input image into output image
+    {
+        psMemId id = psMemGetId();
+        psImage *tempImage = outImage;
+        outImage = psMatrixTranspose(outImage, inImage);
+        ok(outImage->type.dimen == PS_DIMEN_IMAGE, "psMatrixTranspose(): outImage has correct number of dimensions");
+        ok(outImage == tempImage, "psMatrixTranspose(): Return pointer equal to output argument pointer");
+        ok(!check_matrix(outImage), "Output image data set correctly");
+
+        tempImage = outImageF32;
+        outImageF32 = psMatrixTranspose(outImageF32, inImageF32);
+        ok(!check_matrix(outImageF32), "Output image data set correctly");
+        ok(outImageF32->type.dimen == PS_DIMEN_IMAGE, "psMatrixTranspose(): outImage has correct number of dimensions");
+        ok(outImageF32 == tempImage, "psMatrixTranspose(): Return pointer equal to output argument pointer");
+
+        psFree(outImage);
+        psFree(outImageF32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Test B - Transpose input image into auto allocated NULL output image
+    {
+        psMemId id = psMemGetId();
+        psImage *outImageNull = NULL;
+        outImageNull = psMatrixTranspose(outImageNull, inImage);
+        ok(!check_matrix(outImageNull), "Output image data set correctly");
+
+        psImage *outImageNullF32 = NULL;
+        outImageNullF32 = psMatrixTranspose(outImageNullF32, inImageF32);
+        check_matrix(outImageNullF32);
+        ok(!check_matrix(outImageNullF32), "Output image data set correctly");
+
+        psFree(outImageNull);
+        psFree(outImageNullF32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    psFree(inImage);
+    psFree(inImageF32);
+}
Index: /trunk/psLib/test/math/tap_psMatrix02.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrix02.c	(revision 10816)
+++ /trunk/psLib/test/math/tap_psMatrix02.c	(revision 10816)
@@ -0,0 +1,93 @@
+/** @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.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-12-20 20:02:29 $
+ *
+ *  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"
+
+psS32 main(psS32 argc,
+           char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(11);
+
+    // Test A - Input pointer same as output pointer
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        ok(psMatrixTranspose(inImage, inImage) == NULL, "psMatrixTranspose(): inImage = outImage results in NULL");
+        ok(psMemGetRefCounter(inImage) == 1, "psMatrixTranspose(): the output image was freed on an error.");
+        psFree(inImage);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Test B - Null input psImage
+    {
+        psMemId id = psMemGetId();
+        psImage *nullImage = NULL;
+        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psMemIncrRefCounter(outImage);
+        ok(psMatrixTranspose(outImage, nullImage) == NULL, "psMatrixTranspose(): inImage = NULL results in NULL return");
+        ok(psMemGetRefCounter(outImage) == 1, "psMatrixTranspose(): the output image was freed on an error.");
+        psFree(outImage);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Test C - Incorrect type for input pointer
+    {
+        psMemId id = psMemGetId();
+        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_C32);
+        psMemIncrRefCounter(outImage);
+        ok(psMatrixTranspose(outImage, badImage1) == NULL, "psMatrixTranspose(): inImage = outImage results in NULL return");
+        ok(psMemGetRefCounter(outImage) == 1, "the output image was freed on the error.");
+        psFree(outImage);
+        psFree(badImage1);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Test D - Incorrect type for output pointer
+    {
+        psMemId id = psMemGetId();
+        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_C32);
+        badImage1 = psMatrixTranspose(badImage1, inImage);
+        ok(badImage1 != NULL, "psMatrixTranspose() results in non-NULL return");
+        // check that the type was changed.
+        ok(badImage1->type.type == PS_TYPE_F64, "the output type was changed to F64");
+        psFree(inImage);
+        psFree(badImage1);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Test E - Matrix not square for output pointer
+    // XXX: We should probably do more here.
+    {
+        psMemId id = psMemGetId();
+        psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psImage *badImage2 = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64);
+        ok(psMatrixTranspose(badImage2, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL");
+        psFree(inImage);
+        psFree(badImage2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+    return 0;
+}
Index: /trunk/psLib/test/math/tap_psMatrix03.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrix03.c	(revision 10816)
+++ /trunk/psLib/test/math/tap_psMatrix03.c	(revision 10816)
@@ -0,0 +1,225 @@
+/** @file  tst_psMatrix_03.c
+ *
+ *  @brief Test driver for psMatrix LU functions
+ *
+ *  This test driver contains the following tests for psMatrix test point 3:
+ *     Create input and output images and vectors
+ *     Calculate LU matrix
+ *     Determine solution to matrix equation
+ *     Free input and output images and vectors
+ *     Attempt to use null image input argument
+ *     Attempt to use null input vector argument
+ *     Attempt to use null LU image argument
+ *
+ * XXX: Some tests should generate an error or warning, but we don't know how to test that.
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-12-20 20:02:29 $
+ *
+ *  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 TOLERANCE 0.000001
+double truthVector[3] = {4.000000, -2.000000, 3.000000};
+double truthMatrix[3][3] = {{4.000000,  5.000000,  6.000000},
+                            {0.750000, -2.750000, -6.500000},
+                            {0.500000, -0.545455, -0.545455}};
+
+psS32 checkMatrix(psImage *img)
+{
+    bool errorFlag = false;
+    for(psU32 i=0; i<img->numRows; i++) {
+        for(psU32 j=0; j<img->numCols; j++) {
+            if(img->type.type == PS_TYPE_F64) {
+                if(fabs(img->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,
+                         img->data.F64[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            } else if(img->type.type == PS_TYPE_F32) {
+                if(fabs(img->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,
+                         img->data.F32[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            }
+        }
+    }
+    return(errorFlag);
+}
+
+
+psS32 checkVector(psVector *vector)
+{
+    bool errorFlag = false;
+    for(psU32 i=0; i<vector->n; i++) {
+        if(vector->type.type == PS_TYPE_F64) {
+            if(fabs(vector->data.F64[i]-truthVector[i]) > TOLERANCE) {
+                diag("Vector values at element %d don't agree %lf vs %lf\n", i,
+                     vector->data.F64[i], truthVector[i]);
+                errorFlag = true;
+            }
+        } else if(vector->type.type == PS_TYPE_F32) {
+            if(fabs(vector->data.F32[i]-truthVector[i]) > TOLERANCE) {
+                diag("Vector values at element %d don't agree %f vs %lf\n", i,
+                     vector->data.F32[i], truthVector[i]);
+                errorFlag = true;
+            }
+        }
+    }
+    return(errorFlag);
+}
+
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(16);
+
+    // This test calculates the LU matrix and then solved the linear equations
+    // in F64 mode.
+    {
+        psMemId id = psMemGetId();
+        psImage *luImage = (psImage*) psImageAlloc(3, 3, PS_TYPE_F64);
+        psImage *tempImage = luImage;
+        psImage *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] =  6;
+        inImage->data.F64[1][0] =  4;
+        inImage->data.F64[1][1] =  5;
+        inImage->data.F64[1][2] =  6;
+        inImage->data.F64[2][0] =  3;
+        inImage->data.F64[2][1] =  1;
+        inImage->data.F64[2][2] = -2;
+        psVector *perm = (psVector*) psVectorAlloc(3, PS_TYPE_F64);
+        psVector *outVector = (psVector*) psVectorAlloc(3, PS_TYPE_F32);
+        psVector *tempVector = outVector;
+        psVector *inVector = (psVector*) psVectorAlloc(3, PS_TYPE_F64);
+
+        luImage = psMatrixLUD(luImage, &perm, inImage);
+        ok(luImage != NULL, "psMatrixLUD() produced a non-NULL LU matrix");
+        skip_start(luImage == NULL, 6, "Skipping tests because LU matrix was NULL");
+        ok(!checkMatrix(luImage), "psMatrixLUD() produced the correct LU matrix");
+        ok(luImage->type.dimen == PS_DIMEN_IMAGE, "The LU matrix has the correct ->dimen member");
+        ok(luImage == tempImage, "The LU matrix was not created from scratch");
+
+        // Determine solution to matrix equation
+        inVector->data.F64[0] = 18.0;
+        inVector->data.F64[1] = 24.0;
+        inVector->data.F64[2] =  4.0;
+        inVector->n = 3;
+
+        outVector = psMatrixLUSolve(outVector, luImage, inVector, perm);
+        ok(!checkVector(outVector), "psMatrixLUSolve() correctly solved the equations");
+        ok(outVector->type.dimen == PS_DIMEN_VECTOR, "The output vector hasthe correct ->dimen member");
+        ok(outVector == tempVector, "The output vector was not created from scratch");
+
+        skip_end();
+        psFree(inImage);
+        psFree(luImage);
+        psFree(perm);
+        psFree(outVector);
+        psFree(inVector);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // This test calculates the LU matrix and then solved the linear equations
+    // in F32 mode.
+    {
+        psMemId id = psMemGetId();
+        psImage *luImage32 = (psImage*)psImageAlloc(3, 3, PS_TYPE_F32);
+        psImage *tempImage32 = luImage32;
+        psImage *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] =  6;
+        inImage32->data.F32[1][0] =  4;
+        inImage32->data.F32[1][1] =  5;
+        inImage32->data.F32[1][2] =  6;
+        inImage32->data.F32[2][0] =  3;
+        inImage32->data.F32[2][1] =  1;
+        inImage32->data.F32[2][2] = -2;
+        psVector *perm32 = NULL;
+        psVector *outVector32 = (psVector*)psVectorAlloc(3, PS_TYPE_F32);
+        psVector *tempVector32 = outVector32;
+        psVector *inVector32 = (psVector*)psVectorAlloc(3, PS_TYPE_F32);
+        inVector32->data.F32[0] = 18.0;
+        inVector32->data.F32[1] = 24.0;
+        inVector32->data.F32[2] =  4.0;
+        inVector32->n = 3;
+
+        luImage32 = psMatrixLUD(luImage32, &perm32, inImage32);
+        ok(luImage32 != NULL, "psMatrixLUD() produced a non-NULL LU matrix");
+        skip_start(luImage32 == NULL, 6, "Skipping tests because LU matrix was NULL");
+        ok(!checkMatrix(luImage32), "psMatrixLUD() produced the correct LU matrix");
+        ok(luImage32->type.dimen == PS_DIMEN_IMAGE, "The LU matrix has the correct ->dimen member");
+        ok(luImage32 == tempImage32, "The LU matrix was not created from scratch");
+
+        // Determine solution to matrix equation
+
+        outVector32 = psMatrixLUSolve(outVector32, luImage32, inVector32, perm32);
+        ok(!checkVector(outVector32), "psMatrixLUSolve() correctly solved the equations");
+        ok(outVector32->type.dimen == PS_DIMEN_VECTOR, "The output vector hasthe correct ->dimen member");
+        ok(outVector32 == tempVector32, "The output vector was not created from scratch");
+
+        skip_end();
+        psFree(inImage32);
+        psFree(luImage32);
+        psFree(perm32);
+        psFree(outVector32);
+        psFree(inVector32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Attempt to use null image input argument
+    // XXX: This test should generate an error or warning, but we don't know how to test that.
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage *imageTest = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psMatrixLUD(imageTest, NULL, NULL);
+        psFree(imageTest);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Attempt to use null input vector argument
+    // XXX: This test should generate an error or warning, but we don't know how to test that.
+    if (0) {
+        psMemId id = psMemGetId();
+        psVector *vectorBad = NULL;
+        psVector *vectorBadOut = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        psVector *permBad = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        psImage *imageTest = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psMatrixLUSolve(vectorBadOut, imageTest, vectorBad, permBad);
+        psFree(vectorBadOut);
+        psFree(permBad);
+        psFree(imageTest);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Attempt to use null LU image argument
+    // XXX: This test should generate an error or warning, but we don't know how to test that.
+    if (0) {
+        psMemId id = psMemGetId();
+        psVector *vectorBadOut = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        psVector *vectorBad = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        psVector *permBad = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        psMatrixLUSolve(vectorBadOut, NULL, vectorBad, permBad);
+        psFree(vectorBadOut);
+        psFree(vectorBad);
+        psFree(permBad);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+}
Index: /trunk/psLib/test/math/tap_psMatrix04.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrix04.c	(revision 10816)
+++ /trunk/psLib/test/math/tap_psMatrix04.c	(revision 10816)
@@ -0,0 +1,170 @@
+/** @file  tst_psMatrix_04.c
+ *
+ *  @brief Test driver for psMatrix invert function
+ *
+ *  This test driver contains the following tests for psMatrix test point 4:
+ *     Create input and output images
+ *     Invert matrix and calculate determinant
+ *     Calculate determinant only
+ *     Free input and output images
+ *     Attempt to use null input image argument
+ *     Attempt to use null input float argument
+ *
+ * Sme tests should generate an error/warning, but we don't know how to test that.
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-12-20 20:02:29 $
+ *
+ *  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 TOLERANCE 0.000001
+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;
+
+psS32 checkMatrix(psImage *img)
+{
+    bool errorFlag = false;
+    for(psU32 i=0; i<img->numRows; i++) {
+        for(psU32 j=0; j<img->numCols; j++) {
+            if(img->type.type == PS_TYPE_F64) {
+                if(fabs(img->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,
+                         img->data.F64[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            } else if(img->type.type == PS_TYPE_F32) {
+                if(fabs(img->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,
+                         img->data.F32[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            }
+        }
+    }
+    return(errorFlag);
+}
+
+psS32 checkValue(psF64 value)
+{
+    if(fabs(value-truthValue) > TOLERANCE) {
+        diag("Values don't agree %lf vs %lf\n", value, truthValue);
+        return(true);
+    } else {
+        return(false);
+    }
+}
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(14);
+
+    // Invert matrix and calculate determinant: F64
+    {
+        psMemId id = psMemGetId();
+        float det = 0.0f;
+        float det2 = 0;
+        psImage *tempImage = NULL;
+        psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psImage *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;
+
+        tempImage = outImage;
+        outImage = psMatrixInvert(outImage, inImage, &det);
+        ok(outImage != NULL, "psMatrixInvert() produced a non-NULL matrix");
+        skip_start(outImage == NULL, 4, "Skipping tests because the output matrix is NULL");
+        ok(!checkMatrix(outImage), "psMatrixInvert() produced the correct output matrix");
+        ok(!checkValue(det), "psMatrixInvert() produced the correct determinant");
+        ok(outImage->type.dimen == PS_DIMEN_IMAGE, "psMatrixInvert() produced the correct ->dimen member");
+        ok(outImage == tempImage, "psMatrixInvert() did not allocate a new output matrix");
+        det = 0.0f;
+
+        det2 = psMatrixDeterminant(inImage);
+        ok(!checkValue(det2), "psMatrixDeterminant() produced the correct determinant");
+
+        skip_end()
+        psFree(outImage);
+        psFree(inImage);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Invert matrix and calculate determinant: F32
+    {
+        psMemId id = psMemGetId();
+        float det = 0.0f;
+        float det2 = 0;
+        psImage *tempImage32 = NULL;
+        psImage *outImage32 = (psImage*)psImageAlloc(3, 3, PS_TYPE_F32);
+        psImage *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;
+
+        tempImage32 = outImage32;
+        outImage32 = psMatrixInvert(outImage32, inImage32, &det);
+        ok(outImage32 != NULL, "psMatrixInvert() produced a non-NULL matrix");
+        skip_start(outImage32 == NULL, 4, "Skipping tests because the output matrix is NULL");
+        ok(!checkMatrix(outImage32), "psMatrixInvert() produced the correct output matrix");
+        ok(!checkValue(det), "psMatrixInvert() produced the correct determinant");
+        ok(outImage32->type.dimen == PS_DIMEN_IMAGE, "psMatrixInvert() produced the correct ->dimen member");
+        ok(outImage32 == tempImage32, "psMatrixInvert() did not allocate a new output matrix");
+
+        det2 = psMatrixDeterminant(inImage32);
+        ok(!checkValue(det2), "psMatrixDeterminant() produced the correct determinant");
+
+        skip_end()
+        psFree(outImage32);
+        psFree(inImage32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Attempt to use null input image argument
+    // XXX: This should generate an error/warning, but we don't know how to test that.
+    if (0) {
+        psMemId id = psMemGetId();
+        float det = 0.0f;
+        psImage *badOutImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psMatrixInvert(badOutImage, NULL, &det);
+        psFree(badOutImage);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    // Attempt to use null input float argument
+    // XXX: This should generate an error/warning, but we don't know how to test that.
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage *badInImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psImage *badOutImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+        psMatrixInvert(badOutImage, badInImage, NULL);
+        psFree(badInImage);
+        psFree(badOutImage);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+}
Index: /trunk/psLib/test/math/tap_psMatrix05.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrix05.c	(revision 10816)
+++ /trunk/psLib/test/math/tap_psMatrix05.c	(revision 10816)
@@ -0,0 +1,120 @@
+/** @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.1 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2006-12-20 20:02:29 $
+*
+*  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 TOLERANCE 0.000001
+double truthMatrix[3][3] = {{  0.0, 52.0},
+                            {-14.0, 51.0}};
+
+psS32 checkMatrix(psImage *img)
+{
+    bool errorFlag = false;
+    for(psU32 i=0; i<img->numRows; i++) {
+        for(psU32 j=0; j<img->numCols; j++) {
+            if(img->type.type == PS_TYPE_F64) {
+                if(fabs(img->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,
+                         img->data.F64[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            } else if(img->type.type == PS_TYPE_F32) {
+                if(fabs(img->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,
+                         img->data.F32[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            }
+        }
+    }
+    return(errorFlag);
+}
+
+psS32 main(psS32 argc,
+           char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(6);
+
+    // Create input and output images, then multiple: F64 version
+    {
+        psMemId id = psMemGetId();
+        psImage * outImage = (psImage*) psImageAlloc(2, 2, PS_TYPE_F64);
+        psImage *inImage1 = (psImage*) psImageAlloc(3, 2, PS_TYPE_F64);
+        psImage *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;
+
+        // Test B - Multiply images
+        psMatrixMultiply(outImage, inImage1, inImage2);
+        ok(outImage != NULL, "psMatrixMultiply() produced a non-NULL output matrix");
+        ok(!checkMatrix(outImage), "psMatrixMultiply() produced the correct output matrix");
+
+        // Test C - Free input and output images
+        psFree(outImage);
+        psFree(inImage1);
+        psFree(inImage2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Create input and output images, then multiple: F32 version
+    {
+        psMemId id = psMemGetId();
+        psImage * outImage32 = NULL;
+        psImage *inImage132 = NULL;
+        psImage *inImage232 = NULL;
+        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;
+
+        // Test B - Multiply images
+        psMatrixMultiply(outImage32, inImage132, inImage232);
+        ok(outImage32 != NULL, "psMatrixMultiply() produced a non-NULL output matrix");
+        ok(!checkMatrix(outImage32), "psMatrixMultiply() produced the correct output matrix");
+
+        // Test C - Free input and output images
+        psFree(outImage32);
+        psFree(inImage132);
+        psFree(inImage232);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+}
Index: /trunk/psLib/test/math/tap_psMatrix06.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrix06.c	(revision 10816)
+++ /trunk/psLib/test/math/tap_psMatrix06.c	(revision 10816)
@@ -0,0 +1,124 @@
+/** @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.1 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2006-12-20 20:02:29 $
+*
+*  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 TOLERANCE 0.000001
+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}};
+
+
+psS32 checkMatrix(psImage *img)
+{
+    bool errorFlag = false;
+    for(psU32 i=0; i<img->numRows; i++) {
+        for(psU32 j=0; j<img->numCols; j++) {
+            if(img->type.type == PS_TYPE_F64) {
+                if(fabs(img->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,
+                         img->data.F64[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            } else if(img->type.type == PS_TYPE_F32) {
+                if(fabs(img->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,
+                         img->data.F32[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            }
+        }
+    }
+    return(errorFlag);
+}
+
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(6);
+
+    // Create input and output images, then produce Eigen vectors: F64 version
+    {
+        psMemId id = psMemGetId();
+        psImage * outImage = (psImage*) psImageAlloc(4, 4, PS_TYPE_F64);
+        psImage *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.;
+
+        psMatrixEigenvectors(outImage, inImage);
+        ok(outImage != NULL, "psMatrixEigenvectors() produced a NULL output Matrix");
+        skip_start(outImage == NULL, 1, "Skipping tests because output matrix was NULL");
+        ok(!checkMatrix(outImage), "psMatrixEigenvectors() produced the correct Matrix");
+        psFree(outImage);
+        psFree(inImage);
+
+        skip_end();
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Create input and output images, then produce Eigen vectors: F32 version
+    {
+        psMemId id = psMemGetId();
+        psImage * outImage32 = (psImage*) psImageAlloc(4, 4, PS_TYPE_F32);
+        psImage *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.;
+
+        psMatrixEigenvectors(outImage32, inImage32);
+        ok(outImage32 != NULL, "psMatrixEigenvectors() produced a NULL output Matrix");
+        skip_start(outImage32 == NULL, 1, "Skipping tests because output matrix was NULL");
+        ok(!checkMatrix(outImage32), "psMatrixEigenvectors() produced the correct Matrix");
+        psFree(outImage32);
+        psFree(inImage32);
+
+        skip_end();
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+}
Index: /trunk/psLib/test/math/tap_psMatrix07.c
===================================================================
--- /trunk/psLib/test/math/tap_psMatrix07.c	(revision 10816)
+++ /trunk/psLib/test/math/tap_psMatrix07.c	(revision 10816)
@@ -0,0 +1,340 @@
+/** @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:
+ *     Create input and output images and vectors
+ *     Convert matrix to PS_DIMEN_VECTOR vector
+ *     Attempt to use null image input argument
+ *     Convert matrix to PS_DIMEN_TRANSV vector
+ *     XXX: Improper image size (NOT TESTED)
+ *     Convert PS_DIMEN_VECTOR vector to matrix
+ *     XXX: Attempt to use null input vector argument (NOT TESTED)
+ *     Convert PS_DIMEN_TRANSV vector to matrix
+ *     Free input and output images and vectors
+ *
+ * XXX: This should produce an error; how can we test it?
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-12-20 20:02:29 $
+ *
+ *  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 TOLERANCE 0.000001
+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}};
+
+psS32 checkMatrix(psImage *img)
+{
+    bool errorFlag = false;
+    for(psU32 i=0; i<img->numRows; i++) {
+        for(psU32 j=0; j<img->numCols; j++) {
+            if(img->type.type == PS_TYPE_F64) {
+                if(fabs(img->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,
+                         img->data.F64[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            } else if(img->type.type == PS_TYPE_F32) {
+                if(fabs(img->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {
+                    diag("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,
+                         img->data.F32[i][j], truthMatrix[i][j]);
+                    errorFlag = true;
+                }
+            }
+        }
+    }
+    return(errorFlag);
+}
+
+psS32 checkVector(psVector *vector)
+{
+    bool errorFlag = false;
+    for(psU32 i=0; i<vector->n; i++) {
+        if(vector->type.type == PS_TYPE_F64) {
+            if(fabs(vector->data.F64[i]-truthVector[i]) > TOLERANCE) {
+                diag("Vector values at element %d don't agree %lf vs %lf\n", i,
+                     vector->data.F64[i], truthVector[i]);
+                errorFlag = true;
+            }
+        } else if(vector->type.type == PS_TYPE_F32) {
+            if(fabs(vector->data.F32[i]-truthVector[i]) > TOLERANCE) {
+                diag("Vector values at element %d don't agree %f vs %lf\n", i,
+                     vector->data.F32[i], truthVector[i]);
+                errorFlag = true;
+            }
+        }
+    }
+    return(errorFlag);
+}
+
+psS32 main(psS32 argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    plan_tests(44);
+
+    // Convert matrix to PS_DIMEN_VECTOR vector: F64 version
+    {
+        psMemId id = psMemGetId();
+        psVector *v1 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        psImage *m1 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
+        m1->data.F64[0][0] = 0.0;
+        m1->data.F64[1][0] = 1.0;
+        m1->data.F64[2][0] = 2.0;
+        psVector *tempVector = v1;
+
+        v1 = psMatrixToVector(v1, m1);
+        ok(v1 != NULL, "psMatrixToVector() produced a non-NULL vector");
+        skip_start(v1 == NULL, 3, "Skipping tests because vector was NULL");
+        ok(!checkVector(v1), "psMatrixToVector() produced the correct vector");
+        ok(v1->type.dimen == PS_DIMEN_VECTOR, "psMatrixToVector() produced the correct ->dimen member");
+        ok(v1 == tempVector, "psMatrixToVector() did not allocate a new output vector");
+
+        skip_end();
+        psFree(m1);
+        psFree(v1);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Convert matrix to PS_DIMEN_VECTOR vector: F32 version
+    {
+        psMemId id = psMemGetId();
+        psVector *v1_32 = (psVector*)psVectorAlloc(3, PS_TYPE_F32);
+        psImage *m1_32 = (psImage*)psImageAlloc(1,3,PS_TYPE_F32);
+        m1_32->data.F32[0][0] = 0.0;
+        m1_32->data.F32[1][0] = 1.0;
+        m1_32->data.F32[2][0] = 2.0;
+        psVector *tempVector_32 = v1_32;
+
+        v1_32 = psMatrixToVector(v1_32, m1_32);
+        ok(v1_32 != NULL, "psMatrixToVector() produced a non-NULL vector");
+        skip_start(v1_32 == NULL, 3, "Skipping tests because vector was NULL");
+        ok(!checkVector(v1_32), "psMatrixToVector() produced the correct vector");
+        ok(v1_32->type.dimen == PS_DIMEN_VECTOR, "psMatrixToVector() produced the correct ->dimen member");
+        ok(v1_32 == tempVector_32, "psMatrixToVector() did not allocate a new output vector");
+
+        skip_end();
+        psFree(m1_32);
+        psFree(v1_32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Attempt to use null image input argument: F64 version
+    {
+        psMemId id = psMemGetId();
+        psVector *v1 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        v1 = psMatrixToVector(v1, NULL);
+        ok(v1 == NULL, "psMatrixToVector() returned NULL with NULL matrix argument");
+        psFree(v1);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Attempt to use null image input argument: F32 version
+    {
+        psMemId id = psMemGetId();
+        psVector *v1_32 = (psVector*)psVectorAlloc(3, PS_TYPE_F32);
+        v1_32 = psMatrixToVector(v1_32, NULL);
+        ok(v1_32 == NULL, "psMatrixToVector() returned NULL with NULL matrix argument");
+        psFree(v1_32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Convert matrix to PS_DIMEN_TRANSV vector: F64 version
+    {
+        psMemId id = psMemGetId();
+        psImage *m4 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
+        m4->data.F64[0][0] = 0.0;
+        m4->data.F64[0][1] = 1.0;
+        m4->data.F64[0][2] = 2.0;
+        psVector *v3 = psVectorAlloc(3, PS_TYPE_F64);
+        psVector *tempVector = v3;
+
+        v3->type.dimen = PS_DIMEN_TRANSV;
+        psMatrixToVector(v3, m4);
+        ok(v3 != NULL, "psMatrixToVector() produced non-NULL output VECTOR");
+        skip_start(v3 == NULL, 3, "Skipping tests because of non-NULL output VECTOR");
+        ok(!checkVector(v3), "psMatrixToVector() produced the correct vector");
+        ok(v3->type.dimen == PS_DIMEN_TRANSV, "psMatrixToVector() produced the correct ->dimen member");
+        ok(v3 == tempVector, "psMatrixToVector() did not allocate a new output vector");
+
+        skip_end();
+        psFree(m4);
+        psFree(v3);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Convert matrix to PS_DIMEN_TRANSV vector: F32 version
+    {
+        psMemId id = psMemGetId();
+        psImage *m4_32 = m4_32 = (psImage*)psImageAlloc(3,1,PS_TYPE_F32);
+        m4_32->data.F32[0][0] = 0.0;
+        m4_32->data.F32[0][1] = 1.0;
+        m4_32->data.F32[0][2] = 2.0;
+        psVector *v3_32 = psVectorAlloc(3, PS_TYPE_F32);
+        psVector *tempVector_32 = v3_32;
+
+        v3_32->type.dimen = PS_DIMEN_TRANSV;
+        psMatrixToVector(v3_32, m4_32);
+        ok(v3_32 != NULL, "psMatrixToVector() produced non-NULL output VECTOR");
+        skip_start(v3_32 == NULL, 3, "Skipping tests because of non-NULL output VECTOR");
+        ok(!checkVector(v3_32), "psMatrixToVector() produced the correct vector");
+        ok(v3_32->type.dimen == PS_DIMEN_TRANSV, "psMatrixToVector() produced the correct ->dimen member");
+        ok(v3_32 == tempVector_32, "psMatrixToVector() did not allocate a new output vector");
+
+        skip_end();
+        psFree(m4_32);
+        psFree(v3_32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Improper image size: F64 version
+    // XXX: This should produce an error; how can we test it?
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage *badImage = (psImage*)psImageAlloc(2, 2, PS_TYPE_F64);
+        psVector *v1 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        ok(psMatrixToVector(v1, badImage) == NULL, "psMatrixToVector() returned NULL with improper sizes");
+        psFree(badImage)
+        psFree(v1)
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Improper image size: F32 version
+    // XXX: This should produce an error; how can we test it?
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage *badImage_32 = (psImage*)psImageAlloc(2,2,PS_TYPE_F32);
+        psVector *v1_32 = (psVector*)psVectorAlloc(3, PS_TYPE_F32);
+        ok(psMatrixToVector(v1_32, badImage_32) == NULL, "psMatrixToVector() returned NULL with improper sizes");
+        psFree(badImage_32)
+        psFree(v1_32)
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Convert PS_DIMEN_VECTOR vector to matrix: F64 version
+    {
+        psMemId id = psMemGetId();
+        psImage *m2 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
+        psVector *v2 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        v2->data.F64[0] = 0.0;
+        v2->data.F64[1] = 1.0;
+        v2->data.F64[2] = 2.0;
+        v2->n = 3;
+
+        psImage *tempImage = m2;
+        m2 = psVectorToMatrix(m2, v2);
+        ok(m2 != NULL, "psVectorToMatrix() produced non-NULL output matrix");
+        skip_start(m2 == NULL, 3, "Skipping tests because of non-NULL output matrix");
+        ok(!checkMatrix(m2), "psVectorToMatrix() produced the correct vector");
+        ok(m2->type.dimen == PS_DIMEN_IMAGE, "psVectorToMatrix() produced the correct ->dimen member");
+        ok(m2 == tempImage, "psVectorToMatrix() did not allocate a new output matrix");
+
+        skip_end();
+        psFree(m2);
+        psFree(v2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Convert PS_DIMEN_VECTOR vector to matrix: F32 version
+    {
+        psMemId id = psMemGetId();
+        psImage *m2_32 = (psImage*)psImageAlloc(1,3,PS_TYPE_F32);
+        psVector *v2_32 = (psVector*)psVectorAlloc(3,PS_TYPE_F32);
+        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;
+
+        psImage *tempImage_32 = m2_32;
+        m2_32 = psVectorToMatrix(m2_32, v2_32);
+        ok(m2_32 != NULL, "psVectorToMatrix() produced non-NULL output matrix");
+        skip_start(m2_32 == NULL, 3, "Skipping tests because of non-NULL output matrix");
+        ok(!checkMatrix(m2_32), "psVectorToMatrix() produced the correct vector");
+        ok(m2_32->type.dimen == PS_DIMEN_IMAGE, "psVectorToMatrix() produced the correct ->dimen member");
+        ok(m2_32 == tempImage_32, "psVectorToMatrix() did not allocate a new output matrix");
+
+        skip_end();
+        psFree(m2_32);
+        psFree(v2_32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Attempt to use null input vector argument: F64 version
+    // XXX: This should produce an error; how can we test it?
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage *m2 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
+        ok(psVectorToMatrix(m2, NULL) == NULL, "psVectorToMatrix() returned NULL with NULL input vector");
+        psFree(m2);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Attempt to use null input vector argument: F32 version
+    // XXX: This should produce an error; how can we test it?
+    if (0) {
+        psMemId id = psMemGetId();
+        psImage *m2_32 = (psImage*)psImageAlloc(1,3,PS_TYPE_F32);
+        ok(psVectorToMatrix(m2_32, NULL) == NULL, "psVectorToMatrix() returned NULL with NULL input vector");
+        psFree(m2_32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Convert PS_DIMEN_TRANSV vector to matrix: F64 version
+    {
+        psMemId id = psMemGetId();
+        psVector *v2 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
+        v2->data.F64[0] = 0.0;
+        v2->data.F64[1] = 1.0;
+        v2->data.F64[2] = 2.0;
+        v2->n = 3;
+        v2->type.dimen = PS_DIMEN_TRANSV;
+        psImage *m3 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
+        psImage *tempImage = m3;
+
+        psVectorToMatrix(m3, v2);
+        ok(m3 != NULL, "psVectorToMatrix() produced non-NULL output matrix");
+        skip_start(m3 == NULL, 3, "Skipping tests because of non-NULL output matrix");
+        ok(!checkMatrix(m3), "psVectorToMatrix() produced the correct vector");
+        ok(m3->type.dimen == PS_DIMEN_IMAGE, "psVectorToMatrix() produced the correct ->dimen member");
+        ok(m3 == tempImage, "psVectorToMatrix() did not allocate a new output matrix");
+
+        skip_end();
+        psFree(v2);
+        psFree(m3);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    // Convert PS_DIMEN_TRANSV vector to matrix: F32 version
+    {
+        psMemId id = psMemGetId();
+        psVector *v2_32 = (psVector*)psVectorAlloc(3,PS_TYPE_F32);
+        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;
+        v2_32->type.dimen = PS_DIMEN_TRANSV;
+        psImage *m3_32 = (psImage*)psImageAlloc(3,1,PS_TYPE_F32);
+        psImage *tempImage_32 = m3_32;
+
+        psVectorToMatrix(m3_32, v2_32);
+        ok(m3_32 != NULL, "psVectorToMatrix() produced non-NULL output matrix");
+        skip_start(m3_32 == NULL, 3, "Skipping tests because of non-NULL output matrix");
+        ok(!checkMatrix(m3_32), "psVectorToMatrix() produced the correct vector");
+        ok(m3_32->type.dimen == PS_DIMEN_IMAGE, "psVectorToMatrix() produced the correct ->dimen member");
+        ok(m3_32 == tempImage_32, "psVectorToMatrix() did not allocate a new output matrix");
+
+        skip_end();
+        psFree(v2_32);
+        psFree(m3_32);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+}
