Index: /trunk/psLib/test/dataManip/tst_psMatrix05.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix05.c	(revision 2687)
+++ /trunk/psLib/test/dataManip/tst_psMatrix05.c	(revision 2688)
@@ -10,6 +10,6 @@
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2004-11-22 21:00:21 $
+*  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-12-10 20:54:34 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -20,10 +20,21 @@
 #include "psTest.h"
 
-#define PRINT_MATRIX(IMAGE)                         \
-for(psS32 i=0; i<IMAGE->numRows; i++) {           \
-    for(psS32 j=0; j<IMAGE->numCols; j++) {       \
-        printf("%f ", IMAGE->data.F64[i][j]);   \
-    }                                          \
-    printf("\n");                              \
+#define TOLERANCE 0.000001
+
+#define CHECK_MATRIX(IMAGE)                                                                                  \
+for(psU32 i=0; i<IMAGE->numRows; i++) {                                                                  \
+    for(psU32 j=0; j<IMAGE->numCols; j++) {                                                              \
+        if(IMAGE->type.type == PS_TYPE_F64) {                                                            \
+            if(fabs(IMAGE->data.F64[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
+                printf("Matrix values at element %d, %d don't agree %lf vs %lf\n", i, j,                 \
+                       IMAGE->data.F64[i][j], truthMatrix[i][j]);                                        \
+            }                                                                                            \
+        } else if(IMAGE->type.type == PS_TYPE_F32){                                                      \
+            if(fabs(IMAGE->data.F32[i][j]-truthMatrix[i][j]) > TOLERANCE) {                              \
+                printf("Matrix values at element %d, %d don't agree %f vs %lf\n", i, j,                  \
+                       IMAGE->data.F32[i][j], truthMatrix[i][j]);                                        \
+            }                                                                                            \
+        }                                                                                                \
+    }                                                                                                    \
 }
 
@@ -35,37 +46,58 @@
     psImage *inImage1 = NULL;
     psImage *inImage2 = NULL;
+    psImage * outImage32 = NULL;
+    psImage *inImage132 = NULL;
+    psImage *inImage232 = NULL;
+
+    double truthMatrix[3][3] = {{ 8.000000, 20.000000},
+                                {-4.000000, 11.000000}};
+
+
 
 
     // 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 );
+    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;
+    outImage32 = (psImage*)psImageAlloc(2, 2, PS_TYPE_F32);
+    inImage132 = (psImage*)psImageAlloc(2, 2, PS_TYPE_F32);
+    inImage232 = (psImage*)psImageAlloc(2, 2, PS_TYPE_F32);
+    inImage132->data.F32[0][0] = 2;
+    inImage132->data.F32[0][1] = 3;
+    inImage132->data.F32[1][0] = -1;
+    inImage132->data.F32[1][1] = 2;
+    inImage232->data.F32[0][0] = 4;
+    inImage232->data.F32[0][1] = 1;
+    inImage232->data.F32[1][0] = 0;
+    inImage232->data.F32[1][1] = 6;
     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 );
+    printPositiveTestHeader(stdout, "psMatrix", "Multiply images");
+    psMatrixMultiply(outImage, inImage1, inImage2);
+    CHECK_MATRIX(outImage);
+    psMatrixMultiply(outImage32, inImage132, inImage232);
+    CHECK_MATRIX(outImage32);
+    printFooter(stdout, "psMatrix", "Multiply images", true);
 
 
     // Test C - Free input and output images
     printPositiveTestHeader( stdout, "psMatrix", "Free input and output images" );
-    psFree( outImage );
-    psFree( inImage1 );
-    psFree( inImage2 );
+    psFree(outImage);
+    psFree(inImage1);
+    psFree(inImage2);
+    psFree(outImage32);
+    psFree(inImage132);
+    psFree(inImage232);
     psS32 nLeaks = psMemCheckLeaks( 0, NULL, stdout, false );
     if ( nLeaks != 0 ) {
