Index: /trunk/psLib/test/dataManip/Makefile
===================================================================
--- /trunk/psLib/test/dataManip/Makefile	(revision 797)
+++ /trunk/psLib/test/dataManip/Makefile	(revision 798)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/sysUtils
 ##
-##  $Revision: 1.6 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-05-25 23:53:50 $
+##  $Revision: 1.7 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-05-28 02:52:23 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,4 +17,10 @@
 
 TARGET = tst_psMatrix01 \
+         tst_psMatrix02 \
+         tst_psMatrix03 \
+         tst_psMatrix04 \
+         tst_psMatrix05 \
+         tst_psMatrix06 \
+         tst_psMatrix07 \
          tst_psStats00 \
          tst_psStats01 \
@@ -26,4 +32,10 @@
 
 tst_psMatrix01:         tst_psMatrix01.o
+tst_psMatrix02:         tst_psMatrix02.o
+tst_psMatrix03:         tst_psMatrix03.o
+tst_psMatrix04:         tst_psMatrix04.o
+tst_psMatrix05:         tst_psMatrix05.o
+tst_psMatrix06:         tst_psMatrix06.o
+tst_psMatrix07:         tst_psMatrix07.o
 tst_psStats00:		tst_psStats00.o
 tst_psStats01:		tst_psStats01.o
@@ -40,5 +52,5 @@
 
 %   : %.o
-	$(CC) -o $@ $< -L$(PSLIB_LIB_DIR) -lpslib -lpstest $(LDFLAGS)
+	$(CC) -o $@ $< -L$(PSLIB_LIB_DIR) -lpslib -lpstest -lgsl -lgslcblas $(LDFLAGS)
 
 %.lint: %.c
