Index: /trunk/psLib/src/collections/Makefile
===================================================================
--- /trunk/psLib/src/collections/Makefile	(revision 1232)
+++ /trunk/psLib/src/collections/Makefile	(revision 1233)
@@ -3,6 +3,6 @@
 ##  Makefile:   collections
 ##
-##  $Revision: 1.24 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-07-15 22:18:02 $
+##  $Revision: 1.25 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-07-15 23:52:33 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -32,5 +32,4 @@
 SRC_OBJS = psBitSet.o \
            psVector.o \
-           psSort.o \
            psImage.o \
            psList.o \
Index: unk/psLib/src/collections/psSort.c
===================================================================
--- /trunk/psLib/src/collections/psSort.c	(revision 1232)
+++ 	(revision )
@@ -1,248 +1,0 @@
-/** @file  psSort.c
- *
- *  @brief Sorts vectors
- *
- *  The psSort functions use the qsort() stdlib function with a user-defined callback to sort an vector of
- *  floats. The qsort function requires the starting point of the vector, number of elements in the vector, size
- *  of each element, and a pointer to a callback comparison function. Once called, qsort() will sort the vector
- *  contents in ascending order according to the comparison function. The comparison function is called with
- *  two arguments that point to the objects being compared - in this case two floats. The comparison function
- *  must return an integer less than, equal to, or greater than zero if the first argument is considered to be
- *  respectively less than, equal to, or greater than the second. If two members compare as equal, their order
- *  in the sorted vector is undefined.
- *
- *  @author Ross Harman, MHPCC
- *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-23 23:00:15 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-
-/******************************************************************************/
-/*  INCLUDE FILES                                                             */
-/******************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <float.h>
-
-#include "psVector.h"
-#include "psSort.h"
-#include "psError.h"
-#include "psMemory.h"
-
-/******************************************************************************/
-/*  DEFINE STATEMENTS                                                         */
-/******************************************************************************/
-
-// None
-
-/******************************************************************************/
-/*  TYPE DEFINITIONS                                                          */
-/******************************************************************************/
-
-// None
-
-/*****************************************************************************/
-/*  GLOBAL VARIABLES                                                         */
-/*****************************************************************************/
-
-// None
-
-/*****************************************************************************/
-/*  FILE STATIC VARIABLES                                                    */
-/*****************************************************************************/
-
-// None
-
-/*****************************************************************************/
-/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-
-/** Private callback comparison function to compare two floats.
- *
- *  The comparison function is called by qsort() with two arguments that point to the objects being
- *  compared. The comparison function must return an integer less than, equal to, or greater than zero if
- *  the first argument is considered to be respectively less than, equal to, or greater than the second.
- *
- *  @return  int: Result of comparsion (-1, 0, or 1).
- */
-#define PS_COMPARE(TYPE)                                                                                     \
-static int psCompare##TYPE(const void *x, const void *y)                                                     \
-{                                                                                                            \
-    ps##TYPE *item1 = NULL;                                                                                  \
-    ps##TYPE *item2 = NULL;                                                                                  \
-    \
-    if(x == NULL || y == NULL) {                                                                             \
-        psError(__func__, " : Line %d - Null input argument: x=%d y=%d\n", __LINE__, x, y);                  \
-    }                                                                                                        \
-    \
-    item1 = (ps##TYPE *)x;                                                                                   \
-    item2 = (ps##TYPE *)y;                                                                                   \
-    \
-    if(item1 == NULL || item2 == NULL) {                                                                     \
-        psError(__func__, " : Line %d - Improper cast to float: item1=%d item2=%d\n", __LINE__, item1,       \
-                item2);                                                                                      \
-    }                                                                                                        \
-    \
-    if(*item1 < *item2) {                                                                                    \
-        return -1;                                                                                           \
-    } else if(*item1 > *item2) {                                                                             \
-        return 1;                                                                                            \
-    } else {                                                                                                 \
-        return 0;                                                                                            \
-    }                                                                                                        \
-}
-
-PS_COMPARE(U8)
-PS_COMPARE(U16)
-PS_COMPARE(F32)
-PS_COMPARE(F64)
-
-/*****************************************************************************/
-/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-psVector *psSort(psVector *restrict outVector, const psVector *restrict inVector)
-{
-    int inN = 0;
-    int outN = 0;
-    int elSize = 0;
-    void *inVec = NULL;
-    void *outVec = NULL;
-    psElemType inType = 0;
-
-    if(inVector == NULL) {
-        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
-        return outVector;
-    }
-
-    inType = inVector->type.type;
-    inN = inVector->n;
-    inVec = inVector->data.V;
-    elSize = PSELEMTYPE_SIZEOF(inType);
-
-    if(outVector == NULL) {
-        outVector = psVectorAlloc(inN, inType);
-        outVector->n = inVector->n;
-    }
-
-    outN = outVector->n;
-    outVec = outVector->data.V;
-
-    if(inN != outN) {
-        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
-                inN, outN);
-        return outVector;
-    }
-
-    if(inN == 0) {
-        psError(__func__, " : Line %d - No elements in use for input vector\n", __LINE__);
-        return outVector;
-    }
-
-    if(outN == 0) {
-        psError(__func__, " : Line %d - No elements in use for output vector\n", __LINE__);
-        return outVector;
-    }
-
-    // Copy input vector values into output vector
-    memcpy(outVec, inVec, elSize*outN);
-
-    // Sort output vector
-    switch(inType) {
-    case PS_TYPE_U8:
-        qsort(outVec, inN, elSize, psCompareU8);
-        break;
-    case PS_TYPE_U16:
-        qsort(outVec, inN, elSize, psCompareU16);
-        break;
-    case PS_TYPE_F32:
-        qsort(outVec, inN, elSize, psCompareF32);
-        break;
-    case PS_TYPE_F64:
-        qsort(outVec, inN, elSize, psCompareF64);
-        break;
-    default:
-        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
-    }
-
-    return outVector;
-}
-
-#define SORT_INDICES(TYPE)                                                                                   \
-for(i=0; i<inN; i++) {                                                                                       \
-    for(j=0; j<inN; j++) {                                                                                   \
-        diff = fabs((double)tmpVector->data.TYPE[i] - inVec[j]);                                             \
-        if(diff < FLT_EPSILON) {                                                                             \
-            outVec[i] = j;                                                                                   \
-            break;                                                                                           \
-        }                                                                                                    \
-    }                                                                                                        \
-}
-
-psVector *psSortIndex(psVector *restrict outVector, const psVector *restrict inVector)
-{
-    int inN = 0;
-    int outN = 0;
-    int i = 0;
-    int j = 0;
-    float *inVec = NULL;
-    int *outVec = NULL;
-    double diff = 0.0f;
-    psVector *tmpVector = NULL;
-    psElemType inType = 0;
-
-    if(inVector == NULL) {
-        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
-        return outVector;
-    }
-
-    inN = inVector->n;
-    inVec = inVector->data.V;
-    inType = inVector->type.type;
-
-    if(outVector == NULL) {
-        outVector = psVectorAlloc(inN, PS_TYPE_U32);
-        outVector->n = inN;
-    }
-
-    outN = outVector->n;
-    outVec = outVector->data.V;
-
-    if(inN != outN) {
-        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
-                __LINE__, inN, outN);
-        return outVector;
-    }
-
-    tmpVector = psVectorAlloc(inN, inType);
-    tmpVector->n = inN;
-    tmpVector = psSort(tmpVector, inVector);
-
-    // Sort output vector
-    switch(inType) {
-    case PS_TYPE_U8:
-        SORT_INDICES(U8);
-        break;
-    case PS_TYPE_U16:
-        SORT_INDICES(U16);
-        break;
-    case PS_TYPE_F32:
-        SORT_INDICES(F32);
-        break;
-    case PS_TYPE_F64:
-        SORT_INDICES(F64);
-        break;
-    default:
-        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
-    }
-
-    // Free temp memory
-    psFree(tmpVector);
-
-    return outVector;
-}
Index: unk/psLib/src/collections/psSort.d
===================================================================
--- /trunk/psLib/src/collections/psSort.d	(revision 1232)
+++ 	(revision )
@@ -1,2 +1,0 @@
-psSort.o psSort.d : psSort.c psVector.h psType.h psSort.h ../sysUtils/psError.h \
-  ../sysUtils/psMemory.h
Index: unk/psLib/src/collections/psSort.h
===================================================================
--- /trunk/psLib/src/collections/psSort.h	(revision 1232)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/** @file  psSort.h
- *
- *  @brief Sorts vectors
- *
- *  The psSort functions use the qsort() stdlib function with a user-defined callback to sort an array of
- *  floats. The qsort function requires the starting point of the array, number of elements in the array, size
- *  of each element, and a pointer to a callback comparison function. Once called, qsort() will sort the array
- *  contents in ascending order according to the comparison function. The comparison function is called with
- *  two arguments that point to the objects being compared - in this case two floats. The comparison function
- *  must return an integer less than, equal to, or greater than zero if the first argument is considered to be
- *  respectively less than, equal to, or greater than the second. If two members compare as equal, their order
- *  in the sorted array is undefined.
- *
- *  @ingroup Sort
- *
- *  @author Ross Harman, MHPCC
- *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- */
-
-#ifndef PSSORT_H
-#define PSSORT_H
-
-/// @addtogroup Sort
-/// @{
-
-/******************************************************************************/
-/*  DEFINE STATEMENTS                                                         */
-/******************************************************************************/
-
-// None
-
-/******************************************************************************/
-/*  TYPE DEFINITIONS                                                          */
-/******************************************************************************/
-
-// None
-
-/*****************************************************************************/
-/* FUNCTION PROTOTYPES                                                       */
-/*****************************************************************************/
-
-/** Sort an array of floats.
- *
- *  Sorts an array of floats in ascendin order with the qsort() stdlib function.
- *
- *  @return  psFloatArray*: Pointer to sorted psFloatArray.
- */
-
-psVector *psSort(psVector *restrict outVector, const psVector *restrict inVector);
-
-/** Creates an array of indices based on sort odred of float array.
- *
- *  Sorts an array of floats and creates an integer array holding indices of sorted float values based on
- *  pre-sort index positions.
- *
- *  @return  psIntArray*: Pointer to psIntArray of sorted indices.
- */
-
-psVector *psSortIndex(psVector *restrict outVector, const psVector *restrict inVector);
-
-/// @}
-
-#endif
Index: /trunk/psLib/src/collections/psVector.c
===================================================================
--- /trunk/psLib/src/collections/psVector.c	(revision 1232)
+++ /trunk/psLib/src/collections/psVector.c	(revision 1233)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:33 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,8 +17,13 @@
 /*  INCLUDE FILES                                                             */
 /******************************************************************************/
