Index: trunk/psLib/src/math/psMatrix.c
===================================================================
--- trunk/psLib/src/math/psMatrix.c	(revision 3476)
+++ trunk/psLib/src/math/psMatrix.c	(revision 3880)
@@ -21,6 +21,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-03-22 21:52:49 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-05-11 02:29:39 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -376,6 +376,4 @@
 psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2)
 {
-    psS32 numRows = 0;
-    psS32 numCols = 0;
     gsl_matrix *m1 = NULL;
     gsl_matrix *m2 = NULL;
@@ -394,21 +392,21 @@
     PS_CHECK_POINTERS(inImage1, inImage2, MULTIPLY_CLEANUP);
 
-    outImage = psImageRecycle(outImage, inImage2->numCols, inImage2->numRows, inImage2->type.type);
-
-    PS_CHECK_SQUARE(inImage1, MULTIPLY_CLEANUP);
-    PS_CHECK_SQUARE(inImage2, MULTIPLY_CLEANUP);
-    PS_CHECK_SQUARE(outImage, MULTIPLY_CLEANUP);
-
-    // Initialize data
-    numRows = inImage1->numRows;
-    numCols = inImage1->numCols;
+    if (inImage1->numRows != inImage2->numCols) {
+        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid operation: number of rows of inImage1 != number of cols of inImage2.");
+        MULTIPLY_CLEANUP;
+    }
+    if (inImage1->type.type != inImage2->type.type) {
+        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid operation: data types of inImage1 and inImage2 must match.");
+        MULTIPLY_CLEANUP;
+    }
+
+    outImage = psImageRecycle(outImage, inImage1->numCols, inImage2->numRows, inImage2->type.type);
 
     // Initialize GSL data
-    m1 = gsl_matrix_alloc(numRows, numCols);
+    m1 = gsl_matrix_alloc(inImage1->numRows, inImage1->numCols);
     psImageToGslMatrix(m1, inImage1);
-    m2 = gsl_matrix_alloc(numRows, numCols);
+    m2 = gsl_matrix_alloc(inImage2->numRows, inImage2->numCols);
     psImageToGslMatrix(m2, inImage2);
-    m3 = gsl_matrix_alloc(numRows, numCols);
-    psImageToGslMatrix(m3, outImage);
+    m3 = gsl_matrix_alloc(outImage->numRows, outImage->numCols);
 
     // Perform multiplication
