Index: trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c
===================================================================
--- trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c	(revision 1406)
+++ trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMatrixVectorArithmetic.c
  *
@@ -29,6 +30,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -36,5 +37,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <string.h>
@@ -49,5 +52,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -55,5 +60,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -61,5 +68,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -67,5 +76,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -73,5 +84,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -85,7 +98,8 @@
 static complex double psNanDiv(complex double a, complex double b)
 {
-    complex double out = 0+0i;
-    out = a/b;
-    if(isnan(creal(out)) || isnan(cimag(out))) {
+    complex double out = 0 + 0i;
+
+    out = a / b;
+    if (isnan(creal(out)) || isnan(cimag(out))) {
         psError(__func__, ": Divide by zero");
     }
@@ -399,23 +413,23 @@
     psType *psTypeOut = NULL;
 
-    psTypeOut = (psType*)out;
-    if(psTypeOut == NULL) {
+    psTypeOut = (psType *) out;
+    if (psTypeOut == NULL) {
         psError(__func__, ": Line %d - Null out argument", __LINE__);
         return out;
     }
 
-    psType1 = (psType*)in1;
-    if(psType1 == NULL) {
+    psType1 = (psType *) in1;
+    if (psType1 == NULL) {
         psError(__func__, ": Line %d - Null in1 argument", __LINE__);
         return out;
     }
 
-    psType2 = (psType*)in2;
-    if(psType2 == NULL) {
+    psType2 = (psType *) in2;
+    if (psType2 == NULL) {
         psError(__func__, ": Line %d - Null in2 argument", __LINE__);
         return out;
     }
 
-    if(op == NULL) {
+    if (op == NULL) {
         psError(__func__, ": Line %d - Null op argument", __LINE__);
         return out;
@@ -429,5 +443,5 @@
     elTypeOut = psTypeOut->type;
 
-    if(elType1!=elType2 &&  elType1!=elTypeOut) {
+    if (elType1 != elType2 && elType1 != elTypeOut) {
         psError(__func__, ": Line %d - Element types for arguments inconsistent: (%d, %d, %d)", __LINE__,
                 elType1, elType2, elTypeOut);
@@ -435,5 +449,5 @@
     }
 
-    if(dim1==PS_DIMEN_OTHER || dim2==PS_DIMEN_OTHER || dimOut==PS_DIMEN_OTHER) {
+    if (dim1 == PS_DIMEN_OTHER || dim2 == PS_DIMEN_OTHER || dimOut == PS_DIMEN_OTHER) {
         psError(__func__, ": Line %d - PS_DIMEN_OTHER not allowed for arguments: (%d, %d, %d)", __LINE__,
                 dim1, dim2, dimOut);
@@ -441,67 +455,57 @@
     }
 
-    if(dim1 == PS_DIMEN_VECTOR) {
-        if(((psVector*)in1)->n == 0) {
+    if (dim1 == PS_DIMEN_VECTOR) {
+        if (((psVector *) in1)->n == 0) {
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else
-        if(dim1 == PS_DIMEN_IMAGE) {
-            if(((psImage*)in1)->numCols==0 || ((psImage*)in1)->numRows==0) {
-                psError(__func__, ": Line %d - Image contains zero length row or cols");
-            }
-        }
-
-    if(dim2 == PS_DIMEN_VECTOR) {
-        if(((psVector*)in2)->n == 0) {
+    } else if (dim1 == PS_DIMEN_IMAGE) {
+        if (((psImage *) in1)->numCols == 0 || ((psImage *) in1)->numRows == 0) {
+            psError(__func__, ": Line %d - Image contains zero length row or cols");
+        }
+    }
+
+    if (dim2 == PS_DIMEN_VECTOR) {
+        if (((psVector *) in2)->n == 0) {
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else
-        if(dim2 == PS_DIMEN_IMAGE) {
-            if(((psImage*)in2)->numCols==0 || ((psImage*)in2)->numRows==0) {
-                psError(__func__, ": Line %d - Image contains zero length row or cols");
-            }
-        }
-
-    if(dim1 == PS_DIMEN_SCALAR) {
-        if(dim2 == PS_DIMEN_SCALAR) {
-            BINARY_OP(SCALAR,SCALAR,out,psType1,op,psType2);               // scalar op scalar
-        } else
-            if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-                BINARY_OP(SCALAR,VECTOR,out,psType1,op,psType2);               // scalar op vector
-            } else
-                if(dim2 == PS_DIMEN_IMAGE) {
-                    BINARY_OP(SCALAR,IMAGE,out,psType1,op,psType2);                // scalar op image
-                } else {
-                    psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-                }
-    } else
-        if(dim1==PS_DIMEN_VECTOR || dim1==PS_DIMEN_TRANSV) {
-            if(dim2 == PS_DIMEN_SCALAR) {
-                BINARY_OP(VECTOR,SCALAR,out,psType1,op,psType2);               // vector op scalar
-            } else
-                if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-                    BINARY_OP(VECTOR,VECTOR,out,psType1,op,psType2);               // vector op vector
-                } else
-                    if(dim2 == PS_DIMEN_IMAGE) {
-                        BINARY_OP(VECTOR,IMAGE,out,psType1,op,psType2);                // vector op image
-                    } else {
-                        psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-                    }
-        } else
-            if(dim1 == PS_DIMEN_IMAGE) {
-                if(dim2 == PS_DIMEN_SCALAR) {
-                    BINARY_OP(IMAGE,SCALAR,out,psType1,op,psType2);                // image op scalar
-                } else
-                    if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-                        BINARY_OP(IMAGE,VECTOR,out,psType1,op,psType2);                // image op vector
-                    } else
-                        if(dim2 == PS_DIMEN_IMAGE) {
-                            BINARY_OP(IMAGE,IMAGE,out,psType1,op,psType2);                 // image op image
-                        } else {
-                            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-                        }
-            } else {
-                psError(__func__, ": Line %d - Invalid dimensionality for in1 arg: %d", __LINE__, dim1);
-            }
+    } else if (dim2 == PS_DIMEN_IMAGE) {
+        if (((psImage *) in2)->numCols == 0 || ((psImage *) in2)->numRows == 0) {
+            psError(__func__, ": Line %d - Image contains zero length row or cols");
+        }
+    }
+
+    if (dim1 == PS_DIMEN_SCALAR) {
+        if (dim2 == PS_DIMEN_SCALAR) {
+            BINARY_OP(SCALAR, SCALAR, out, psType1, op, psType2);       // scalar op scalar
+        } else if (dim2 == PS_DIMEN_VECTOR || dim2 == PS_DIMEN_TRANSV) {
+            BINARY_OP(SCALAR, VECTOR, out, psType1, op, psType2);       // scalar op vector
+        } else if (dim2 == PS_DIMEN_IMAGE) {
+            BINARY_OP(SCALAR, IMAGE, out, psType1, op, psType2);        // scalar op image
+        } else {
+            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+        }
+    } else if (dim1 == PS_DIMEN_VECTOR || dim1 == PS_DIMEN_TRANSV) {
+        if (dim2 == PS_DIMEN_SCALAR) {
+            BINARY_OP(VECTOR, SCALAR, out, psType1, op, psType2);       // vector op scalar
+        } else if (dim2 == PS_DIMEN_VECTOR || dim2 == PS_DIMEN_TRANSV) {
+            BINARY_OP(VECTOR, VECTOR, out, psType1, op, psType2);       // vector op vector
+        } else if (dim2 == PS_DIMEN_IMAGE) {
+            BINARY_OP(VECTOR, IMAGE, out, psType1, op, psType2);        // vector op image
+        } else {
+            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+        }
+    } else if (dim1 == PS_DIMEN_IMAGE) {
+        if (dim2 == PS_DIMEN_SCALAR) {
+            BINARY_OP(IMAGE, SCALAR, out, psType1, op, psType2);        // image op scalar
+        } else if (dim2 == PS_DIMEN_VECTOR || dim2 == PS_DIMEN_TRANSV) {
+            BINARY_OP(IMAGE, VECTOR, out, psType1, op, psType2);        // image op vector
+        } else if (dim2 == PS_DIMEN_IMAGE) {
+            BINARY_OP(IMAGE, IMAGE, out, psType1, op, psType2); // image op image
+        } else {
+            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+        }
+    } else {
+        psError(__func__, ": Line %d - Invalid dimensionality for in1 arg: %d", __LINE__, dim1);
+    }
 
     return out;
@@ -567,5 +571,4 @@
     }                                                                                                        \
 }
-
 
 // Preprocessor macro function to create arithmetic function based on input type
@@ -596,5 +599,4 @@
 }
 
-
 // Preprocessor macro function to create arithmetic function operation name
 #define UNARY_OP(DIM,OUT,IN,OP)                                                                              \
@@ -714,17 +716,17 @@
     psType *psTypeOut = NULL;
 
-    psTypeOut = (psType*)out;
-    if(psTypeOut == NULL) {
+    psTypeOut = (psType *) out;
+    if (psTypeOut == NULL) {
         psError(__func__, ": Line %d - Null out argument", __LINE__);
         return out;
     }
 
-    psTypeIn = (psType*)in;
-    if(psTypeIn == NULL) {
+    psTypeIn = (psType *) in;
+    if (psTypeIn == NULL) {
         psError(__func__, ": Line %d - Null in argument", __LINE__);
         return out;
     }
 
-    if(op == NULL) {
+    if (op == NULL) {
         psError(__func__, ": Line %d - Null op argument", __LINE__);
         return out;
@@ -736,5 +738,5 @@
     elTypeOut = psTypeOut->type;
 
-    if(elTypeIn!=elTypeOut) {
+    if (elTypeIn != elTypeOut) {
         psError(__func__, ": Line %d - Element types for arguments inconsistent: (%d, %d)", __LINE__,
                 elTypeIn, elTypeOut);
@@ -742,5 +744,5 @@
     }
 
-    if(dimIn!=dimOut) {
+    if (dimIn != dimOut) {
         psError(__func__, ": Line %d - Dimensionality for arguments inconsistent: (%d, %d)", __LINE__,
                 dimIn, dimOut);
@@ -748,5 +750,5 @@
     }
 
-    if(dimIn==PS_DIMEN_OTHER || dimOut==PS_DIMEN_OTHER) {
+    if (dimIn == PS_DIMEN_OTHER || dimOut == PS_DIMEN_OTHER) {
         psError(__func__, ": Line %d - PS_DIMEN_OTHER not allowed for arguments: (%d, %d)", __LINE__,
                 dimIn, dimOut);
@@ -754,37 +756,33 @@
     }
 
-    if(dimIn == PS_DIMEN_VECTOR) {
-        if(((psVector*)in)->n == 0) {
+    if (dimIn == PS_DIMEN_VECTOR) {
+        if (((psVector *) in)->n == 0) {
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else
-        if(dimIn == PS_DIMEN_IMAGE) {
-            if(((psImage*)in)->numCols==0 || ((psImage*)in)->numRows==0) {
-                psError(__func__, ": Line %d - Image contains zero length row or cols");
-            }
-        }
-
-    if(dimOut == PS_DIMEN_VECTOR) {
-        if(((psVector*)out)->n == 0) {
+    } else if (dimIn == PS_DIMEN_IMAGE) {
+        if (((psImage *) in)->numCols == 0 || ((psImage *) in)->numRows == 0) {
+            psError(__func__, ": Line %d - Image contains zero length row or cols");
+        }
+    }
+
+    if (dimOut == PS_DIMEN_VECTOR) {
+        if (((psVector *) out)->n == 0) {
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else
-        if(dimOut == PS_DIMEN_IMAGE) {
-            if(((psImage*)out)->numCols==0 || ((psImage*)out)->numRows==0) {
-                psError(__func__, ": Line %d - Image contains zero length row or cols");
-            }
-        }
-
-    if(dimIn == PS_DIMEN_SCALAR) {
-        UNARY_OP(SCALAR,out,psTypeIn,op);                                 // scalar
-    } else
-        if(dimIn==PS_DIMEN_VECTOR || dimIn==PS_DIMEN_TRANSV) {
-            UNARY_OP(VECTOR,out,psTypeIn,op);                                 // vector
-        } else
-            if(dimIn == PS_DIMEN_IMAGE) {
-                UNARY_OP(IMAGE,out,psTypeIn,op);                                  // image
-            } else {
-                psError(__func__, ": Line %d - Invalid dimensionality for in arg: %d", __LINE__, dimIn);
-            }
+    } else if (dimOut == PS_DIMEN_IMAGE) {
+        if (((psImage *) out)->numCols == 0 || ((psImage *) out)->numRows == 0) {
+            psError(__func__, ": Line %d - Image contains zero length row or cols");
+        }
+    }
+
+    if (dimIn == PS_DIMEN_SCALAR) {
+        UNARY_OP(SCALAR, out, psTypeIn, op);    // scalar
+    } else if (dimIn == PS_DIMEN_VECTOR || dimIn == PS_DIMEN_TRANSV) {
+        UNARY_OP(VECTOR, out, psTypeIn, op);    // vector
+    } else if (dimIn == PS_DIMEN_IMAGE) {
+        UNARY_OP(IMAGE, out, psTypeIn, op);     // image
+    } else {
+        psError(__func__, ": Line %d - Invalid dimensionality for in arg: %d", __LINE__, dimIn);
+    }
 
     return out;