+#include <string.h>        // for memcpy
+#include <stdlib.h>
+#include <math.h>
+
 #include "psMemory.h"
 #include "psError.h"
 #include "psVector.h"
 #include "psLogMsg.h"
+#include "psCompare.h"
 
 /******************************************************************************/
@@ -143,4 +148,181 @@
 }
 
+psVector *psVectorSort(psVector *restrict outVector, const psVector *restrict inVector)
+{
+    int inN = 0;
+    int outN = 0;
+    int elSize = 0;
+    void *inVec = NULL;
+    void *outVec = NULL;
+    psElemType inType = 0;
+
+    if(inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
+        return outVector;
+    }
+
+    inType = inVector->type.type;
+    inN = inVector->n;
+    inVec = inVector->data.V;
+    elSize = PSELEMTYPE_SIZEOF(inType);
+
+    if(outVector == NULL) {
+        outVector = psVectorAlloc(inN, inType);
+        outVector->n = inVector->n;
+    }
+
+    outN = outVector->n;
+    outVec = outVector->data.V;
+
+    if(inN != outN) {
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
+                inN, outN);
+        return outVector;
+    }
+
+    if(inN == 0) {
+        psError(__func__, " : Line %d - No elements in use for input vector\n", __LINE__);
+        return outVector;
+    }
+
+    if(outN == 0) {
+        psError(__func__, " : Line %d - No elements in use for output vector\n", __LINE__);
+        return outVector;
+    }
+
+    // Copy input vector values into output vector
+    memcpy(outVec, inVec, elSize*outN);
+
+    // Sort output vector
+    switch(inType) {
+    case PS_TYPE_U8:
+        qsort(outVec, inN, elSize, psCompareU8);
+        break;
+    case PS_TYPE_U16:
+        qsort(outVec, inN, elSize, psCompareU16);
+        break;
+    case PS_TYPE_U32:
+        qsort(outVec, inN, elSize, psCompareU32);
+        break;
+    case PS_TYPE_U64:
+        qsort(outVec, inN, elSize, psCompareU64);
+        break;
+    case PS_TYPE_S8:
+        qsort(outVec, inN, elSize, psCompareS8);
+        break;
+    case PS_TYPE_S16:
+        qsort(outVec, inN, elSize, psCompareS16);
+        break;
+    case PS_TYPE_S32:
+        qsort(outVec, inN, elSize, psCompareS32);
+        break;
+    case PS_TYPE_S64:
+        qsort(outVec, inN, elSize, psCompareS64);
+        break;
+    case PS_TYPE_F32:
+        qsort(outVec, inN, elSize, psCompareF32);
+        break;
+    case PS_TYPE_F64:
+        qsort(outVec, inN, elSize, psCompareF64);
+        break;
+    default:
+        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
+    }
+
+    return outVector;
+}
+
+#define SORT_INDICES(TYPE)                                                                                   \
+for(i=0; i<inN; i++) {                                                                                       \
+    for(j=0; j<inN; j++) {                                                                                   \
+        diff = fabs((double)tmpVector->data.TYPE[i] - inVec[j]);                                             \
+        if(diff < FLT_EPSILON) {                                                                             \
+            outVec[i] = j;                                                                                   \
+            break;                                                                                           \
+        }                                                                                                    \
+    }                                                                                                        \
+}
+
+psVector *psVectorSortIndex(psVector *restrict outVector, const psVector *restrict inVector)
+{
+    int inN = 0;
+    int outN = 0;
+    int i = 0;
+    int j = 0;
+    float *inVec = NULL;
+    int *outVec = NULL;
+    double diff = 0.0f;
+    psVector *tmpVector = NULL;
+    psElemType inType = 0;
+
+    if(inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
+        return outVector;
+    }
+
+    inN = inVector->n;
+    inVec = inVector->data.V;
+    inType = inVector->type.type;
+
+    if(outVector == NULL) {
+        outVector = psVectorAlloc(inN, PS_TYPE_U32);
+        outVector->n = inN;
+    }
+
+    outN = outVector->n;
+    outVec = outVector->data.V;
+
+    if(inN != outN) {
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
+                __LINE__, inN, outN);
+        return outVector;
+    }
+
+    tmpVector = psVectorAlloc(inN, inType);
+    tmpVector->n = inN;
+    tmpVector = psVectorSort(tmpVector, inVector);
+
+    // Sort output vector
+    switch(inType) {
+    case PS_TYPE_U8:
+        SORT_INDICES(U8);
+        break;
+    case PS_TYPE_U16:
+        SORT_INDICES(U16);
+        break;
+    case PS_TYPE_U32:
+        SORT_INDICES(U32);
+        break;
+    case PS_TYPE_U64:
+        SORT_INDICES(U64);
+        break;
+    case PS_TYPE_S8:
+        SORT_INDICES(S8);
+        break;
+    case PS_TYPE_S16:
+        SORT_INDICES(S16);
+        break;
+    case PS_TYPE_S32:
+        SORT_INDICES(S32);
+        break;
+    case PS_TYPE_S64:
+        SORT_INDICES(S64);
+        break;
+    case PS_TYPE_F32:
+        SORT_INDICES(F32);
+        break;
+    case PS_TYPE_F64:
+        SORT_INDICES(F64);
+        break;
+    default:
+        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
+    }
+
+    // Free temp memory
+    psFree(tmpVector);
+
+    return outVector;
+}
+
 static void vectorFree(psVector *restrict psVec)
 {
Index: /trunk/psLib/src/collections/psVector.d
===================================================================
--- /trunk/psLib/src/collections/psVector.d	(revision 1232)
+++ /trunk/psLib/src/collections/psVector.d	(revision 1233)
@@ -1,2 +1,2 @@
 psVector.o psVector.d : psVector.c ../sysUtils/psMemory.h ../sysUtils/psError.h \
-  psVector.h psType.h ../sysUtils/psLogMsg.h
+  psVector.h psType.h ../sysUtils/psLogMsg.h psCompare.h
Index: /trunk/psLib/src/collections/psVector.h
===================================================================
--- /trunk/psLib/src/collections/psVector.h	(revision 1232)
+++ /trunk/psLib/src/collections/psVector.h	(revision 1233)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:33 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -99,4 +99,31 @@
 );
 
