Index: /trunk/psLib/src/dataManip/psMatrix.c
===================================================================
--- /trunk/psLib/src/dataManip/psMatrix.c	(revision 907)
+++ /trunk/psLib/src/dataManip/psMatrix.c	(revision 908)
@@ -20,6 +20,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-04 23:49:59 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-08 01:57:52 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -35,4 +35,5 @@
 #include <gsl/gsl_eigen.h>
 
+#include "psMemory.h"
 #include "psError.h"
 #include "psImage.h"
@@ -253,4 +254,8 @@
 
     // Error checks
+    if(det == NULL) {
+        psError(__func__, "Invalid operation: determinant argument is NULL.");
+        return outImage;
+    }
     PS_CHECK_POINTERS(inImage, outImage, outImage);
     PS_CHECK_NULL_IMAGE(inImage, outImage);
@@ -292,5 +297,5 @@
 }
 
-float psMatrixDeterminant(const psImage *restrict inImage)
+float* psMatrixDeterminant(const psImage *restrict inImage)
 {
     int signum = 0;
@@ -298,12 +303,12 @@
     int numRows = 0;
     int numCols = 0;
-    float det = 0.0f;
+    float *det = NULL;
     gsl_matrix *lu = NULL;
     gsl_permutation *perm = NULL;
 
     // Error checks
-    PS_CHECK_NULL_IMAGE(inImage, 0);
-    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, 0);
-    PS_CHECK_SIZE_IMAGE(inImage, 0);
+    PS_CHECK_NULL_IMAGE(inImage, NULL);
+    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, NULL);
+    PS_CHECK_SIZE_IMAGE(inImage, NULL);
 
     // Initialize data
@@ -323,6 +328,7 @@
 
     // Calculate determinant
+    det = (float*)psAlloc(sizeof(float));
     gsl_linalg_LU_decomp(lu, perm, &signum);
-    det = (float)gsl_linalg_LU_det(lu, signum);
+    *det = (float)gsl_linalg_LU_det(lu, signum);
 
     // Free GSL structs
@@ -458,5 +464,5 @@
 psVector *psMatrixToVector(psVector *outVector, psImage *inImage)
 {
-    int colSize = 0;
+    int size = 0;
 
     // Error checks
@@ -464,24 +470,52 @@
     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outVector);
     PS_CHECK_SIZE_IMAGE(inImage, outVector);
-    PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
-    PS_CHECK_NULL_VECTOR(outVector, outVector);
-    PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
-
-    // Set n if allocated, but empty
-    if(outVector->n == 0) {
-        outVector->n = inImage->numRows;
-    }
-
-    // More checks
-    if(inImage->numCols > 1) {
-        psError(__func__, "Image has more than 1 column: numCols = %d.", inImage->numCols);
-        return outVector;
-    } else if(outVector->n != inImage->numRows) {
-        psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numRows, outVector->n);
+
+    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;
     }
 
-    colSize = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
-    memcpy(outVector->data.V, inImage->data.V[0], colSize);
+    PS_CHECK_NULL_VECTOR(outVector, outVector);
+
+
+    // More checks
+    if(outVector->type.dimen == PS_DIMEN_VECTOR) {
+        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
+
+        if(outVector->n == 0) {
+            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;
+    }
+
+    memcpy(outVector->data.V, inImage->data.V[0], size);
 
     return outVector;
@@ -490,25 +524,46 @@
 psImage *psVectorToMatrix(psImage *outImage, psVector *inVector)
 {
-    int colSize = 0;
+    int size = 0;
 
     // Error checks
     PS_CHECK_NULL_VECTOR(inVector, outImage);
-    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_F32)
+
+    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) {
+            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;
+    }
+
     PS_CHECK_NULL_IMAGE(outImage, outImage);
     PS_CHECK_DIMEN_AND_TYPE(outImage, PS_DIMEN_IMAGE, outImage);
 
-    // More checks
-    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;
-    }
-
-    colSize = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
-    memcpy(outImage->data.V[0], inVector->data.V, colSize);
+    memcpy(outImage->data.V[0], inVector->data.V, size);
 
     return outImage;
Index: /trunk/psLib/src/dataManip/psMatrix.h
===================================================================
--- /trunk/psLib/src/dataManip/psMatrix.h	(revision 907)
+++ /trunk/psLib/src/dataManip/psMatrix.h	(revision 908)
@@ -9,6 +9,4 @@
  *      Matrix inversion
  *      Calculate determinant
- *      Matrix addition
- *      Matrix subtraction
  *      Matrix multiplication
  *      Calculate Eigenvectors
