Index: trunk/psLib/src/math/psMatrix.c
===================================================================
--- trunk/psLib/src/math/psMatrix.c	(revision 1406)
+++ trunk/psLib/src/math/psMatrix.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMatrix.c
  *
@@ -20,6 +21,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -27,5 +28,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <string.h>
@@ -42,5 +45,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -48,5 +53,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -54,5 +61,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -60,5 +69,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -66,5 +77,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -142,8 +155,10 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-psImage *psMatrixLUD(psImage *outImage, psVector *outPerm, psImage *inImage)
+
+/*****************************************************************************/
+
+psImage *psMatrixLUD(psImage * outImage, psVector * outPerm, psImage * inImage)
 {
     int signum = 0;
@@ -169,5 +184,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -190,6 +205,6 @@
 }
 
-psVector *psMatrixLUSolve(psVector *outVector, const psImage *inImage, const psVector *inVector, const
-                          psVector *inPerm)
+psVector *psMatrixLUSolve(psVector * outVector, const psImage * inImage, const psVector * inVector, const
+                          psVector * inPerm)
 {
     int arraySize = 0;
@@ -219,5 +234,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -243,5 +258,5 @@
 }
 
-psImage *psMatrixInvert(psImage *outImage, const psImage *inImage, float *restrict det)
+psImage *psMatrixInvert(psImage * outImage, const psImage * inImage, float *restrict det)
 {
     int signum = 0;
@@ -254,5 +269,5 @@
 
     // Error checks
-    if(det == NULL) {
+    if (det == NULL) {
         psError(__func__, "Invalid operation: determinant argument is NULL.");
         return outImage;
@@ -269,5 +284,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Allocate GSL structs
@@ -297,5 +312,5 @@
 }
 
-float* psMatrixDeterminant(const psImage *restrict inImage)
+float *psMatrixDeterminant(const psImage * restrict inImage)
 {
     int signum = 0;
@@ -315,5 +330,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Allocate GSL structs
@@ -328,5 +343,5 @@
 
     // Calculate determinant
-    det = (float*)psAlloc(sizeof(float));
+    det = (float *)psAlloc(sizeof(float));
     gsl_linalg_LU_decomp(lu, perm, &signum);
     *det = (float)gsl_linalg_LU_det(lu, signum);
@@ -339,5 +354,5 @@
 }
 
-psImage* psMatrixMultiply(psImage *outImage, psImage *inImage1, psImage *inImage2)
+psImage *psMatrixMultiply(psImage * outImage, psImage * inImage1, psImage * inImage2)
 {
     int arraySize = 0;
@@ -364,5 +379,5 @@
     numRows = inImage1->numRows;
     numCols = inImage1->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(outImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(outImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -381,5 +396,5 @@
 }
 
-psImage* psMatrixTranspose(psImage *outImage, const psImage *inImage)
+psImage *psMatrixTranspose(psImage * outImage, const psImage * inImage)
 {
     int arraySize = 0;
@@ -400,5 +415,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -418,5 +433,5 @@
 }
 
-psImage *psMatrixEigenvectors(psImage *outImage, psImage *inImage)
+psImage *psMatrixEigenvectors(psImage * outImage, psImage * inImage)
 {
     int numRows = 0;
@@ -462,5 +477,5 @@
 }
 
-psVector *psMatrixToVector(psVector *outVector, psImage *inImage)
+psVector *psMatrixToVector(psVector * outVector, psImage * inImage)
 {
     int size = 0;
@@ -471,52 +486,49 @@
     PS_CHECK_SIZE_IMAGE(inImage, outVector);
 
-    if(inImage->numRows == 1) {
+    if (inImage->numRows == 1) {
         // Create transposed row vector
         PS_CHECK_ALLOC_VECTOR(outVector, inImage->numCols, inImage->type.type);
         outVector->type.dimen = PS_DIMEN_TRANSV;
-    } else
-        if(inImage->numCols == 1) {
-            // Create non-transposed column vector
-            PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
-        } else {
-            psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
-                    inImage->numCols);
-            return outVector;
-        }
+    } else if (inImage->numCols == 1) {
+        // Create non-transposed column vector
+        PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
+    } else {
+        psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
+                inImage->numCols);
+        return outVector;
+    }
 
     PS_CHECK_NULL_VECTOR(outVector, outVector);
 
-
     // More checks
-    if(outVector->type.dimen == PS_DIMEN_VECTOR) {
+    if (outVector->type.dimen == PS_DIMEN_VECTOR) {
         PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
 
-        if(outVector->n == 0) {
+        if (outVector->n == 0) {
             outVector->n = inImage->numRows;
         }
 
-        if(outVector->n != inImage->numRows) {
+        if (outVector->n != inImage->numRows) {
             psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numRows, outVector->n);
             return outVector;
         }
 
-        size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
-
-    } else
-        if(outVector->type.dimen == PS_DIMEN_TRANSV) {
-            PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
-
-            if(outVector->n == 0) {
-                outVector->n = inImage->numCols;
-            }
-
-            if(outVector->n != inImage->numCols) {
-                psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
-                return outVector;
-            }
-
-            size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numCols;
+        size = PSELEMTYPE_SIZEOF(inImage->type.type) * inImage->numRows;
+
+    } else if (outVector->type.dimen == PS_DIMEN_TRANSV) {
+        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
+
+        if (outVector->n == 0) {
+            outVector->n = inImage->numCols;
         }
 
+        if (outVector->n != inImage->numCols) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
+            return outVector;
+        }
+
+        size = PSELEMTYPE_SIZEOF(inImage->type.type) * inImage->numCols;
+    }
+
     memcpy(outVector->data.V, inImage->data.V[0], size);
 
@@ -524,5 +536,5 @@
 }
 
-psImage *psVectorToMatrix(psImage *outImage, psVector *inVector)
+psImage *psVectorToMatrix(psImage * outImage, psVector * inVector)
 {
     int size = 0;
@@ -531,39 +543,34 @@
     PS_CHECK_NULL_VECTOR(inVector, outImage);
 
-    if(inVector->type.dimen == PS_DIMEN_VECTOR) {
+    if (inVector->type.dimen == PS_DIMEN_VECTOR) {
         PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outImage);
         PS_CHECK_SIZE_VECTOR(inVector, outImage);
         PS_CHECK_ALLOC_IMAGE(outImage, 1, inVector->n, PS_TYPE_F64)
-
         // More checks for PS_DIMEN_VECTOR
-        if(outImage->numCols > 1) {
+        if (outImage->numCols > 1) {
             psError(__func__, "Image has more than 1 column: numCols = %d.", outImage->numCols);
             return outImage;
-        } else
-            if(outImage->numRows != inVector->n) {
-                psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
-                return outImage;
-            }
-
-        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
-
-    } else
-        if(inVector->type.dimen == PS_DIMEN_TRANSV) {
-            PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
-            PS_CHECK_SIZE_VECTOR(inVector, outImage);
-            PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
-
-            // More checks for PS_DIMEN_TRANSV
-            if(outImage->numRows > 1) {
-                psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
-                return outImage;
-            } else
-                if(outImage->numCols != inVector->n) {
-                    psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
-                    return outImage;
-                }
-
-            size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numCols;
+        } else if (outImage->numRows != inVector->n) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
+            return outImage;
         }
+
+        size = PSELEMTYPE_SIZEOF(outImage->type.type) * outImage->numRows;
+
+    } else if (inVector->type.dimen == PS_DIMEN_TRANSV) {
+        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
+        PS_CHECK_SIZE_VECTOR(inVector, outImage);
+        PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
+        // More checks for PS_DIMEN_TRANSV
+        if (outImage->numRows > 1) {
+            psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
+            return outImage;
+        } else if (outImage->numCols != inVector->n) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
+            return outImage;
+        }
+
+        size = PSELEMTYPE_SIZEOF(outImage->type.type) * outImage->numCols;
+    }
 
     PS_CHECK_NULL_IMAGE(outImage, outImage);
@@ -574,3 +581,2 @@
     return outImage;
 }
-