+/** Sort an array of floats.
+ *
+ *  Sorts an array of floats in ascending order.  This function is valid for
+ *  all non-complex data types.
+ *
+ *  @return  psFloatArray*: Pointer to sorted psFloatArray.
+ */
+
+psVector *psVectorSort(
+    psVector *restrict outVector,  ///< the output vector to recycle, or NULL if new vector desired.
+    const psVector *restrict inVector ///< the vector to sort.
+);
+
+/** Creates an array of indices based on sort odred of float array.
+ *
+ *  Sorts an array of floats and creates an integer array holding indices of 
+ *  sorted float values based on pre-sort index positions.  
+ *
+ *  @return  psIntArray*: Pointer to psIntArray of sorted indices.
+ */
+
+psVector *psVectorSortIndex(
+    psVector *restrict outVector,
+    const psVector *restrict inVector
+);
+
+
 /// @}
 
Index: /trunk/psLib/src/dataManip/psFunctions.c
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.c	(revision 1232)
+++ /trunk/psLib/src/dataManip/psFunctions.c	(revision 1233)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-23 23:00:15 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,5 +28,4 @@
 #include "psAbort.h"
 #include "psFunctions.h"
-#include "psSort.h"
 
 #include "float.h"
Index: /trunk/psLib/src/dataManip/psFunctions.d
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.d	(revision 1232)
+++ /trunk/psLib/src/dataManip/psFunctions.d	(revision 1233)
@@ -1,4 +1,3 @@
 psFunctions.o psFunctions.d : psFunctions.c ../sysUtils/psMemory.h \
   ../collections/psVector.h ../collections/psType.h ../sysUtils/psTrace.h \
-  ../sysUtils/psError.h ../sysUtils/psAbort.h psFunctions.h \
-  ../collections/psSort.h
+  ../sysUtils/psError.h ../sysUtils/psAbort.h psFunctions.h
Index: /trunk/psLib/src/dataManip/psMinimize.c
===================================================================
--- /trunk/psLib/src/dataManip/psMinimize.c	(revision 1232)
+++ /trunk/psLib/src/dataManip/psMinimize.c	(revision 1233)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-08 20:50:46 $
+ *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -38,5 +38,4 @@
 #include "psAbort.h"
 #include "psFunctions.h"
-#include "psSort.h"
 #include "psMinimize.h"
 #include "psMatrix.h"
Index: /trunk/psLib/src/dataManip/psMinimize.d
===================================================================
--- /trunk/psLib/src/dataManip/psMinimize.d	(revision 1232)
+++ /trunk/psLib/src/dataManip/psMinimize.d	(revision 1233)
@@ -2,4 +2,3 @@
   ../collections/psVector.h ../collections/psType.h \
   ../collections/psImage.h ../sysUtils/psTrace.h ../sysUtils/psError.h \
-  ../sysUtils/psAbort.h psFunctions.h ../collections/psSort.h \
-  psMinimize.h psMatrix.h
+  ../sysUtils/psAbort.h psFunctions.h psMinimize.h psMatrix.h
Index: /trunk/psLib/src/dataManip/psStats.c
===================================================================
--- /trunk/psLib/src/dataManip/psStats.c	(revision 1232)
+++ /trunk/psLib/src/dataManip/psStats.c	(revision 1233)
@@ -12,5 +12,4 @@
 #include "psAbort.h"
 #include "psStats.h"
-#include "psSort.h"
 
 #include "float.h"
@@ -672,5 +671,5 @@
     }
     // Sort the temporary vectors.
-    psSort(sortedVector, unsortedVector);
+    psVectorSort(sortedVector, unsortedVector);
 
     // Calculate the median exactly.
@@ -828,5 +827,5 @@
 
     // Sort the temporary vectors.
-    psSort(sortedVector, unsortedVector);
+    psVectorSort(sortedVector, unsortedVector);
 
     // Calculate the quartile points exactly.
Index: /trunk/psLib/src/dataManip/psStats.d
===================================================================
--- /trunk/psLib/src/dataManip/psStats.d	(revision 1232)
+++ /trunk/psLib/src/dataManip/psStats.d	(revision 1233)
@@ -1,3 +1,3 @@
 psStats.o psStats.d : psStats.c ../sysUtils/psMemory.h ../collections/psVector.h \
   ../collections/psType.h ../sysUtils/psTrace.h ../sysUtils/psError.h \
-  ../sysUtils/psAbort.h psStats.h ../collections/psSort.h
+  ../sysUtils/psAbort.h psStats.h
Index: /trunk/psLib/src/image/psImageStats.c
===================================================================
--- /trunk/psLib/src/image/psImageStats.c	(revision 1232)
+++ /trunk/psLib/src/image/psImageStats.c	(revision 1233)
@@ -11,5 +11,4 @@
 #include "psAbort.h"
 #include "psStats.h"
-#include "psSort.h"
 #include "psImage.h"
 #include "psFunctions.h"
Index: /trunk/psLib/src/image/psImageStats.d
===================================================================
--- /trunk/psLib/src/image/psImageStats.d	(revision 1232)
+++ /trunk/psLib/src/image/psImageStats.d	(revision 1233)
@@ -2,3 +2,3 @@
   ../collections/psVector.h ../collections/psType.h ../sysUtils/psTrace.h \
   ../sysUtils/psError.h ../sysUtils/psAbort.h psStats.h \
-  ../collections/psSort.h ../collections/psImage.h psFunctions.h
+  ../collections/psImage.h psFunctions.h
Index: /trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.c	(revision 1232)
+++ /trunk/psLib/src/imageops/psImageStats.c	(revision 1233)
@@ -11,5 +11,4 @@
 #include "psAbort.h"
 #include "psStats.h"
-#include "psSort.h"
 #include "psImage.h"
 #include "psFunctions.h"
Index: /trunk/psLib/src/math/psMinimize.c
===================================================================
--- /trunk/psLib/src/math/psMinimize.c	(revision 1232)
+++ /trunk/psLib/src/math/psMinimize.c	(revision 1233)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-08 20:50:46 $
+ *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -38,5 +38,4 @@
 #include "psAbort.h"
 #include "psFunctions.h"
-#include "psSort.h"
 #include "psMinimize.h"
 #include "psMatrix.h"
Index: /trunk/psLib/src/math/psPolynomial.c
===================================================================
--- /trunk/psLib/src/math/psPolynomial.c	(revision 1232)
+++ /trunk/psLib/src/math/psPolynomial.c	(revision 1233)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-23 23:00:15 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,5 +28,4 @@
 #include "psAbort.h"
 #include "psFunctions.h"
-#include "psSort.h"
 
 #include "float.h"
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 1232)
+++ /trunk/psLib/src/math/psSpline.c	(revision 1233)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-23 23:00:15 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,5 +28,4 @@
 #include "psAbort.h"
 #include "psFunctions.h"
-#include "psSort.h"
 
 #include "float.h"
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 1232)
+++ /trunk/psLib/src/math/psStats.c	(revision 1233)
@@ -12,5 +12,4 @@
 #include "psAbort.h"
 #include "psStats.h"
-#include "psSort.h"
 
 #include "float.h"
@@ -672,5 +671,5 @@
     }
     // Sort the temporary vectors.
-    psSort(sortedVector, unsortedVector);
+    psVectorSort(sortedVector, unsortedVector);
 
     // Calculate the median exactly.