@@ -17,10 +15,10 @@
  *
  *  These functions treat psImages as if they were matrices, therefore there is no psMatrix. These functions
- *  operate only with psF32 and psF64 data types.
+ *  operate only with the psF64 data type.
  *
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-28 20:52:41 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-08 01:58:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -100,5 +98,5 @@
  *  @return  float: Determinant from psImage.
  */
-float psMatrixDeterminant(
+float* psMatrixDeterminant(
     const psImage *restrict inMatrix    ///< Image used to calculate determinant.
 );
@@ -149,6 +147,7 @@
  *
  *  Converts a 1-d psImage matrix into a vector. If the user specifies NULL as the outVector argument, then it
- *  will automatically be created. The input matrix must be a 1-d column matrix. This function operates only 
- *  with the psF64 data type.
+ *  will automatically be created based on the input image (PS_DIMEN_VECTOR for an input image with 1 col or
+ *  PS_DIMENT_TRANSV for an input image with 1 row). Either the number of rows or the number of colums of the
+ *  input matrix must be 1. This function operates only  with the psF64 data type.
  *
  *  @return  psVector*: Pointer to psVector.
@@ -161,6 +160,8 @@
 /** Convert vector to matrix.
  *
- *  Converts a vector into a 1-d column psImage matrix. If the user specifies NULL as the outImage argument, 
- *  then it will automatically be created. This function operates only with the psF64 data type.  
+ *  Converts a vector into a psImage matrix. If the dimensionality of the vector is PS_DIMEN_VECTOR, then the
+ *  resulting psImage is a 1d column. If the dimensionality of the vector is PS_DIMEN_TRANSV, then the
+ *  resulting psImage is a 1d row. If the user specifies NULL as the outImage argument,  then it will 
+ *  automatically be created. This function operates only with the psF64 data type.  
  *
  *  @return  psVector*: Pointer to psIamge.
Index: /trunk/psLib/src/math/psMatrix.c
===================================================================
--- /trunk/psLib/src/math/psMatrix.c	(revision 907)
+++ /trunk/psLib/src/math/psMatrix.c	(revision 908)
@@ -20,6 +20,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-04 23:49:59 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-08 01:57:52 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -35,4 +35,5 @@
 #include <gsl/gsl_eigen.h>
 
+#include "psMemory.h"
 #include "psError.h"
 #include "psImage.h"
@@ -253,4 +254,8 @@
 
     // Error checks
+    if(det == NULL) {
+        psError(__func__, "Invalid operation: determinant argument is NULL.");
+        return outImage;
+    }
     PS_CHECK_POINTERS(inImage, outImage, outImage);
     PS_CHECK_NULL_IMAGE(inImage, outImage);
@@ -292,5 +297,5 @@
 }
 
-float psMatrixDeterminant(const psImage *restrict inImage)
+float* psMatrixDeterminant(const psImage *restrict inImage)
 {
     int signum = 0;
@@ -298,12 +303,12 @@
     int numRows = 0;
     int numCols = 0;
-    float det = 0.0f;
+    float *det = NULL;
     gsl_matrix *lu = NULL;
     gsl_permutation *perm = NULL;
 
     // Error checks
-    PS_CHECK_NULL_IMAGE(inImage, 0);
-    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, 0);
-    PS_CHECK_SIZE_IMAGE(inImage, 0);
+    PS_CHECK_NULL_IMAGE(inImage, NULL);
+    PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, NULL);
+    PS_CHECK_SIZE_IMAGE(inImage, NULL);
 
     // Initialize data
@@ -323,6 +328,7 @@
 
     // Calculate determinant
+    det = (float*)psAlloc(sizeof(float));
     gsl_linalg_LU_decomp(lu, perm, &signum);
-    det = (float)gsl_linalg_LU_det(lu, signum);
+    *det = (float)gsl_linalg_LU_det(lu, signum);
 
     // Free GSL structs
@@ -458,5 +464,5 @@
 psVector *psMatrixToVector(psVector *outVector, psImage *inImage)
 {
-    int colSize = 0;
+    int size = 0;
 
     // Error checks
@@ -464,24 +470,52 @@
     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outVector);
     PS_CHECK_SIZE_IMAGE(inImage, outVector);
-    PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
-    PS_CHECK_NULL_VECTOR(outVector, outVector);
-    PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
-
-    // Set n if allocated, but empty
-    if(outVector->n == 0) {
-        outVector->n = inImage->numRows;
-    }
-
-    // More checks
-    if(inImage->numCols > 1) {
-        psError(__func__, "Image has more than 1 column: numCols = %d.", inImage->numCols);
-        return outVector;
-    } else if(outVector->n != inImage->numRows) {
-        psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numRows, outVector->n);
+
+    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;
     }
 
-    colSize = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
-    memcpy(outVector->data.V, inImage->data.V[0], colSize);
+    PS_CHECK_NULL_VECTOR(outVector, outVector);
+
+
+    // More checks
+    if(outVector->type.dimen == PS_DIMEN_VECTOR) {
+        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
+
+        if(outVector->n == 0) {
+            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;
+    }
+
+    memcpy(outVector->data.V, inImage->data.V[0], size);
 
     return outVector;
@@ -490,25 +524,46 @@
 psImage *psVectorToMatrix(psImage *outImage, psVector *inVector)
 {
-    int colSize = 0;
+    int size = 0;
 
     // Error checks
     PS_CHECK_NULL_VECTOR(inVector, outImage);
-    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_F32)
+
+    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) {
+            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;
+    }
+
     PS_CHECK_NULL_IMAGE(outImage, outImage);
     PS_CHECK_DIMEN_AND_TYPE(outImage, PS_DIMEN_IMAGE, outImage);
 
-    // More checks
-    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;
-    }
-
-    colSize = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
-    memcpy(outImage->data.V[0], inVector->data.V, colSize);
+    memcpy(outImage->data.V[0], inVector->data.V, size);
 
     return outImage;
Index: /trunk/psLib/src/math/psMatrix.h
===================================================================
--- /trunk/psLib/src/math/psMatrix.h	(revision 907)
+++ /trunk/psLib/src/math/psMatrix.h	(revision 908)
@@ -9,6 +9,4 @@
  *      Matrix inversion
  *      Calculate determinant
- *      Matrix addition
- *      Matrix subtraction
  *      Matrix multiplication
  *      Calculate Eigenvectors
@@ -17,10 +15,10 @@
  *
  *  These functions treat psImages as if they were matrices, therefore there is no psMatrix. These functions
- *  operate only with psF32 and psF64 data types.
+ *  operate only with the psF64 data type.
  *
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-28 20:52:41 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-08 01:58:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -100,5 +98,5 @@
  *  @return  float: Determinant from psImage.
  */
-float psMatrixDeterminant(
+float* psMatrixDeterminant(
     const psImage *restrict inMatrix    ///< Image used to calculate determinant.
 );
@@ -149,6 +147,7 @@
  *
  *  Converts a 1-d psImage matrix into a vector. If the user specifies NULL as the outVector argument, then it
- *  will automatically be created. The input matrix must be a 1-d column matrix. This function operates only 
- *  with the psF64 data type.
+ *  will automatically be created based on the input image (PS_DIMEN_VECTOR for an input image with 1 col or
+ *  PS_DIMENT_TRANSV for an input image with 1 row). Either the number of rows or the number of colums of the
+ *  input matrix must be 1. This function operates only  with the psF64 data type.
  *
  *  @return  psVector*: Pointer to psVector.
@@ -161,6 +160,8 @@
 /** Convert vector to matrix.
  *
- *  Converts a vector into a 1-d column psImage matrix. If the user specifies NULL as the outImage argument, 
- *  then it will automatically be created. This function operates only with the psF64 data type.  
+ *  Converts a vector into a psImage matrix. If the dimensionality of the vector is PS_DIMEN_VECTOR, then the
+ *  resulting psImage is a 1d column. If the dimensionality of the vector is PS_DIMEN_TRANSV, then the
+ *  resulting psImage is a 1d row. If the user specifies NULL as the outImage argument,  then it will 
+ *  automatically be created. This function operates only with the psF64 data type.  
  *
  *  @return  psVector*: Pointer to psIamge.
Index: /trunk/psLib/test/dataManip/tst_psMatrix07.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 907)
+++ /trunk/psLib/test/dataManip/tst_psMatrix07.c	(revision 908)
@@ -5,12 +5,17 @@
  *  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
+ *     B)  Convert matrix to PS_DIMEN_VECTOR vector
+ *     C)  Attempt to use null image input argument
+ *     D)  Convert matrix to PS_DIMEN_TRANSV vector
+ *     E)  Improper image size
+ *     F)  Convert PS_DIMEN_VECTOR vector to matrix
+ *     G)  Attempt to use null input vector argument
+ *     H)  Convert PS_DIMEN_TRANSV vector to matrix
+ *     I)  Free input and output images and vectors
  *
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-06-02 23:29:39 $
+ *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-06-08 01:56:35 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,14 +27,14 @@
 
 #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");                              \
+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->data.F64[i]);          \
+for(int i=0; i<VECTOR->n; i++) {                    \
+    printf("%f\n", VECTOR->data.F64[i]);            \
 }
 
@@ -39,7 +44,12 @@
 {
     psVector *v1 = NULL;
+    psVector *tempVector = NULL;
+    psImage *tempImage = NULL;
     psImage *m1 = NULL;
     psVector *v2 = NULL;
     psImage *m2 = NULL;
+    psImage *m3 = NULL;
+    psImage *m4 = NULL;
+    psImage *badImage = NULL;
 
 
@@ -50,4 +60,7 @@
     v2 = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     m2 = (psImage*)psImageAlloc(1, 3, PS_TYPE_F64);
+    m3 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
+    m4 = (psImage*)psImageAlloc(3, 1, PS_TYPE_F64);
+    badImage = (psImage*)psImageAlloc(2, 2, PS_TYPE_F64);
     m1->data.F64[0][0] = 0.0;
     m1->data.F64[1][0] = 1.0;
@@ -57,5 +70,10 @@
     v2->data.F64[2] = 2.0;
     v2->n = 3;
+    m4->data.F64[0][0] = 0.0;
+    m4->data.F64[0][1] = 1.0;
+    m4->data.F64[0][2] = 2.0;
     PRINT_MATRIX(m1);
+    printf("\n");
+    PRINT_MATRIX(m4);
     printf("\n");
     PRINT_VECTOR(v2);
@@ -63,19 +81,79 @@
 
 
-    // Test B - Convert matrix to vector
-    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to vector");
-    psMatrixToVector(v1, m1);
+    // Test B - Convert matrix to PS_DIMEN_VECTOR vector
+    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector");
+    tempVector = v1;
+    v1 = psMatrixToVector(v1, m1);
     PRINT_VECTOR(v1);
-    printFooter(stdout, "psMatrix", "Calculate Eigenvectors", true);
+    if(v1->type.dimen != PS_DIMEN_VECTOR) {
+        printf("Error: Resulting image is not PS_DIMEN_VECTOR\n");
+    } else if(v1 != tempVector) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_VECTOR vector", 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 C - Attempt to use null image input argument
+    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null image input argument",
+                            "Invalid operation: inImage or its data is NULL.", 0);
+    v1 = psMatrixToVector(v1, NULL);
+    printFooter(stdout, "psMatrix", "Attempt to use null image input argument", true);
 
 
-    // Test D - Free input and output images
+    // Test D - Convert matrix to PS_DIMEN_TRANSV vector
+    printPositiveTestHeader(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector");
+    v1->type.dimen = PS_DIMEN_TRANSV;
+    psMatrixToVector(v1, m4);
+    PRINT_VECTOR(v1);
+    if(v1->type.dimen != PS_DIMEN_TRANSV) {
+        printf("Error: Resulting image is not PS_DIMEN_TRANSV\n");
+    } else if(v1 != tempVector) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psMatrix", "Convert matrix to PS_DIMEN_TRANSV vector", true);
+
+
+    // Test E - Improper image size
+    printNegativeTestHeader(stdout,"psMatrix", "Improper image size",
+                            "Image does not have dim with 1 col or 1 row: (2 x 2).", 0);
+    psMatrixToVector(v1, badImage);
+    printFooter(stdout, "psMatrix", "Improper image size", true);
+
+
+    // Test F - Convert PS_DIMEN_VECTOR vector to matrix
+    printPositiveTestHeader(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix");
+    tempImage = m2;
+    m2 = psVectorToMatrix(m2, v2);
+    PRINT_MATRIX(m2);
+    if(m2->type.dimen != PS_DIMEN_IMAGE) {
+        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
+    } else if(m2 != tempImage) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psMatrix", "Convert PS_DIMEN_VECTOR vector to matrix", true);
+
+
+    // Test G - Attempt to use null input vector argument
+    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input vector argument",
+                            "Invalid operation: inVector or its data is NULL.", 0);
+    psVectorToMatrix(m2, NULL);
+    printFooter(stdout, "psMatrix", "Attempt to use null input vector argument", true);
+
+
+    // Test H - Convert PS_DIMEN_TRANSV vector to matrix
+    printPositiveTestHeader(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix");
+    v2->type.dimen = PS_DIMEN_TRANSV;
+    tempImage = m3;
+    psVectorToMatrix(m3, v2);
+    PRINT_MATRIX(m3);
+    if(m3->type.dimen != PS_DIMEN_IMAGE) {
+        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
+    } else if(m3 != tempImage) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psMatrix", "Convert PS_DIMEN_TRANSV vector to matrix", true);
+
+
+    // Test I - Free input and output images
     printPositiveTestHeader(stdout, "psMatrix", "Free input and output images and vectors");
     psImageFree(m1);
@@ -83,4 +161,7 @@
     psImageFree(m2);
     psVectorFree(v2);
+    psImageFree(m3);
+    psImageFree(m4);
+    psImageFree(badImage);
     psMemCheckLeaks(0, NULL, stdout);
     int nBad = psMemCheckCorruption(0);
Index: /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr
===================================================================
--- /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr	(revision 908)
+++ /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stderr	(revision 908)
@@ -0,0 +1,3 @@
+ <DATE> <TIME> <HOST> |E|psMatrixToVector|Invalid operation: inImage or its data is NULL.
+ <DATE> <TIME> <HOST> |E|psMatrixToVector|Image does not have dim with 1 col or 1 row: (2 x 2).
+ <DATE> <TIME> <HOST> |E|psVectorToMatrix|Invalid operation: inVector or its data is NULL.
Index: /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stdout
===================================================================
--- /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stdout	(revision 907)
+++ /trunk/psLib/test/dataManip/verified/tst_psMatrix07.stdout	(revision 908)
@@ -9,4 +9,6 @@
 2.000000 
 
+0.000000 1.000000 2.000000 
+
 0.000000
 1.000000
@@ -17,5 +19,5 @@
 /----------------------------- TESTPOINT ------------------------------------------\
 |             TestFile: tst_psMatrix07.c                                           |
-|            TestPoint: psMatrix{Convert matrix to vector}                         |
+|            TestPoint: psMatrix{Convert matrix to PS_DIMEN_VECTOR vector}         |
 |             TestType: Positive                                                   |
 \----------------------------------------------------------------------------------/
@@ -25,9 +27,43 @@
 2.000000
 
----> TESTPOINT PASSED (psMatrix{Calculate Eigenvectors} | tst_psMatrix07.c)
+---> TESTPOINT PASSED (psMatrix{Convert matrix to PS_DIMEN_VECTOR vector} | tst_psMatrix07.c)
 
 /----------------------------- TESTPOINT ------------------------------------------\
 |             TestFile: tst_psMatrix07.c                                           |
-|            TestPoint: psMatrix{Convert vector to matrix}                         |
+|            TestPoint: psMatrix{Attempt to use null image input argument}         |
+|             TestType: Negative                                                   |
+|    ExpectedErrorText: Invalid operation: inImage or its data is NULL.            |
+|  ExpectedStatusValue: 0                                                          |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psMatrix{Attempt to use null image input argument} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Convert matrix to PS_DIMEN_TRANSV vector}         |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+0.000000
+1.000000
+2.000000
+
+---> TESTPOINT PASSED (psMatrix{Convert matrix to PS_DIMEN_TRANSV vector} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Improper image size}                              |
+|             TestType: Negative                                                   |
+|    ExpectedErrorText: Image does not have dim with 1 col or 1 row: (2 x 2).      |
+|  ExpectedStatusValue: 0                                                          |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psMatrix{Improper image size} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Convert PS_DIMEN_VECTOR vector to matrix}         |
 |             TestType: Positive                                                   |
 \----------------------------------------------------------------------------------/
@@ -37,5 +73,26 @@
 2.000000 
 
----> TESTPOINT PASSED (psMatrix{Convert vector to matrix} | tst_psMatrix07.c)
+---> TESTPOINT PASSED (psMatrix{Convert PS_DIMEN_VECTOR vector to matrix} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Attempt to use null input vector argument}        |
+|             TestType: Negative                                                   |
+|    ExpectedErrorText: Invalid operation: inVector or its data is NULL.           |
+|  ExpectedStatusValue: 0                                                          |
+\----------------------------------------------------------------------------------/
+
+
+---> TESTPOINT PASSED (psMatrix{Attempt to use null input vector argument} | tst_psMatrix07.c)
+
+/----------------------------- TESTPOINT ------------------------------------------\
+|             TestFile: tst_psMatrix07.c                                           |
+|            TestPoint: psMatrix{Convert PS_DIMEN_TRANSV vector to matrix}         |
+|             TestType: Positive                                                   |
+\----------------------------------------------------------------------------------/
+
+0.000000 1.000000 2.000000 
+
+---> TESTPOINT PASSED (psMatrix{Convert PS_DIMEN_TRANSV vector to matrix} | tst_psMatrix07.c)
 
 /----------------------------- TESTPOINT ------------------------------------------\