Index: /trunk/psLib/test/dataManip/tst_psMatrix01.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix01.c	(revision 797)
+++ /trunk/psLib/test/dataManip/tst_psMatrix01.c	(revision 798)
@@ -1,160 +1,81 @@
+/** @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: 2004-05-28 02:52:23 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
 #include "pslib.h"
-//#include <gsl/gsl_matrix.h>
+#include "psTest.h"
 
-int main(void)
+#define PRINT_MATRIX(IMAGE)                         \
+for(int i=IMAGE->numRows-1; i>-1; i--) {        \
+    for(int j=0; j<IMAGE->numCols; j++) {       \
+        printf("%f ", IMAGE->data.F64[i][j]);   \
+    }                                          \
+    printf("\n");                              \
+}
+
+int main(int argc,
+         char* argv[])
 {
 
-    psImage *d = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    psImage *dout = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    d->data.F64[0][0] = 1;
-    d->data.F64[0][1] = 2;
-    d->data.F64[0][2] = 3;
-    d->data.F64[1][0] = 4;
-    d->data.F64[1][1] = 5;
-    d->data.F64[1][2] = 6;
-    d->data.F64[2][0] = 7;
-    d->data.F64[2][1] = 8;
-    d->data.F64[2][2] = 9;
 
-    psMatrixTranspose(dout, d);
-    printf("%f\n", dout->data.F64[2][1]);
-
-    psImage *e = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    e->data.F64[0][0] = 1;
-    e->data.F64[0][1] = 2;
-    e->data.F64[0][2] = 3;
-    e->data.F64[1][0] = 4;
-    e->data.F64[1][1] = 5;
-    e->data.F64[1][2] = 6;
-    e->data.F64[2][0] = 7;
-    e->data.F64[2][1] = 8;
-    e->data.F64[2][2] = 9;
-
-    //    psImage *f = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-
-    //    char x = '+';
-
-    //    psMatrixOp(f, d, &x, e);
-
-    psImage *g = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    g->data.F64[0][0] =  2;
-    g->data.F64[0][1] =  4;
-    g->data.F64[0][2] =  3;
-    g->data.F64[1][0] =  0;
-    g->data.F64[1][1] =  1;
-    g->data.F64[1][2] = -1;
-    g->data.F64[2][0] =  3;
-    g->data.F64[2][1] =  5;
-    g->data.F64[2][2] =  7;
-
-    psImage *h = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    float det;
-
-    h = psMatrixInvert(h, g, &det);
-
-    int i;
-    int j;
-
-    for(i=0; i<3; i++)
-        for(j=0; j<3; j++) {
-            printf("inv %f\n", h->data.F64[i][j]);
-        }
-
-    printf("det %f\n", psMatrixDeterminant(g));
-
-    for(i=0; i<3; i++)
-        for(j=0; j<3; j++) {
-            printf("g %f\n", g->data.F64[i][j]);
-        }
+    // 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;
+    PRINT_MATRIX(inImage);
+    printFooter(stdout, "psMatrix", "Create input and output images", true);
 
 
-    psImage *luImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    psVector *perm = (psVector*)psVectorAlloc(3, PS_TYPE_DOUBLE);
-    psVector *outVector = (psVector*)psVectorAlloc(3, PS_TYPE_DOUBLE);
-    psVector *inVector = (psVector*)psVectorAlloc(3, PS_TYPE_DOUBLE);
-
-    inVector->vec.d[0] =  6.0;
-    inVector->vec.d[1] = -4.0;
-    inVector->vec.d[2] =  7.0;
-    inVector->n = 3;
-
-    psMatrixLUD(luImage, perm, g);
-
-    for(i=0; i<3; i++)
-        for(j=0; j<3; j++) {
-            printf("luImage %f\n", luImage->data.F64[i][j]);
-        }
-
-    psMatrixLUSolve(outVector, luImage, inVector, perm);
-
-    for(j=0; j<3; j++)
-        printf("%f\n", outVector->vec.d[j]);
-
-    psImage *m = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    m->data.F64[0][0] =  1.1;
-    m->data.F64[0][1] =  1.1;
-    m->data.F64[0][2] =  1.1;
-    m->data.F64[1][0] =  1.1;
-    m->data.F64[1][1] =  1.1;
-    m->data.F64[1][2] =  1.1;
-    m->data.F64[2][0] =  1.1;
-    m->data.F64[2][1] =  1.1;
-    m->data.F64[2][2] =  1.1;
-
-    psImage *n = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    n->data.F64[0][0] =  1.1;
-    n->data.F64[0][1] =  1.1;
-    n->data.F64[0][2] =  1.1;
-    n->data.F64[1][0] =  1.1;
-    n->data.F64[1][1] =  1.1;
-    n->data.F64[1][2] =  1.1;
-    n->data.F64[2][0] =  1.1;
-    n->data.F64[2][1] =  1.1;
-    n->data.F64[2][2] =  1.1;
-
-    psImage *p = (psImage*)psImageAlloc(3, 3, PS_TYPE_DOUBLE);
-    psMatrixOp(p, m, '*', n);
-
-    for(i=0; i<3; i++)
-        for(j=0; j<3; j++) {
-            printf("luImage %f\n", p->data.F64[i][j]);
-        }
+    // Test B - Transpose input image into output image
+    printPositiveTestHeader(stdout, "psMatrix", "Transpose input image into output image");
+    psMatrixTranspose(outImage, inImage);
+    PRINT_MATRIX(outImage);
+    printFooter(stdout, "psMatrix", "Transpose input image into output image", true);
 
 
-
-    psVector *v = (psVector*)psVectorAlloc(PS_TYPE_DOUBLE, 3);
-    psImage *m2 = (psImage*)psImageAlloc(1, 3, PS_TYPE_DOUBLE);
-    m2->data.F64[0][0] = 0.0;
-    m2->data.F64[1][0] = 1.0;
-    m2->data.F64[2][0] = 2.0;
-
-    v = psMatrixToVector(v, m2);
-
-    for(j=0; j<3; j++)
-        printf("v %f\n", v->vec.d[j]);
-
-    psImage *m3 = (psImage*)psImageAlloc(1, 3, PS_TYPE_DOUBLE);
-    psVector *v3 = (psVector*)psVectorAlloc(PS_TYPE_DOUBLE, 3);
-    v3->vec.d[0] = 0.0;
-    v3->vec.d[1] = 1.0;
-    v3->vec.d[2] = 2.0;
-    m3 = psVectorToMatrix(m3, v3);
-    for(j=0; j<3; j++)
-        printf("m3 %f\n", m3->data.F64[j][0]);
+    // Test C -  Transpose input image into auto allocated NULL output image
+    printPositiveTestHeader(stdout, "psMatrix", "ranspose input image into auto allocated NULL output image");
+    psImage *outImageNull = NULL;
+    outImageNull = psMatrixTranspose(outImageNull, inImage);
+    PRINT_MATRIX(outImageNull);
+    printFooter(stdout, "psMatrix", "ranspose input image into auto allocated NULL output image", true);
 
 
-    psImage *inData = (psImage*)psImageAlloc(2, 2, PS_TYPE_DOUBLE);
+    // Test D - Free images and check for leaks
+    printPositiveTestHeader(stdout, "psMatrix", "Free images and check for leaks");
+    psImageFree(inImage);
+    psImageFree(outImage);
+    psImageFree(outImageNull);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psMatrix" ,"Free images and check for leaks", true);
 
-    inData ->data.F64[0][0] =  0.0;
-    inData ->data.F64[0][1] =  4.0;
-    inData ->data.F64[1][0] =  4.0;
-    inData ->data.F64[1][1] =  4.1;
-
-    psImage *outData = (psImage*)psImageAlloc(2, 2, PS_TYPE_DOUBLE);
-
-
-    psMatrixEigenvectors(outData, inData);
-    for(j=0; j<2; j++)
-        printf("outData %f\n", m3->data.F64[j][0]);
-
+    return 0;
 }
Index: /trunk/psLib/test/dataManip/tst_psMatrix02.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix02.c	(revision 798)
+++ /trunk/psLib/test/dataManip/tst_psMatrix02.c	(revision 798)
@@ -0,0 +1,71 @@
+/** @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)  Matrix not square for input pointer
+ *     E)  Incorrect type for output pointer
+ *     F)  Matrix not square for output pointer
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-05-28 02:52:23 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    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_F32);
+    psImage *badImage2 = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64);
+
+    // Test A - Input pointer same as output pointer
+    printNegativeTestHeader(stdout,"psMatrix", "Input pointer same as output pointer",
+                            "Invalid operation: Pointer to inImage is same as outImage.", 0);
+    psMatrixTranspose(inImage, inImage);
+    printFooter(stdout, "psMatrix", "Input pointer same as output pointer", true);
+
+    // Test B - Null input psImage
+    printNegativeTestHeader(stdout,"psMatrix", "Null input psImage",
+                            "Invalid operation: inImage or its data is NULL.", 0);
+    psMatrixTranspose(outImage, nullImage);
+    printFooter(stdout, "psMatrix", "Null input psImage", true);
+
+    // Test C - Incorrect type for input pointer
+    printNegativeTestHeader(stdout,"psMatrix", "Incorrect type for input pointer",
+                            "|Invalid operation: inImage not PS_TYPE_F64.", 0);
+    psMatrixTranspose(outImage, badImage1);
+    printFooter(stdout, "psMatrix", "Incorrect type for input pointer", true);
+
+    // Test D - Matrix not square for input pointer
+    printNegativeTestHeader(stdout,"psMatrix", "Matrix not square for input pointer",
+                            "Invalid operation: inImage not square array.", 0);
+    psMatrixTranspose(outImage, badImage2);
+    printFooter(stdout, "psMatrix", "Matrix not square for input pointer", true);
+
+    // Test E - Incorrect type for output pointer
+    printNegativeTestHeader(stdout,"psMatrix", "Incorrect type for output pointer",
+                            "Invalid operation: outImage not PS_TYPE_F64.", 0);
+    psMatrixTranspose(badImage1, inImage);
+    printFooter(stdout, "psMatrix", "Incorrect type for output pointer", true);
+
+    // Test F - Matrix not square for output pointer
+    printNegativeTestHeader(stdout,"psMatrix", "Matrix not square for output pointer",
+                            "Invalid operation: outImage not square array.", 0);
+    psMatrixTranspose(badImage2, inImage);
+    printFooter(stdout, "psMatrix", "Matrix not square for output pointer", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/dataManip/tst_psMatrix03.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix03.c	(revision 798)
+++ /trunk/psLib/test/dataManip/tst_psMatrix03.c	(revision 798)
@@ -0,0 +1,102 @@
+/** @file  tst_psMatrix_03.c
+ *
+ *  @brief Test driver for psMatrix LU functions
+ *
+ *  This test driver contains the following tests for psMatrix test point 3:
+ *     A)  Create input and output images and vectors
+ *     B)  Calculate LU matrix
+ *     C)  Determine solution to matrix equation  
+ *     D)  Free input and output images and vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-05-28 02:52:23 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+#define PRINT_MATRIX(IMAGE)                         \
+for(int i=IMAGE->numRows-1; i>-1; i--) {        \
+    for(int j=0; j<IMAGE->numCols; j++) {       \
+        printf("%f ", IMAGE->data.F64[i][j]);   \
+    }                                          \
+    printf("\n");                              \
+}
+
+#define PRINT_VECTOR(VECTOR)                        \
+for(int i=0; i<VECTOR->n; i++) {               \
+    printf("%f\n", VECTOR->vec.d[i]);          \
+}
+
+
+int main(int argc,
+         char* argv[])
+{
+    psImage *luImage = NULL;
+    psImage *inImage = NULL;
+    psVector *perm = NULL;
+    psVector *outVector = NULL;
+    psVector *inVector = NULL;
+
+
+    // Test A - Create input and output images and vectors
+    printPositiveTestHeader(stdout, "psMatrix", "Create input and output images and vectors");
+    luImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
+    perm = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
+    outVector = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
+    inVector = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
+    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;
+    inVector->vec.d[0] = 18.0;
+    inVector->vec.d[1] = 24.0;
+    inVector->vec.d[2] =  4.0;
+    inVector->n = 3;
+    PRINT_MATRIX(inImage);
+    printf("\n");
+    PRINT_VECTOR(inVector);
+    printFooter(stdout, "psMatrix", "Create input and output images and vectors", true);
+
+
+    // Test B - Calculate LU matrix
+    printPositiveTestHeader(stdout, "psMatrix", "Calculate LU matrix");
+    psMatrixLUD(luImage, perm, inImage);
+    PRINT_MATRIX(luImage);
+    printFooter(stdout, "psMatrix", "Calculate LU matrix", true);
+
+
+    // Test C - Determine solution to matrix equation
+    printPositiveTestHeader(stdout, "psMatrix", "Determine solution to matrix equation");
+    psMatrixLUSolve(outVector, luImage, inVector, perm);
+    PRINT_VECTOR(outVector);
+    printFooter(stdout, "psMatrix", "Determine solution to matrix equation", true);
+
+
+    // Test D - Free input and output images and vectors
+    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors");
+    psImageFree(inImage);
+    psImageFree(luImage);
+    psVectorFree(perm);
+    psVectorFree(outVector);
+    psVectorFree(inVector);
+    psMemCheckLeaks(0, NULL, stdout);
+    int 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/dataManip/tst_psMatrix04.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix04.c	(revision 798)
+++ /trunk/psLib/test/dataManip/tst_psMatrix04.c	(revision 798)
@@ -0,0 +1,85 @@
+/** @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
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-05-28 02:52:23 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+#define PRINT_MATRIX(IMAGE)                         \
+for(int i=IMAGE->numRows-1; i>-1; i--) {        \
+    for(int j=0; j<IMAGE->numCols; j++) {       \
+        printf("%f ", IMAGE->data.F64[i][j]);   \
+    }                                          \
+    printf("\n");                              \
+}
+
+
+int main(int argc,
+         char* argv[])
+{
+    float det = 0.0f;
+    psImage *outImage = NULL;
+    psImage *inImage = NULL;
+
+
+    // 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;
+    PRINT_MATRIX(inImage);
+    printFooter(stdout, "psMatrix", "Create input and output images", true);
+
+
+    // Test B - Invert matrix and calculate determinant
+    printPositiveTestHeader(stdout, "psMatrix", "Invert matrix and calculate determinant");
+    psMatrixInvert(outImage, inImage, &det);
+    PRINT_MATRIX(outImage);
+    printf("\ndet = %f\n", det);
+    printFooter(stdout, "psMatrix", "Invert matrix and calculate determinant", true);
+
+
+    // Test C - Calculate determinant only
+    printPositiveTestHeader(stdout, "psMatrix", "Calculate determinant only");
+    det = 0.0f;
+    det = psMatrixDeterminant(inImage);
+    printf("det = %f\n", det);
+    printFooter(stdout, "psMatrix", "Calculate determinant only", true);
+
+
+    // Test D - Free input and output images
+    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images");
+    psImageFree(outImage);
+    psImageFree(inImage);
+    psMemCheckLeaks(0, NULL, stdout);
+    int 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/dataManip/tst_psMatrix05.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix05.c	(revision 798)
+++ /trunk/psLib/test/dataManip/tst_psMatrix05.c	(revision 798)
@@ -0,0 +1,78 @@
+/** @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: 2004-05-28 02:52:23 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+#define PRINT_MATRIX(IMAGE)                         \
+for(int i=0; i<IMAGE->numRows; i++) {           \
+    for(int j=0; j<IMAGE->numCols; j++) {       \
+        printf("%f ", IMAGE->data.F64[i][j]);   \
+    }                                          \
+    printf("\n");                              \
+}
+
+
+int main(int argc,
+         char* argv[])
+{
+    psImage *outImage = NULL;
+    psImage *inImage1 = NULL;
+    psImage *inImage2 = NULL;
+
+
+    // 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(2, 2, PS_TYPE_F64);
+    inImage2 = (psImage*)psImageAlloc(2, 2, PS_TYPE_F64);
+    inImage1->data.F64[0][0] =  2;
+    inImage1->data.F64[0][1] =  3;
+    inImage1->data.F64[1][0] = -1;
+    inImage1->data.F64[1][1] =  2;
+    inImage2->data.F64[0][0] =  4;
+    inImage2->data.F64[0][1] =  1;
+    inImage2->data.F64[1][0] =  0;
+    inImage2->data.F64[1][1] =  6;
+    PRINT_MATRIX(inImage1);
+    printf("\n");
+    PRINT_MATRIX(inImage2);
+    printFooter(stdout, "psMatrix", "Create input and output images", true);
+
+
+    // Test B - Multiply images
+    printPositiveTestHeader(stdout, "psMatrix", "Multiply images");
+    psMatrixMultiply(outImage, inImage1, inImage2);
+    PRINT_MATRIX(outImage);
+    printFooter(stdout, "psMatrix", "Multiply images", true);
+
+
+    // Test C - Free input and output images
+    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images");
+    psImageFree(outImage);
+    psImageFree(inImage1);
+    psImageFree(inImage2);
+    psMemCheckLeaks(0, NULL, stdout);
+    int 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/dataManip/tst_psMatrix06.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix06.c	(revision 798)
+++ /trunk/psLib/test/dataManip/tst_psMatrix06.c	(revision 798)
@@ -0,0 +1,86 @@
+/** @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: 2004-05-28 02:52:23 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+#define PRINT_MATRIX(IMAGE)                         \
+for(int i=0; i<IMAGE->numRows; i++) {           \
+    for(int j=0; j<IMAGE->numCols; j++) {       \
+        printf("%f ", IMAGE->data.F64[i][j]);   \
+    }                                          \
+    printf("\n");                              \
+}
+
+
+int main(int argc,
+         char* argv[])
+{
+    psImage *outImage = NULL;
+    psImage *inImage = NULL;
+
+
+    // 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.;
+
+    PRINT_MATRIX(inImage);
+    printFooter(stdout, "psMatrix", "Create input and output images", true);
+
+
+    // Test B - Calculate Eigenvectors
+    printPositiveTestHeader(stdout, "psMatrix", "Calculate Eigenvectors");
+    psMatrixEigenvectors(outImage, inImage);
+    PRINT_MATRIX(outImage);
+    printFooter(stdout, "psMatrix", "Calculate Eigenvectors", true);
+
+
+    // Test C - Free input and output images
+    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images");
+    psImageFree(outImage);
+    psImageFree(inImage);
+    psMemCheckLeaks(0, NULL, stdout);
+    int 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/dataManip/tst_psMatrix07.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 798)
+++ /trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 798)
@@ -0,0 +1,93 @@
+/** @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 vector
+ *     C)  Convert vector to matrix 
+ *     D)  Free input and output images and vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-05-28 02:52:23 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+#define PRINT_MATRIX(IMAGE)                         \
+for(int i=0; i<IMAGE->numRows; i++) {           \
+    for(int j=0; j<IMAGE->numCols; j++) {       \
+        printf("%f ", IMAGE->data.F64[i][j]);   \
+    }                                          \
+    printf("\n");                              \
+}
+
+#define PRINT_VECTOR(VECTOR)                        \
+for(int i=0; i<VECTOR->n; i++) {               \
+    printf("%f\n", VECTOR->vec.d[i]);          \
+}
+
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *v1 = NULL;
+    psImage *m1 = NULL;
+    psVector *v2 = NULL;
+    psImage *m2 = NULL;
+
+
+    // Test A - Create input and output images
+    printPositiveTestHeader(stdout, "psMatrix", "Create input and output images and vectors");
+    v1 = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
+    m1 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
+    v2 = (psVector*)psVectorAlloc(PS_TYPE_F64, 3);
+    m2 = (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;
+    v2->vec.d[0] = 0.0;
+    v2->vec.d[1] = 1.0;
+    v2->vec.d[2] = 2.0;
+    v2->n = 3;
+    PRINT_MATRIX(m1);
+    printf("\n");
+    PRINT_VECTOR(v2);
+    printFooter(stdout, "psMatrix", "Create input and output images and vectors", true);
+
+
+    // Test B - Convert matrix to vector
+    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to vector");
+    psMatrixToVector(v1, m1);
+    PRINT_VECTOR(v1);
+    printFooter(stdout, "psMatrix", "Calculate Eigenvectors", true);
+
+
+    // Test C - Convert vector to matrix
+    printPositiveTestHeader(stdout, "psMatrix", "Convert vector to matrix");
+    psVectorToMatrix(m2, v2);
+    PRINT_MATRIX(m2);
+    printFooter(stdout, "psMatrix", "Convert vector to matrix", true);
+
+
+    // Test D - Free input and output images
+    printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors");
+    psImageFree(m1);
+    psVectorFree(v1);
+    psImageFree(m2);
+    psVectorFree(v2);
+    psMemCheckLeaks(0, NULL, stdout);
+    int 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;
+}