@@ -828,5 +827,5 @@
 
     // Sort the temporary vectors.
-    psSort(sortedVector, unsortedVector);
+    psVectorSort(sortedVector, unsortedVector);
 
     // Calculate the quartile points exactly.
Index: /trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.c	(revision 1232)
+++ /trunk/psLib/src/mathtypes/psVector.c	(revision 1233)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:33 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,8 +17,13 @@
 /*  INCLUDE FILES                                                             */
 /******************************************************************************/
+#include <string.h>        // for memcpy
+#include <stdlib.h>
+#include <math.h>
+
 #include "psMemory.h"
 #include "psError.h"
 #include "psVector.h"
 #include "psLogMsg.h"
+#include "psCompare.h"
 
 /******************************************************************************/
@@ -143,4 +148,181 @@
 }
 
+psVector *psVectorSort(psVector *restrict outVector, const psVector *restrict inVector)
+{
+    int inN = 0;
+    int outN = 0;
+    int elSize = 0;
+    void *inVec = NULL;
+    void *outVec = NULL;
+    psElemType inType = 0;
+
+    if(inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
+        return outVector;
+    }
+
+    inType = inVector->type.type;
+    inN = inVector->n;
+    inVec = inVector->data.V;
+    elSize = PSELEMTYPE_SIZEOF(inType);
+
+    if(outVector == NULL) {
+        outVector = psVectorAlloc(inN, inType);
+        outVector->n = inVector->n;
+    }
+
+    outN = outVector->n;
+    outVec = outVector->data.V;
+
+    if(inN != outN) {
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
+                inN, outN);
+        return outVector;
+    }
+
+    if(inN == 0) {
+        psError(__func__, " : Line %d - No elements in use for input vector\n", __LINE__);
+        return outVector;
+    }
+
+    if(outN == 0) {
+        psError(__func__, " : Line %d - No elements in use for output vector\n", __LINE__);
+        return outVector;
+    }
+
+    // Copy input vector values into output vector
+    memcpy(outVec, inVec, elSize*outN);
+
+    // Sort output vector
+    switch(inType) {
+    case PS_TYPE_U8:
+        qsort(outVec, inN, elSize, psCompareU8);
+        break;
+    case PS_TYPE_U16:
+        qsort(outVec, inN, elSize, psCompareU16);
+        break;
+    case PS_TYPE_U32:
+        qsort(outVec, inN, elSize, psCompareU32);
+        break;
+    case PS_TYPE_U64:
+        qsort(outVec, inN, elSize, psCompareU64);
+        break;
+    case PS_TYPE_S8:
+        qsort(outVec, inN, elSize, psCompareS8);
+        break;
+    case PS_TYPE_S16:
+        qsort(outVec, inN, elSize, psCompareS16);
+        break;
+    case PS_TYPE_S32:
+        qsort(outVec, inN, elSize, psCompareS32);
+        break;
+    case PS_TYPE_S64:
+        qsort(outVec, inN, elSize, psCompareS64);
+        break;
+    case PS_TYPE_F32:
+        qsort(outVec, inN, elSize, psCompareF32);
+        break;
+    case PS_TYPE_F64:
+        qsort(outVec, inN, elSize, psCompareF64);
+        break;
+    default:
+        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
+    }
+
+    return outVector;
+}
+
+#define SORT_INDICES(TYPE)                                                                                   \
+for(i=0; i<inN; i++) {                                                                                       \
+    for(j=0; j<inN; j++) {                                                                                   \
+        diff = fabs((double)tmpVector->data.TYPE[i] - inVec[j]);                                             \
+        if(diff < FLT_EPSILON) {                                                                             \
+            outVec[i] = j;                                                                                   \
+            break;                                                                                           \
+        }                                                                                                    \
+    }                                                                                                        \
+}
+
+psVector *psVectorSortIndex(psVector *restrict outVector, const psVector *restrict inVector)
+{
+    int inN = 0;
+    int outN = 0;
+    int i = 0;
+    int j = 0;
+    float *inVec = NULL;
+    int *outVec = NULL;
+    double diff = 0.0f;
+    psVector *tmpVector = NULL;
+    psElemType inType = 0;
+
+    if(inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
+        return outVector;
+    }
+
+    inN = inVector->n;
+    inVec = inVector->data.V;
+    inType = inVector->type.type;
+
+    if(outVector == NULL) {
+        outVector = psVectorAlloc(inN, PS_TYPE_U32);
+        outVector->n = inN;
+    }
+
+    outN = outVector->n;
+    outVec = outVector->data.V;
+
+    if(inN != outN) {
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
+                __LINE__, inN, outN);
+        return outVector;
+    }
+
+    tmpVector = psVectorAlloc(inN, inType);
+    tmpVector->n = inN;
+    tmpVector = psVectorSort(tmpVector, inVector);
+
+    // Sort output vector
+    switch(inType) {
+    case PS_TYPE_U8:
+        SORT_INDICES(U8);
+        break;
+    case PS_TYPE_U16:
+        SORT_INDICES(U16);
+        break;
+    case PS_TYPE_U32:
+        SORT_INDICES(U32);
+        break;
+    case PS_TYPE_U64:
+        SORT_INDICES(U64);
+        break;
+    case PS_TYPE_S8:
+        SORT_INDICES(S8);
+        break;
+    case PS_TYPE_S16:
+        SORT_INDICES(S16);
+        break;
+    case PS_TYPE_S32:
+        SORT_INDICES(S32);
+        break;
+    case PS_TYPE_S64:
+        SORT_INDICES(S64);
+        break;
+    case PS_TYPE_F32:
+        SORT_INDICES(F32);
+        break;
+    case PS_TYPE_F64:
+        SORT_INDICES(F64);
+        break;
+    default:
+        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
+    }
+
+    // Free temp memory
+    psFree(tmpVector);
+
+    return outVector;
+}
+
 static void vectorFree(psVector *restrict psVec)
 {
Index: /trunk/psLib/src/mathtypes/psVector.h
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.h	(revision 1232)
+++ /trunk/psLib/src/mathtypes/psVector.h	(revision 1233)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:33 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -99,4 +99,31 @@
 );
 
+/** Sort an array of floats.
+ *
+ *  Sorts an array of floats in ascending order.  This function is valid for
+ *  all non-complex data types.
+ *
+ *  @return  psFloatArray*: Pointer to sorted psFloatArray.
+ */
+
+psVector *psVectorSort(
+    psVector *restrict outVector,  ///< the output vector to recycle, or NULL if new vector desired.
+    const psVector *restrict inVector ///< the vector to sort.
+);
+
+/** Creates an array of indices based on sort odred of float array.
+ *
+ *  Sorts an array of floats and creates an integer array holding indices of 
+ *  sorted float values based on pre-sort index positions.  
+ *
+ *  @return  psIntArray*: Pointer to psIntArray of sorted indices.
+ */
+
+psVector *psVectorSortIndex(
+    psVector *restrict outVector,
+    const psVector *restrict inVector
+);
+
+
 /// @}
 
Index: /trunk/psLib/src/pslib.h
===================================================================
--- /trunk/psLib/src/pslib.h	(revision 1232)
+++ /trunk/psLib/src/pslib.h	(revision 1233)
@@ -8,6 +8,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:33 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -83,9 +83,4 @@
 #include "psBitSet.h"
 
-/// @defgroup Sort Sorting Functions
-/// @ingroup DataContainer
-#include "psSort.h"
-/// @}
-
 // Data Manipulation
 /// @defgroup DataManip Data Manipulation
Index: /trunk/psLib/src/sys/psMemory.c
===================================================================
--- /trunk/psLib/src/sys/psMemory.c	(revision 1232)
+++ /trunk/psLib/src/sys/psMemory.c	(revision 1233)
@@ -8,6 +8,6 @@
  *  @author Robert Lupton, Princeton University
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-09 02:45:42 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -214,5 +214,5 @@
 }
 
