Index: trunk/psLib/src/dataManip/psMatrix.c
===================================================================
--- trunk/psLib/src/dataManip/psMatrix.c	(revision 2697)
+++ trunk/psLib/src/dataManip/psMatrix.c	(revision 3026)
@@ -20,6 +20,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-11 00:16:38 $
+ *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-17 22:17:29 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -175,5 +175,5 @@
 /*****************************************************************************/
 
-psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage)
+psImage* psMatrixLUD(psImage* outImage, psVector** outPerm, psImage* inImage)
 {
     psS32 signum = 0;
@@ -190,8 +190,6 @@
     PS_CHECK_POINTERS(inImage, outImage, outImage);
     PS_CHECK_DIMEN_AND_TYPE(inImage, PS_DIMEN_IMAGE, outImage);
-    PS_VECTOR_CHECK_NULL_GENERAL(outPerm, psMatrixLUD_EXIT);
-    PS_CHECK_DIMEN_AND_TYPE(outPerm, PS_DIMEN_VECTOR, outImage);
+    PS_PTR_CHECK_NULL_GENERAL(outPerm, psMatrixLUD_EXIT);
     psImageRecycle(outImage, inImage->numCols, inImage->numRows, inImage->type.type);
-    psVectorRecycle(outPerm, inImage->numRows, inImage->type.type);
     PS_CHECK_SQUARE(inImage, outImage);
     PS_CHECK_SQUARE(outImage, outImage);
@@ -203,6 +201,17 @@
     // Initialize GSL data
     perm.size = numCols;
-    outPerm->n = numCols;
-    perm.data = outPerm->data.V;
+    if (sizeof(size_t) == 4) {
+        *outPerm = psVectorRecycle(*outPerm, numCols, PS_TYPE_S32);
+    } else if (sizeof(size_t) == 8) {
+        *outPerm = psVectorRecycle(*outPerm, numCols, PS_TYPE_S64);
+    } else {
+        psError(PS_ERR_UNKNOWN, true,
+                "Failed to allocate the permutation vector; "
+                "could not determine the cooresponding data type.");
+        psMatrixLUD_EXIT;
+    }
+
+    (*outPerm)->n = numCols;
+    perm.data = (*outPerm)->data.V;
     lu = gsl_matrix_alloc(numRows, numCols);
 
@@ -244,5 +253,4 @@
     PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outVector);
     PS_VECTOR_CHECK_NULL(inPerm, outVector);
-    PS_CHECK_DIMEN_AND_TYPE(inPerm, PS_DIMEN_VECTOR, outVector);
     psVectorRecycle(outVector, inImage->numRows, inImage->type.type);
 