-int psMemCheckCorruption(int abort_on_error)
+int psMemCheckCorruption(bool abort_on_error)
 {
     int nbad = 0;                       // number of bad blocks
Index: /trunk/psLib/src/sys/psMemory.h
===================================================================
--- /trunk/psLib/src/sys/psMemory.h	(revision 1232)
+++ /trunk/psLib/src/sys/psMemory.h	(revision 1233)
@@ -14,6 +14,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-09 02:45:42 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,4 +21,5 @@
 
 #include <stdio.h>                      // needed for FILE
+#include <stdbool.h>
 #include <pthread.h>                    // we need a mutex to make this stuff thread safe.
 
@@ -208,5 +209,5 @@
  */
 int psMemCheckCorruption(
-    int abort_on_error              ///< Abort on detecting corruption?
+    bool abort_on_error              ///< Abort on detecting corruption?
 );
 
Index: /trunk/psLib/src/sysUtils/psMemory.c
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.c	(revision 1232)
+++ /trunk/psLib/src/sysUtils/psMemory.c	(revision 1233)
@@ -8,6 +8,6 @@
  *  @author Robert Lupton, Princeton University
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-09 02:45:42 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -214,5 +214,5 @@
 }
 
-int psMemCheckCorruption(int abort_on_error)
+int psMemCheckCorruption(bool abort_on_error)
 {
     int nbad = 0;                       // number of bad blocks
Index: /trunk/psLib/src/sysUtils/psMemory.h
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.h	(revision 1232)
+++ /trunk/psLib/src/sysUtils/psMemory.h	(revision 1233)
@@ -14,6 +14,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-09 02:45:42 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 23:52:34 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,4 +21,5 @@
 
 #include <stdio.h>                      // needed for FILE
+#include <stdbool.h>
 #include <pthread.h>                    // we need a mutex to make this stuff thread safe.
 
@@ -208,5 +209,5 @@
  */
 int psMemCheckCorruption(
-    int abort_on_error              ///< Abort on detecting corruption?
+    bool abort_on_error              ///< Abort on detecting corruption?
 );
 
Index: /trunk/psLib/test/collections/Makefile
===================================================================
--- /trunk/psLib/test/collections/Makefile	(revision 1232)
+++ /trunk/psLib/test/collections/Makefile	(revision 1233)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/collections
 ##
-##  $Revision: 1.19 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-07-15 22:17:03 $
+##  $Revision: 1.20 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-07-15 23:52:34 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -29,8 +29,8 @@
          tst_psBitSet_07 \
          tst_psBitSet_08 \
-         tst_psSort_01   \
-         tst_psSort_02   \
-         tst_psSort_03   \
-         tst_psSort_04   \
+         tst_psVectorSort_01   \
+         tst_psVectorSort_02   \
+         tst_psVectorSort_03   \
+         tst_psVectorSort_04   \
          tst_psImage     \
          tst_psList
Index: unk/psLib/test/collections/tst_psSort_01.c
===================================================================
--- /trunk/psLib/test/collections/tst_psSort_01.c	(revision 1232)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/** @file  tst_psSort_01.c
- *
- *  @brief Test driver for psSort functions
- *
- *  This test driver contains the following tests for psSort test point 1:
- *     A)  Create float vectors
- *     B)  Sort input float vector and put results into output float vector
- *     C)  Free float vectors
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-06-23 23:00:15 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib.h"
-#include "psTest.h"
-
-int main(int argc,
-         char* argv[])
-{
-    psVector *in = NULL;
-    psVector *out = NULL;
-    psVector *tempVec = NULL;
-
-
-    // Test A - Create float vectors
-    printPositiveTestHeader(stdout,"psSort", "Create float vectors");
-    in = psVectorAlloc(7, PS_TYPE_F32);
-    in->n = 7;
-    out = psVectorAlloc(7, PS_TYPE_F32);
-    out->n = 7;
-    in->data.F32[0] = 7.0f;
-    in->data.F32[1] = 9.0f;
-    in->data.F32[2] = 3.0f;
-    in->data.F32[3] = 1.0f;
-    in->data.F32[4] = 5.0f;
-    in->data.F32[5] = 5.0f;
-    in->data.F32[6] = -20.0f;
-    for(int i=0; i<7; i++) {
-        printf("vec[%d] = %f\n", i, in->data.F32[i]);
-    }
-    printFooter(stdout, "psSort", "Create float vectors", true);
-
-
-    // Test B - Sort input float vector and put results into output float vector
-    printPositiveTestHeader(stdout,"psSort", "Sort float vector");
-    tempVec = out;
-    out = psSort(out, in);
-    for(int i=0; i<7; i++) {
-        printf("vec[%d] = %f\n", i, out->data.F32[i]);
-    }
-    if(out != tempVec) {
-        printf("Error: Return pointer not equal to output argument pointer\n");
-    }
-    printFooter(stdout, "psSort", "Sort float vector", true);
-
-
-    // Test C - Sort input float vector into itself
-    printPositiveTestHeader(stdout,"psSort", "Sort input float vector into itself");
-    in = psSort(in, in);
-    for(int i=0; i<7; i++) {
-        printf("vec[%d] = %f\n", i, out->data.F32[i]);
-    }
-    printFooter(stdout, "psSort", "Sort input float vector into itself", true);
-
-
-    // Test D - Free float vectors
-    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
-    psFree(in);
-    psFree(out);
-    psMemCheckLeaks(0, NULL, stdout);
-    int nBad = psMemCheckCorruption(0);
-    if(nBad) {
-        printf("ERROR: Found %d bad memory blocks\n", nBad);
-    }
-    printFooter(stdout, "psSort", "Free float vectors", true);
-
-    return 0;
-}
Index: unk/psLib/test/collections/tst_psSort_02.c
===================================================================
--- /trunk/psLib/test/collections/tst_psSort_02.c	(revision 1232)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/** @file  tst_psSort_02.c
- *
- *  @brief Test driver for psSort functions
- *
- *  This test driver contains the following tests for psSort test point 2:
- *     A)  Create vectors
- *     B)  Sort integer vector of indices based on pre-sort order of floating point vector
- *     C)  Free vectors
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-06-23 23:00:15 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib.h"
-#include "psTest.h"
-
-int main(int argc,
-         char* argv[])
-{
-    psVector *in = NULL;
-    psVector *out = NULL;
-
-
-    // Test A - Create float vectors
-    printPositiveTestHeader(stdout,"psSort", "Create vectors");
-    in = psVectorAlloc(5, PS_TYPE_F32);
-    in->n = 5;
-    out = psVectorAlloc(5, PS_TYPE_F32);
-    out->n = 5;
-    in->data.F32[0] = 7.0f;
-    in->data.F32[1] = 9.0f;
-    in->data.F32[2] = 3.0f;
-    in->data.F32[3] = 1.0f;
-    in->data.F32[4] = 5.0f;
-    for(int i=0; i<5; i++) {
-        printf("arr[%d] = %f\n", i, in->data.F32[i]);
-    }
-    printFooter(stdout, "psSort", "Create vectors", true);
-
-
-    // Test B - Sort integer vector of indices based on pre-sort order of floating point vector
-    printPositiveTestHeader(stdout,"psSort", "Create sorted index vector");
-    out = psSortIndex(out, in);
-    for(int i=0; i<5; i++) {
-        printf("arr[%d] = %d\n", i, out->data.S32[i]);
-    }
-    printFooter(stdout, "psSort", "Create sorted index vector", true);
-
-
-    // Test C - Free vectors
-    printPositiveTestHeader(stdout,"psSort", "Free vectors");
-    psFree(in);
-    psFree(out);
-    psMemCheckLeaks(0, NULL, stdout);
-    int nBad = psMemCheckCorruption(0);
-    if(nBad) {
-        printf("ERROR: Found %d bad memory blocks\n", nBad);
-    }
-    printFooter(stdout, "psSort", "Free vectors", true);
-
-}
Index: unk/psLib/test/collections/tst_psSort_03.c
===================================================================
--- /trunk/psLib/test/collections/tst_psSort_03.c	(revision 1232)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/** @file  tst_psSort_03.c
- *
- *  @brief Test driver for psSort functions
- *
- *  This test driver contains the following tests for psSort test point 3:
- *     A)  Create float vectors of different sizes
- *     B)  Attempt to sort vectors...should get errors
- *     C)  Free float vectors
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-06-23 23:00:15 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib.h"
-#include "psTest.h"
-
-int main(int argc,
-         char* argv[])
-{
-    psVector *in = NULL;
-    psVector *out = NULL;
-
-
-    // Test A - Create float vectors
-    printPositiveTestHeader(stdout,"psSort", "Create float vectors of different sizes");
-    in = psVectorAlloc(5, PS_TYPE_F32);
-    in->n = 5;
-    out = psVectorAlloc(6, PS_TYPE_F32);
-    out->n = 6;
-    in->n = 5;
-    for(int i=0; i<5; i++) {
-        printf("arr[%d] = %f\n", i, in->data.F32[i]);
-    }
-    printFooter(stdout, "psSort", "Create float vectors of different sizes", true);
-
-
-    // Test B - Sort input float vector and put results into output float vector
-    printNegativeTestHeader(stdout,"psSort", "Sort float vector",
-                            "Input and output vector sizes are not equal", 0);
-    out = psSort(out, in);
-    printFooter(stdout, "psSort", "Sort float vector", true);
-
-
-    // Test C - Free float vectors
-    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
-    psFree(in);
-    psFree(out);
-    psMemCheckLeaks(0, NULL, stdout);
-    int nBad = psMemCheckCorruption(0);
-    if(nBad) {
-        printf("ERROR: Found %d bad memory blocks\n", nBad);
-    }
-    printFooter(stdout, "psSort", "Free float vectors", true);
-
-}
Index: unk/psLib/test/collections/tst_psSort_04.c
===================================================================
--- /trunk/psLib/test/collections/tst_psSort_04.c	(revision 1232)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/** @file  tst_psSort_04.c
- *
- *  @brief Test driver for psSort functions
- *
- *  This test driver contains the following tests for psSort test point 4:
- *     A)  Attempt to sort with null input vector
- *     B)  Free vectors
- *
- *  @author  Ross Harman, MHPCC
- *
- *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-06-23 23:00:15 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
-#include "pslib.h"
-#include "psTest.h"
-
-int main(int argc,
-         char* argv[])
-{
-    psVector *badIn = NULL;
-    psVector *goodOut = psVectorAlloc(5, PS_TYPE_F32);
-
-    // Test A - Attempt to sort with null input vector
-    printNegativeTestHeader(stdout,"psSort", "Attempt to sort with null input vector",
-                            "Null input vector", 0);
-    goodOut = psSort(goodOut, badIn);
-    printFooter(stdout, "psSort", "Attempt to sort with null input vector", true);
-
-    // Test B - Free vectors
-    printPositiveTestHeader(stdout, "psSort", "Free vectors");
-    psFree(goodOut);
-    psMemCheckLeaks(0, NULL, stdout);
-    int nBad = psMemCheckCorruption(0);
-    if(nBad) {
-        printf("ERROR: Found %d bad memory blocks\n", nBad);
-    }
-    printFooter(stdout, "psSort", "Free arays", true);
-
-    return 0;
-}
Index: /trunk/psLib/test/collections/tst_psVector.c
===================================================================
--- /trunk/psLib/test/collections/tst_psVector.c	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVector.c	(revision 1233)
@@ -0,0 +1,107 @@
+/** @file  tst_psVector.c
+ *
+ *  @brief Test driver for psVector integer functions
+ *
+ *  This test driver contains the following tests for psVector test point 1:
+ *     A)  Create S32 vector
+ *     B)  Add data to S32 vector
+ *     C)  Reallocate S32 vector bigger
+ *     D)  Reallocate S32 vector smaller
+ *     E)  Free S32 vector
+ *     F)  Attempt to create a S32 vector with zero size
+ *     G)  Attempt to realloc a null S32 vector
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+
+
+    // Test A - Create S32 vector
+    printPositiveTestHeader(stdout,"psVector", "Create S32 vector");
+    psVector *psVec = psVectorAlloc(5, PS_TYPE_S32);
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector type = %d\n", psVec->type.type);
+    printf("Vector dimen = %d\n", psVec->type.dimen);
+    printFooter(stdout, "psVector", "Create S32 vector", true);
+
+
+    // Test B - Add data to integer vector
+    printPositiveTestHeader(stdout, "psVector", "Add data to S32 vector");
+    for(int i = 0; i < 5; i++) {
+        psVec->data.S32[i] = i*10;
+        printf("Elem %d = %d\n", i, psVec->data.S32[i]);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Add data to S32 vector", true);
+
+
+    // Test C - Reallocate S32 vector bigger
+    printPositiveTestHeader(stdout,"psVector", "Reallocate S32 vector bigger");
+    psVec = psVectorRealloc(10, psVec);
+    printf("Adding more elements to S32 vector...\n");
+    for(int i = 5; i < 10; i++) {
+        psVec->data.S32[i] = i*10;
+        psVec->n++;
+        printf("Elem %d = %d\n", i, psVec->data.S32[i]);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Reallocate S32 vector bigger", true);
+
+
+    // Test D - Reallocate S32 vector smaller
+    printPositiveTestHeader(stdout,"psVector","Reallocate S32 vector smaller");
+    psVec = psVectorRealloc(3, psVec);
+    printf("Vector size = %d\n", psVec->nalloc);
+    for(int i = 0; i < 3; i++) {
+        printf("Elem %d = %d\n", i, psVec->data.S32[i]);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Reallocate integer S32 smaller", true);
+
+
+    // Test E - Free S32 vector
+    printPositiveTestHeader(stdout, "psVector", "Free S32 vector");
+    psFree(psVec);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psVector" ,"Free S32 vector", true);
+
+
+    // Test F - Attempt to create a S32 vector with zero size
+    printNegativeTestHeader(stdout,"psVector", "Attempt to create a S32 vector with zero size",
+                            "Invalid value for nalloc", 0);
+    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error message.");
+    psVector *vecBad = psVectorAlloc(0, PS_TYPE_S32);
+    if(vecBad != NULL) {
+        printf("ERROR: Return is not NULL\n");
+    }
+    printFooter(stdout, "psVector", "Attempt to create a S32 vector with zero size", true);
+
+
+    // Test G - Attempt to realloc a null S32 vector
+    printNegativeTestHeader(stdout,"psVector", "Attempt to realloc a null S32 vector",
+                            "Null input vector", 0);
+    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error message.");
+    psVectorRealloc(6, NULL);
+    printFooter(stdout, "psVector", "Attempt to realloc a null S32 vector", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/tst_psVectorSort_01.c
===================================================================
--- /trunk/psLib/test/collections/tst_psVectorSort_01.c	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVectorSort_01.c	(revision 1233)
@@ -0,0 +1,83 @@
+/** @file  tst_psVectorSort_01.c
+ *
+ *  @brief Test driver for psVectorSort functions
+ *
+ *  This test driver contains the following tests for psVectorSort test point 1:
+ *     A)  Create float vectors
+ *     B)  Sort input float vector and put results into output float vector
+ *     C)  Free float vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *in = NULL;
+    psVector *out = NULL;
+    psVector *tempVec = NULL;
+
+
+    // Test A - Create float vectors
+    printPositiveTestHeader(stdout,"psVectorSort", "Create float vectors");
+    in = psVectorAlloc(7, PS_TYPE_F32);
+    in->n = 7;
+    out = psVectorAlloc(7, PS_TYPE_F32);
+    out->n = 7;
+    in->data.F32[0] = 7.0f;
+    in->data.F32[1] = 9.0f;
+    in->data.F32[2] = 3.0f;
+    in->data.F32[3] = 1.0f;
+    in->data.F32[4] = 5.0f;
+    in->data.F32[5] = 5.0f;
+    in->data.F32[6] = -20.0f;
+    for(int i=0; i<7; i++) {
+        printf("vec[%d] = %f\n", i, in->data.F32[i]);
+    }
+    printFooter(stdout, "psVectorSort", "Create float vectors", true);
+
+
+    // Test B - Sort input float vector and put results into output float vector
+    printPositiveTestHeader(stdout,"psVectorSort", "Sort float vector");
+    tempVec = out;
+    out = psVectorSort(out, in);
+    for(int i=0; i<7; i++) {
+        printf("vec[%d] = %f\n", i, out->data.F32[i]);
+    }
+    if(out != tempVec) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psVectorSort", "Sort float vector", true);
+
+
+    // Test C - Sort input float vector into itself
+    printPositiveTestHeader(stdout,"psVectorSort", "Sort input float vector into itself");
+    in = psVectorSort(in, in);
+    for(int i=0; i<7; i++) {
+        printf("vec[%d] = %f\n", i, out->data.F32[i]);
+    }
+    printFooter(stdout, "psVectorSort", "Sort input float vector into itself", true);
+
+
+    // Test D - Free float vectors
+    printPositiveTestHeader(stdout,"psVectorSort", "Free float vectors");
+    psFree(in);
+    psFree(out);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psVectorSort", "Free float vectors", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/tst_psVectorSort_01.c~
===================================================================
--- /trunk/psLib/test/collections/tst_psVectorSort_01.c~	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVectorSort_01.c~	(revision 1233)
@@ -0,0 +1,83 @@
+/** @file  tst_psSort_01.c
+ *
+ *  @brief Test driver for psSort functions
+ *
+ *  This test driver contains the following tests for psSort test point 1:
+ *     A)  Create float vectors
+ *     B)  Sort input float vector and put results into output float vector
+ *     C)  Free float vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *in = NULL;
+    psVector *out = NULL;
+    psVector *tempVec = NULL;
+
+
+    // Test A - Create float vectors
+    printPositiveTestHeader(stdout,"psSort", "Create float vectors");
+    in = psVectorAlloc(7, PS_TYPE_F32);
+    in->n = 7;
+    out = psVectorAlloc(7, PS_TYPE_F32);
+    out->n = 7;
+    in->data.F32[0] = 7.0f;
+    in->data.F32[1] = 9.0f;
+    in->data.F32[2] = 3.0f;
+    in->data.F32[3] = 1.0f;
+    in->data.F32[4] = 5.0f;
+    in->data.F32[5] = 5.0f;
+    in->data.F32[6] = -20.0f;
+    for(int i=0; i<7; i++) {
+        printf("vec[%d] = %f\n", i, in->data.F32[i]);
+    }
+    printFooter(stdout, "psSort", "Create float vectors", true);
+
+
+    // Test B - Sort input float vector and put results into output float vector
+    printPositiveTestHeader(stdout,"psSort", "Sort float vector");
+    tempVec = out;
+    out = psSort(out, in);
+    for(int i=0; i<7; i++) {
+        printf("vec[%d] = %f\n", i, out->data.F32[i]);
+    }
+    if(out != tempVec) {
+        printf("Error: Return pointer not equal to output argument pointer\n");
+    }
+    printFooter(stdout, "psSort", "Sort float vector", true);
+
+
+    // Test C - Sort input float vector into itself
+    printPositiveTestHeader(stdout,"psSort", "Sort input float vector into itself");
+    in = psSort(in, in);
+    for(int i=0; i<7; i++) {
+        printf("vec[%d] = %f\n", i, out->data.F32[i]);
+    }
+    printFooter(stdout, "psSort", "Sort input float vector into itself", true);
+
+
+    // Test D - Free float vectors
+    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
+    psFree(in);
+    psFree(out);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psSort", "Free float vectors", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/tst_psVectorSort_02.c
===================================================================
--- /trunk/psLib/test/collections/tst_psVectorSort_02.c	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVectorSort_02.c	(revision 1233)
@@ -0,0 +1,66 @@
+/** @file  tst_psVectorSort_02.c
+ *
+ *  @brief Test driver for psVectorSort functions
+ *
+ *  This test driver contains the following tests for psVectorSort test point 2:
+ *     A)  Create vectors
+ *     B)  Sort integer vector of indices based on pre-sort order of floating point vector
+ *     C)  Free vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *in = NULL;
+    psVector *out = NULL;
+
+
+    // Test A - Create float vectors
+    printPositiveTestHeader(stdout,"psVectorSort", "Create vectors");
+    in = psVectorAlloc(5, PS_TYPE_F32);
+    in->n = 5;
+    out = psVectorAlloc(5, PS_TYPE_F32);
+    out->n = 5;
+    in->data.F32[0] = 7.0f;
+    in->data.F32[1] = 9.0f;
+    in->data.F32[2] = 3.0f;
+    in->data.F32[3] = 1.0f;
+    in->data.F32[4] = 5.0f;
+    for(int i=0; i<5; i++) {
+        printf("arr[%d] = %f\n", i, in->data.F32[i]);
+    }
+    printFooter(stdout, "psVectorSort", "Create vectors", true);
+
+
+    // Test B - Sort integer vector of indices based on pre-sort order of floating point vector
+    printPositiveTestHeader(stdout,"psVectorSort", "Create sorted index vector");
+    out = psVectorSortIndex(out, in);
+    for(int i=0; i<5; i++) {
+        printf("arr[%d] = %d\n", i, out->data.S32[i]);
+    }
+    printFooter(stdout, "psVectorSort", "Create sorted index vector", true);
+
+
+    // Test C - Free vectors
+    printPositiveTestHeader(stdout,"psVectorSort", "Free vectors");
+    psFree(in);
+    psFree(out);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psVectorSort", "Free vectors", true);
+
+}
Index: /trunk/psLib/test/collections/tst_psVectorSort_02.c~
===================================================================
--- /trunk/psLib/test/collections/tst_psVectorSort_02.c~	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVectorSort_02.c~	(revision 1233)
@@ -0,0 +1,66 @@
+/** @file  tst_psSort_02.c
+ *
+ *  @brief Test driver for psSort functions
+ *
+ *  This test driver contains the following tests for psSort test point 2:
+ *     A)  Create vectors
+ *     B)  Sort integer vector of indices based on pre-sort order of floating point vector
+ *     C)  Free vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *in = NULL;
+    psVector *out = NULL;
+
+
+    // Test A - Create float vectors
+    printPositiveTestHeader(stdout,"psSort", "Create vectors");
+    in = psVectorAlloc(5, PS_TYPE_F32);
+    in->n = 5;
+    out = psVectorAlloc(5, PS_TYPE_F32);
+    out->n = 5;
+    in->data.F32[0] = 7.0f;
+    in->data.F32[1] = 9.0f;
+    in->data.F32[2] = 3.0f;
+    in->data.F32[3] = 1.0f;
+    in->data.F32[4] = 5.0f;
+    for(int i=0; i<5; i++) {
+        printf("arr[%d] = %f\n", i, in->data.F32[i]);
+    }
+    printFooter(stdout, "psSort", "Create vectors", true);
+
+
+    // Test B - Sort integer vector of indices based on pre-sort order of floating point vector
+    printPositiveTestHeader(stdout,"psSort", "Create sorted index vector");
+    out = psSortIndex(out, in);
+    for(int i=0; i<5; i++) {
+        printf("arr[%d] = %d\n", i, out->data.S32[i]);
+    }
+    printFooter(stdout, "psSort", "Create sorted index vector", true);
+
+
+    // Test C - Free vectors
+    printPositiveTestHeader(stdout,"psSort", "Free vectors");
+    psFree(in);
+    psFree(out);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psSort", "Free vectors", true);
+
+}
Index: /trunk/psLib/test/collections/tst_psVectorSort_03.c
===================================================================
--- /trunk/psLib/test/collections/tst_psVectorSort_03.c	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVectorSort_03.c	(revision 1233)
@@ -0,0 +1,60 @@
+/** @file  tst_psVectorSort_03.c
+ *
+ *  @brief Test driver for psVectorSort functions
+ *
+ *  This test driver contains the following tests for psVectorSort test point 3:
+ *     A)  Create float vectors of different sizes
+ *     B)  Attempt to sort vectors...should get errors
+ *     C)  Free float vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *in = NULL;
+    psVector *out = NULL;
+
+
+    // Test A - Create float vectors
+    printPositiveTestHeader(stdout,"psVectorSort", "Create float vectors of different sizes");
+    in = psVectorAlloc(5, PS_TYPE_F32);
+    in->n = 5;
+    out = psVectorAlloc(6, PS_TYPE_F32);
+    out->n = 6;
+    in->n = 5;
+    for(int i=0; i<5; i++) {
+        printf("arr[%d] = %f\n", i, in->data.F32[i]);
+    }
+    printFooter(stdout, "psVectorSort", "Create float vectors of different sizes", true);
+
+
+    // Test B - Sort input float vector and put results into output float vector
+    printNegativeTestHeader(stdout,"psVectorSort", "Sort float vector",
+                            "Input and output vector sizes are not equal", 0);
+    out = psVectorSort(out, in);
+    printFooter(stdout, "psVectorSort", "Sort float vector", true);
+
+
+    // Test C - Free float vectors
+    printPositiveTestHeader(stdout,"psVectorSort", "Free float vectors");
+    psFree(in);
+    psFree(out);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psVectorSort", "Free float vectors", true);
+
+}
Index: /trunk/psLib/test/collections/tst_psVectorSort_03.c~
===================================================================
--- /trunk/psLib/test/collections/tst_psVectorSort_03.c~	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVectorSort_03.c~	(revision 1233)
@@ -0,0 +1,60 @@
+/** @file  tst_psSort_03.c
+ *
+ *  @brief Test driver for psSort functions
+ *
+ *  This test driver contains the following tests for psSort test point 3:
+ *     A)  Create float vectors of different sizes
+ *     B)  Attempt to sort vectors...should get errors
+ *     C)  Free float vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *in = NULL;
+    psVector *out = NULL;
+
+
+    // Test A - Create float vectors
+    printPositiveTestHeader(stdout,"psSort", "Create float vectors of different sizes");
+    in = psVectorAlloc(5, PS_TYPE_F32);
+    in->n = 5;
+    out = psVectorAlloc(6, PS_TYPE_F32);
+    out->n = 6;
+    in->n = 5;
+    for(int i=0; i<5; i++) {
+        printf("arr[%d] = %f\n", i, in->data.F32[i]);
+    }
+    printFooter(stdout, "psSort", "Create float vectors of different sizes", true);
+
+
+    // Test B - Sort input float vector and put results into output float vector
+    printNegativeTestHeader(stdout,"psSort", "Sort float vector",
+                            "Input and output vector sizes are not equal", 0);
+    out = psSort(out, in);
+    printFooter(stdout, "psSort", "Sort float vector", true);
+
+
+    // Test C - Free float vectors
+    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
+    psFree(in);
+    psFree(out);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psSort", "Free float vectors", true);
+
+}
Index: /trunk/psLib/test/collections/tst_psVectorSort_04.c
===================================================================
--- /trunk/psLib/test/collections/tst_psVectorSort_04.c	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVectorSort_04.c	(revision 1233)
@@ -0,0 +1,44 @@
+/** @file  tst_psVectorSort_04.c
+ *
+ *  @brief Test driver for psVectorSort functions
+ *
+ *  This test driver contains the following tests for psVectorSort test point 4:
+ *     A)  Attempt to sort with null input vector
+ *     B)  Free vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *badIn = NULL;
+    psVector *goodOut = psVectorAlloc(5, PS_TYPE_F32);
+
+    // Test A - Attempt to sort with null input vector
+    printNegativeTestHeader(stdout,"psVectorSort", "Attempt to sort with null input vector",
+                            "Null input vector", 0);
+    goodOut = psVectorSort(goodOut, badIn);
+    printFooter(stdout, "psVectorSort", "Attempt to sort with null input vector", true);
+
+    // Test B - Free vectors
+    printPositiveTestHeader(stdout, "psVectorSort", "Free vectors");
+    psFree(goodOut);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psVectorSort", "Free arays", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/tst_psVectorSort_04.c~
===================================================================
--- /trunk/psLib/test/collections/tst_psVectorSort_04.c~	(revision 1233)
+++ /trunk/psLib/test/collections/tst_psVectorSort_04.c~	(revision 1233)
@@ -0,0 +1,44 @@
+/** @file  tst_psSort_04.c
+ *
+ *  @brief Test driver for psSort functions
+ *
+ *  This test driver contains the following tests for psSort test point 4:
+ *     A)  Attempt to sort with null input vector
+ *     B)  Free vectors
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-07-15 23:52:34 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+    psVector *badIn = NULL;
+    psVector *goodOut = psVectorAlloc(5, PS_TYPE_F32);
+
+    // Test A - Attempt to sort with null input vector
+    printNegativeTestHeader(stdout,"psSort", "Attempt to sort with null input vector",
+                            "Null input vector", 0);
+    goodOut = psSort(goodOut, badIn);
+    printFooter(stdout, "psSort", "Attempt to sort with null input vector", true);
+
+    // Test B - Free vectors
+    printPositiveTestHeader(stdout, "psSort", "Free vectors");
+    psFree(goodOut);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psSort", "Free arays", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/verified/tst_psVectorSort_03.stderr
===================================================================
--- /trunk/psLib/test/collections/verified/tst_psVectorSort_03.stderr	(revision 1233)
+++ /trunk/psLib/test/collections/verified/tst_psVectorSort_03.stderr	(revision 1233)
@@ -0,0 +1,1 @@
+ <DATE> <TIME> |<HOST>|E|   psVectorSort| : Line 178 - Input and output vector sizes are not equal: in=5 out=6
Index: /trunk/psLib/test/collections/verified/tst_psVectorSort_03.stdout
===================================================================
--- /trunk/psLib/test/collections/verified/tst_psVectorSort_03.stdout	(revision 1233)
+++ /trunk/psLib/test/collections/verified/tst_psVectorSort_03.stdout	(revision 1233)
@@ -0,0 +1,34 @@
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psVectorSort_03.c                                      *
+*            TestPoint: psVectorSort{Create float vectors of different sizes}      *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+arr[0] = 0.000000
+arr[1] = 0.000000
+arr[2] = 0.000000
+arr[3] = 0.000000
+arr[4] = 0.000000
+
+---> TESTPOINT PASSED (psVectorSort{Create float vectors of different sizes} | tst_psVectorSort_03.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psVectorSort_03.c                                      *
+*            TestPoint: psVectorSort{Sort float vector}                            *
+*             TestType: Negative                                                   *
+*    ExpectedErrorText: Input and output vector sizes are not equal                *
+*  ExpectedStatusValue: 0                                                          *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psVectorSort{Sort float vector} | tst_psVectorSort_03.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psVectorSort_03.c                                      *
+*            TestPoint: psVectorSort{Free float vectors}                           *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psVectorSort{Free float vectors} | tst_psVectorSort_03.c)
+
Index: /trunk/psLib/test/collections/verified/tst_psVectorSort_04.stderr
===================================================================
--- /trunk/psLib/test/collections/verified/tst_psVectorSort_04.stderr	(revision 1233)
+++ /trunk/psLib/test/collections/verified/tst_psVectorSort_04.stderr	(revision 1233)
@@ -0,0 +1,1 @@
+ <DATE> <TIME> |<HOST>|E|   psVectorSort| : Line 160 - Null input vector
Index: /trunk/psLib/test/collections/verified/tst_psVectorSort_04.stdout
===================================================================
--- /trunk/psLib/test/collections/verified/tst_psVectorSort_04.stdout	(revision 1233)
+++ /trunk/psLib/test/collections/verified/tst_psVectorSort_04.stdout	(revision 1233)
@@ -0,0 +1,20 @@
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psVectorSort_04.c                                      *
+*            TestPoint: psVectorSort{Attempt to sort with null input vector}       *
+*             TestType: Negative                                                   *
+*    ExpectedErrorText: Null input vector                                          *
+*  ExpectedStatusValue: 0                                                          *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psVectorSort{Attempt to sort with null input vector} | tst_psVectorSort_04.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psVectorSort_04.c                                      *
+*            TestPoint: psVectorSort{Free vectors}                                 *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psVectorSort{Free arays} | tst_psVectorSort_04.c)
+
