Index: /trunk/psLib/src/collections/Makefile
===================================================================
--- /trunk/psLib/src/collections/Makefile	(revision 644)
+++ /trunk/psLib/src/collections/Makefile	(revision 645)
@@ -3,6 +3,6 @@
 ##  Makefile:   collections
 ##
-##  $Revision: 1.9 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-05-07 18:55:53 $
+##  $Revision: 1.10 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-05-12 18:07:22 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -30,6 +30,6 @@
 # Define the source objects
  
-SRC_OBJS = psBitSet.o    \
-           psArray.o     \
+SRC_OBJS = psBitSet.o \
+           psVector.o \
            psSort.o
 
Index: /trunk/psLib/src/collections/psSort.c
===================================================================
--- /trunk/psLib/src/collections/psSort.c	(revision 644)
+++ /trunk/psLib/src/collections/psSort.c	(revision 645)
@@ -1,19 +1,19 @@
 /** @file  psSort.c
  *
- *  @brief Sorts arrays
- *
- *  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
+ *  @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 array is undefined.
+ *  in the sorted vector is undefined.
  *
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-05 20:43:22 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-12 18:07:22 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -30,5 +30,5 @@
 #include <float.h>
 
-#include "psArray.h"
+#include "psVector.h"
 #include "psSort.h"
 #include "psError.h"
@@ -67,5 +67,5 @@
  *  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. If 
- *  two members compare as equal, their order in the sorted array is undefined. 
+ *  two members compare as equal, their order in the sorted vector is undefined. 
  *
  *  @return  int: Result of comparsion (-1, 0, or 1).
@@ -104,7 +104,7 @@
 /*****************************************************************************/
 
-psArray *psSort(
-    psArray *restrict outArray,        /**< Sorted output array. */
-    const psArray *restrict inArray    /**< Input array to sort. */
+psVector *psSort(
+    psVector *restrict outVector,        /**< Sorted output vector. */
+    const psVector *restrict inVector    /**< Input vector to sort. */
 )
 {
@@ -113,54 +113,54 @@
     int i = 0;
     int elSize = 0;
-    float *inArr = NULL;
-    float *outArr = NULL;
-
-    if(outArray == NULL) {
-        psError(__func__, " : Line %d - Null output array\n", __LINE__);
-        return outArray;
-    }
-
-    if(inArray == NULL) {
-        psError(__func__, " : Line %d - Null input array\n", __LINE__);
-        return outArray;
+    float *inVec = NULL;
+    float *outVec = NULL;
+
+    if(outVector == NULL) {
+        psError(__func__, " : Line %d - Null output vector\n", __LINE__);
+        return outVector;
+    }
+
+    if(inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
+        return outVector;
     }
 
     // Initialize values
-    inN = inArray->n;
-    outN = outArray->n;
-    inArr = inArray->arr.fltArr;
-    outArr = outArray->arr.fltArr;
+    inN = inVector->n;
+    outN = outVector->n;
+    inVec = inVector->vec.f;
+    outVec = outVector->vec.f;
     elSize = sizeof(float);
 
     if(inN != outN) {
-        psError(__func__, " : Line %d - Input and output array sizes are not equal: in=%d out=%d\n", __LINE__,
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
                 inN, outN);
-        return outArray;
+        return outVector;
     }
 
     if(inN == 0) {
-        psError(__func__, " : Line %d - No elements in use for input array\n", __LINE__);
-        return outArray;
+        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 array\n", __LINE__);
-        return outArray;
-    }
-
-    // Copy input array values into output array
+        psError(__func__, " : Line %d - No elements in use for output vector\n", __LINE__);
+        return outVector;
+    }
+
+    // Copy input vector values into output vector
     for(i=0; i<inN; i++) {
-        outArr[i] = inArr[i];
-    }
-
-    // Sort output array
-    qsort((void*)outArr, inN, elSize, psCompare);
-
-    return outArray;
+        outVec[i] = inVec[i];
+    }
+
+    // Sort output vector
+    qsort((void*)outVec, inN, elSize, psCompare);
+
+    return outVector;
 }
 
-psArray *psSortIndex(
-    psArray *restrict outArray,         /**< Output array of sorted indices. */
-    const psArray *restrict inArray     /**< Input array to be sorted. */
+psVector *psSortIndex(
+    psVector *restrict outVector,         /**< Output vector of sorted indices. */
+    const psVector *restrict inVector     /**< Input vector to be sorted. */
 )
 {
@@ -170,41 +170,43 @@
     int j = 0;
     float tempVal = 0.0f;
-    float *inArr = NULL;
-    int *outArr = NULL;
+    float *inVec = NULL;
+    int *outVec = NULL;
     float diff = 0.0f;
-    psArray *tmpFloatArray = NULL;
-
-    if(outArray == NULL) {
-        psError(__func__, " : Line %d - Null output array\n", __LINE__);
-        return outArray;
-    }
-
-    if(inArray == NULL) {
-        psError(__func__, " : Line %d - Null input array\n", __LINE__);
-        return outArray;
+    psVector *tmpFloatVector = NULL;
+    psType tempType;
+
+    if(outVector == NULL) {
+        psError(__func__, " : Line %d - Null output vector\n", __LINE__);
+        return outVector;
+    }
+
+    if(inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
+        return outVector;
     }
 
     // Initialize values
-    inN = inArray->n;
-    outN = outArray->n;
-    inArr = inArray->arr.fltArr;
-    outArr = outArray->arr.intArr;
+    inN = inVector->n;
+    outN = outVector->n;
+    inVec = inVector->vec.f;
+    outVec = outVector->vec.i;
 
     if(inN != outN) {
-        psError(__func__, " : Line %d - Input and output array sizes are not equal: in=%d out=%d\n", __LINE__,
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
                 inN, outN);
-        return outArray;
-    }
-
-    tmpFloatArray = psFloatArrayAlloc(inN);
-    tmpFloatArray->n = inN;
-    tmpFloatArray = psSort(tmpFloatArray, inArray);
+        return outVector;
+    }
+
+    tempType.type = PS_TYPE_FLOAT;
+    tmpFloatVector = psVectorAlloc(tempType, inN);
+    tmpFloatVector->n = inN;
+    tmpFloatVector = psSort(tmpFloatVector, inVector);
 
     for(i=0; i<inN; i++) {
-        tempVal = tmpFloatArray->arr.fltArr[i];
+        tempVal = tmpFloatVector->vec.f[i];
         for(j=0; j<inN; j++) {
-            diff = fabsf(tempVal - inArr[j]);
+            diff = fabsf(tempVal - inVec[j]);
             if(diff < FLT_EPSILON) {
-                outArr[i] = j;
+                outVec[i] = j;
                 break;
             }
@@ -213,6 +215,6 @@
 
     // Free temp memory
-    psFloatArrayFree(tmpFloatArray);
-
-    return outArray;
+    psVectorFree(tmpFloatVector);
+
+    return outVector;
 }
Index: /trunk/psLib/src/collections/psSort.h
===================================================================
--- /trunk/psLib/src/collections/psSort.h	(revision 644)
+++ /trunk/psLib/src/collections/psSort.h	(revision 645)
@@ -14,6 +14,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-05 20:43:57 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-12 18:07:22 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -46,5 +46,5 @@
  */
 
-psArray *psSort(psArray *restrict out, const psArray *restrict inArray);
+psVector *psSort(psVector *restrict outVector, const psVector *restrict inVector);
 
 /** Creates an array of indices based on sort odred of float array.
@@ -56,5 +56,5 @@
  */
 
-psArray *psSortIndex(psArray *restrict out, const psArray *restrict inArray);
+psVector *psSortIndex(psVector *restrict outVector, const psVector *restrict inVector);
 
 #endif
Index: /trunk/psLib/src/collections/psVector.c
===================================================================
--- /trunk/psLib/src/collections/psVector.c	(revision 645)
+++ /trunk/psLib/src/collections/psVector.c	(revision 645)
@@ -0,0 +1,307 @@
+/** @file  psVector.h
+ *
+ *  @brief Contains support for basic vector types
+ *
+ *  This file defines types and functions for one dimensional vectors which include: 
+ *      char
+ *      short
+ *      int
+ *      long
+ *      unsigned char
+ *      unsigned short
+ *      unsigned int
+ *      unsigned long
+ *      float
+ *      double
+ *      complex float
+ *      void **
+ *
+ *  @author Ross Harman, MHPCC
+ *   
+ *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-12 18:07:22 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+/******************************************************************************/
+/*  INCLUDE FILES                                                             */
+/******************************************************************************/
+#include "psMemory.h"
+#include "psError.h"
+#include "psVector.h"
+
+/******************************************************************************/
+/*  DEFINE STATEMENTS                                                         */
+/******************************************************************************/
+
+// None
+
+/******************************************************************************/
+/*  TYPE DEFINITIONS                                                          */
+/******************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  GLOBAL VARIABLES                                                         */
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  FILE STATIC VARIABLES                                                    */
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+/*****************************************************************************/
+
+static void* p_psVectorAlloc(psVector *restrict psVec, psElemType elemType, int nalloc, int elemSize)
+{
+    void *vec = NULL;
+
+    psVec->type.dimen = PS_DIMEN_VECTOR;
+    psVec->type.type = elemType;
+    psVec->nalloc = nalloc;
+    psVec->n = 0;
+
+    if(nalloc != 0) {
+        vec = psAlloc(nalloc*sizeof(elemSize));
+    }
+
+    return vec;
+}
+
+static void* p_psVectorRealloc(psVector *restrict psVec, void *vec, int nalloc, int elemSize)
+{
+    // For decrease in psVector size
+    if(nalloc < psVec->n) {
+        psVec->n = nalloc;
+    }
+
+    psVec->nalloc = nalloc;
+
+    return psRealloc(vec, nalloc*elemSize);
+}
+
+/*****************************************************************************/
+/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+/*****************************************************************************/
+psVector* psVectorAlloc(psType type, int nalloc)
+{
+    psElemType vecType = 0;
+    psDimen vecDim = 0;
+    psVector *psVec = NULL;
+
+    vecType = type.type;
+    vecDim =  type.dimen;
+
+    // Invalid nalloc
+    if(nalloc <= 0) {
+        psError(__func__, " : Line %d - Invalid value for nalloc. nalloc: %d\n", __LINE__, nalloc);
+        return NULL;
+    }
+
+    // Create vector struct
+    psVec = (psVector *)psAlloc(sizeof(psVector));
+
+    // Create vector data array
+    switch(vecType) {
+    case PS_TYPE_CHAR:
+        psVec->vec.c = (char *)p_psVectorAlloc(psVec, PS_TYPE_CHAR, nalloc, sizeof(char));
+        break;
+    case PS_TYPE_SHORT:
+        psVec->vec.s = (short *)p_psVectorAlloc(psVec, PS_TYPE_SHORT, nalloc, sizeof(short));
+        break;
+    case PS_TYPE_INT:
+        psVec->vec.i = (int *)p_psVectorAlloc(psVec, PS_TYPE_INT, nalloc, sizeof(int));
+        break;
+    case PS_TYPE_LONG:
+        psVec->vec.l = (long *)p_psVectorAlloc(psVec, PS_TYPE_LONG, nalloc, sizeof(long));
+        break;
+    case PS_TYPE_UCHAR:
+        psVec->vec.uc = (unsigned char *)p_psVectorAlloc(psVec, PS_TYPE_UCHAR, nalloc, sizeof(unsigned char));
+        break;
+    case PS_TYPE_USHORT:
+        psVec->vec.us = (unsigned short *)p_psVectorAlloc(psVec, PS_TYPE_USHORT, nalloc, sizeof(unsigned short));
+        break;
+    case PS_TYPE_UINT:
+        psVec->vec.ui = (unsigned int *)p_psVectorAlloc(psVec, PS_TYPE_UINT, nalloc, sizeof(unsigned int));
+        break;
+    case PS_TYPE_ULONG:
+        psVec->vec.ul = (unsigned long *)p_psVectorAlloc(psVec, PS_TYPE_ULONG, nalloc, sizeof(unsigned long));
+        break;
+    case PS_TYPE_FLOAT:
+        psVec->vec.f = (float *)p_psVectorAlloc(psVec, PS_TYPE_FLOAT, nalloc, sizeof(float));
+        break;
+    case PS_TYPE_DOUBLE:
+        psVec->vec.d = (double *)p_psVectorAlloc(psVec, PS_TYPE_DOUBLE, nalloc, sizeof(double));
+        break;
+    case PS_TYPE_COMPLEX:
+        psVec->vec.cf = (complex float *)p_psVectorAlloc(psVec, PS_TYPE_COMPLEX, nalloc, sizeof(complex float));
+        break;
+    case PS_TYPE_OTHER:
+        break;
+    default:
+        psError(__func__, " : Line %d - Invalid vector type. Type: %d\n", __LINE__, vecType);
+    }
+
+    return psVec;
+}
+
+psVector *psVectorRealloc(psVector *restrict psVec, int nalloc)
+{
+    psElemType vecType = 0;
+
+    vecType = psVec->type.type;
+
+    if(psVec == NULL) {                                 // For creating new psVector
+        psVec = psVectorAlloc(psVec->type, nalloc);
+    } else if(psVec->nalloc != nalloc) {                // No need to realloc to same size
+        switch (vecType) {
+        case PS_TYPE_CHAR:
+            psVec->vec.c = p_psVectorRealloc(psVec, psVec->vec.c, nalloc, sizeof(char));
+            break;
+        case PS_TYPE_SHORT:
+            psVec->vec.s = p_psVectorRealloc(psVec, psVec->vec.s, nalloc, sizeof(short));
+            break;
+        case PS_TYPE_INT:
+            psVec->vec.i = p_psVectorRealloc(psVec, psVec->vec.i, nalloc, sizeof(int));
+            break;
+        case PS_TYPE_LONG:
+            psVec->vec.l = p_psVectorRealloc(psVec, psVec->vec.l, nalloc, sizeof(long));
+            break;
+        case PS_TYPE_UCHAR:
+            psVec->vec.uc = p_psVectorRealloc(psVec, psVec->vec.uc, nalloc, sizeof(unsigned char));
+            break;
+        case PS_TYPE_USHORT:
+            psVec->vec.us = p_psVectorRealloc(psVec, psVec->vec.us, nalloc, sizeof(unsigned short));
+            break;
+        case PS_TYPE_UINT:
+            psVec->vec.ui = p_psVectorRealloc(psVec, psVec->vec.ui, nalloc, sizeof(unsigned int));
+            break;
+        case PS_TYPE_ULONG:
+            psVec->vec.ul = p_psVectorRealloc(psVec, psVec->vec.ul, nalloc, sizeof(unsigned long));
+            break;
+        case PS_TYPE_FLOAT:
+            psVec->vec.f = p_psVectorRealloc(psVec, psVec->vec.f, nalloc, sizeof(float));
+            break;
+        case PS_TYPE_DOUBLE:
+            psVec->vec.d = p_psVectorRealloc(psVec, psVec->vec.d, nalloc, sizeof(double));
+            break;
+        case PS_TYPE_COMPLEX:
+            psVec->vec.cf = p_psVectorRealloc(psVec, psVec->vec.cf, nalloc, sizeof(complex float));
+            break;
+        case PS_TYPE_OTHER:
+            break;
+        default:
+            psError(__func__, " : Line %d - Invalid vector type. Type: %d\n", __LINE__, vecType);
+        }
+    }
+
+    return psVec;
+}
+
+void psVectorFree(psVector *restrict psVec)
+{
+    psElemType vecType = 0;
+
+    vecType = psVec->type.type;
+
+    if (psVec == NULL) {
+        return;
+    }
+
+    switch (vecType) {
+    case PS_TYPE_CHAR:
+        psFree(psVec->vec.c);
+        break;
+    case PS_TYPE_SHORT:
+        psFree(psVec->vec.s);
+        break;
+    case PS_TYPE_INT:
+        psFree(psVec->vec.i);
+        break;
+    case PS_TYPE_LONG:
+        psFree(psVec->vec.l);
+        break;
+    case PS_TYPE_UCHAR:
+        psFree(psVec->vec.uc);
+        break;
+    case PS_TYPE_USHORT:
+        psFree(psVec->vec.us);
+        break;
+    case PS_TYPE_UINT:
+        psFree(psVec->vec.ui);
+        break;
+    case PS_TYPE_ULONG:
+        psFree(psVec->vec.ul);
+        break;
+    case PS_TYPE_FLOAT:
+        psFree(psVec->vec.f);
+        break;
+    case PS_TYPE_DOUBLE:
+        psFree(psVec->vec.d);
+        break;
+    case PS_TYPE_COMPLEX:
+        psFree(psVec->vec.cf);
+        break;
+    case PS_TYPE_OTHER:
+        break;
+    default:
+        psError(__func__, " : Line %d - Invalid vector type. Type: %d\n", __LINE__, vecType);
+    }
+
+    // Free vector struct
+    psFree(psVec);
+}
+
+psVector* psVoidPtrVectorAlloc(int nalloc)
+{
+    psVector *psVec = NULL;
+    psVec = psAlloc(sizeof(psVector));
+    psVec->vec.vp = p_psVectorAlloc(psVec, PS_TYPE_OTHER, nalloc, sizeof(void *));
+    return psVec;
+}
+
+psVector *psVoidPtrVectorRealloc(psVector *restrict psVec, int nalloc)
+{
+    int i = 0;
+
+    for (i = nalloc; i < psVec->n; i++) {               // For reduction in vector size
+        psMemDecrRefCounter(psVec->vec.vp[i]);
+    }
+
+    if(psVec == NULL) {                                 // For creating new psVector
+        psVec = psVoidPtrVectorAlloc(nalloc);
+    } else if(psVec->nalloc != nalloc) {                // No need to realloc to same size
+        psVec->vec.vp = p_psVectorRealloc(psVec, psVec->vec.vp, nalloc, sizeof(void *));
+    }
+
+    return psVec;
+}
+
+void psVoidPtrVectorFree(psVector *restrict psVec, void (*elemFree)(void *))
+{
+    int i = 0;
+
+    if(psVec == NULL) {
+        return;
+    }
+
+    for(i = 0; i < psVec->nalloc; i++) {
+        if(elemFree == NULL) {
+            psMemDecrRefCounter(psVec->vec.vp[i]);
+        } else {
+            elemFree(psMemDecrRefCounter(psVec->vec.vp[i]));
+        }
+    }
+
+    // Free pointer vector
+    psFree(psVec->vec.vp);
+    psFree(psVec);
+}
+
Index: /trunk/psLib/src/collections/psVector.h
===================================================================
--- /trunk/psLib/src/collections/psVector.h	(revision 645)
+++ /trunk/psLib/src/collections/psVector.h	(revision 645)
@@ -0,0 +1,200 @@
+/** @file  psVector.h
+ *
+ *  @brief Contains support for basic vector types
+ *
+ *  This file defines types and functions for one dimensional vectors which include: 
+ *      char
+ *      short
+ *      int
+ *      long
+ *      unsigned char
+ *      unsigned short
+ *      unsigned int
+ *      unsigned long
+ *      float
+ *      double
+ *      complex float
+ *      void **
+ *
+ *  @author Ross Harman, MHPCC
+ *   
+ *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-12 18:07:22 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+#ifndef PS_VECTOR_H
+#define PS_VECTOR_H
+
+#include <complex.h>
+
+/******************************************************************************/
+/*  DEFINE STATEMENTS                                                         */
+/******************************************************************************/
+
+// None
+
+/******************************************************************************/
+/*  TYPE DEFINITIONS                                                          */
+/******************************************************************************/
+
+/** Basic data types used by the containers.
+ *
+ * The basic types of the primitives used by psLib are defined within this enum. This enum is in turn used by
+ * the psType struct.
+ *
+ */
+typedef enum {
+    PS_TYPE_CHAR,       ///< Character.
+    PS_TYPE_SHORT,      ///< Short integer.
+    PS_TYPE_INT,        ///< Integer.
+    PS_TYPE_LONG,       ///< Long integer.
+    PS_TYPE_UCHAR,      ///< Unsigned character.
+    PS_TYPE_USHORT,     ///< Unsigned short integer.
+    PS_TYPE_UINT,       ///< Unsigned integer.
+    PS_TYPE_ULONG,      ///< Unsigned long integer.
+    PS_TYPE_FLOAT,      ///< Floating point.
+    PS_TYPE_DOUBLE,     ///< Double-precision floating point.
+    PS_TYPE_COMPLEX,    ///< Complex numbers consisting of floating point.
+    PS_TYPE_OTHER,      ///< Something else that's not supported for arithmetic.
+} psElemType;
+
+/** Dimensions of a data type.
+ *
+ * The dimensions of containers used by psLib are defined within this enum. This enum is used by the psType struct.
+ *
+ */
+typedef enum {
+    PS_DIMEN_SCALAR,    ///< Scalar.
+    PS_DIMEN_VECTOR,    ///< Vector.
+    PS_DIMEN_TRANSV,    ///< Transposed vector.
+    PS_DIMEN_IMAGE,     ///< Image.
+    PS_DIMEN_OTHER      ///< Something else that's not supported for arithmetic.
+} psDimen;
+
+/** The type of a data type.
+ *
+ * All psLib complex types consist of primitive components. This struct provides the description of those 
+ * primitives.
+ *
+ */
+typedef struct
+{
+    psElemType type;    ///< Primitive type.
+    psDimen dimen;      ///< Dimensionality.
+}
+psType;
+
+/** An vector to support primitive types.
+ *
+ * Struct for maintaining an vector of frequently used primitive types.
+ *
+ */
+typedef struct
+{
+    psType type;            ///< Type of data.
+    int nalloc;             ///< Total number of elements available.
+    int n;                  ///< Number of elements in use.
+
+    union {
+        char *c;            ///< Pointers to char integer data.
+        short *s;           ///< Pointers to short integer data.
+        int *i;             ///< Pointers to integer data.
+        long *l;            ///< Pointers to long integer data.
+        unsigned char *uc;  ///< Pointers to unsigned char integer data.
+        unsigned short *us; ///< Pointers to unsigned short integer data.
+        unsigned int *ui;   ///< Pointers to unsigned integer data.
+        unsigned long *ul;  ///< Pointers to unsigned long integer data.
+        float *f;           ///< Pointers to floating point data.
+        double *d;          ///< Pointers to double precision data.
+        complex float *cf;  ///< Pointers to complex floating point data.
+        void **vp;          ///< Void pointer vector.
+    }vec;                   ///< Union for data types.
+}
+psVector;
+
+/*****************************************************************************/
+/* FUNCTION PROTOTYPES                                                       */
+/*****************************************************************************/
+
+/** Allocate a vector.
+ *
+ * Uses psLib memory allocation functions to create a vector collection of data as defined by the psType type.
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+psVector *psVectorAlloc(
+    psType type,    ///< Type of data to be held by vector.
+    int nalloc      ///< Total number of elements to make available.
+);
+
+/** Reallocate a vector.
+ *
+ * Uses psLib memory allocation functions to reallocate a vector collection of data. The vector is reallocated
+ * according to the psType type member contained within the vector. 
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+psVector *psVectorRealloc(
+    psVector *restrict psVec,   ///< Vector to reallocate.
+    int nalloc                  ///< Total number of elements to make available.
+);
+
+/** Deallocate a vector.
+ *
+ * Uses psLib memory allocation functions to deallocate a vector collection of data. The vector is deallocated
+ * according to the psType type member contained within the vector. 
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+void psVectorFree(
+    psVector *restrict psVec  ///< Vector to free.
+);
+
+/** Allocate a void pointer vector.
+ *
+ * Uses psLib memory allocation functions to create a vector of void pointers as defined by the psVoidPtrVector
+ * struct.
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+psVector *psVoidPtrVectorAlloc(
+    int nalloc  ///< Number of elements to use.
+);
+
+/** Reallocate a void pointer vector.
+ *
+ * Uses psLib memory allocation functions to reallocate a vector of void pointers as defined by the 
+ * psVoidPtrVector struct. If the vector size is increased or decreased, this function does not allocate or 
+ * deallocate the contents of individual vector elements. The user must do this after calling this function.
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+psVector *psVoidPtrVectorRealloc(
+    psVector *restrict psVec,   ///< Void pointer vector to destroy.
+    int nalloc                  ///< Number of elements.
+);
+
+/** Deallocate a void pointer vector.
+ *
+ * Uses psLib memory allocation functions to deallocate a vector of void pointers as defined by the 
+ * psVoidPtrVector struct. This function does not free the vector elements unless the user provides a callback 
+ * function. NULL may be passed as an alternative to supplying a callback, but the user must remember to 
+ * delete the vector elements afterwards. The user must not delete or deallocate the vector elements prior to 
+ * calling this function, as it requires valid elements for memory reference decrementation operations.
+ *
+ * @return: void
+ *
+ */
+void psVoidPtrVectorFree(
+    psVector *restrict psVec,   ///< Void pointer vector to destroy.
+    void (*elemFree)(void *)    ///< Optional callback function to remove vector elements.
+);
+
+#endif
Index: /trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.c	(revision 645)
+++ /trunk/psLib/src/mathtypes/psVector.c	(revision 645)
@@ -0,0 +1,307 @@
+/** @file  psVector.h
+ *
+ *  @brief Contains support for basic vector types
+ *
+ *  This file defines types and functions for one dimensional vectors which include: 
+ *      char
+ *      short
+ *      int
+ *      long
+ *      unsigned char
+ *      unsigned short
+ *      unsigned int
+ *      unsigned long
+ *      float
+ *      double
+ *      complex float
+ *      void **
+ *
+ *  @author Ross Harman, MHPCC
+ *   
+ *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-12 18:07:22 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+/******************************************************************************/
+/*  INCLUDE FILES                                                             */
+/******************************************************************************/
+#include "psMemory.h"
+#include "psError.h"
+#include "psVector.h"
+
+/******************************************************************************/
+/*  DEFINE STATEMENTS                                                         */
+/******************************************************************************/
+
+// None
+
+/******************************************************************************/
+/*  TYPE DEFINITIONS                                                          */
+/******************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  GLOBAL VARIABLES                                                         */
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  FILE STATIC VARIABLES                                                    */
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+/*****************************************************************************/
+
+static void* p_psVectorAlloc(psVector *restrict psVec, psElemType elemType, int nalloc, int elemSize)
+{
+    void *vec = NULL;
+
+    psVec->type.dimen = PS_DIMEN_VECTOR;
+    psVec->type.type = elemType;
+    psVec->nalloc = nalloc;
+    psVec->n = 0;
+
+    if(nalloc != 0) {
+        vec = psAlloc(nalloc*sizeof(elemSize));
+    }
+
+    return vec;
+}
+
+static void* p_psVectorRealloc(psVector *restrict psVec, void *vec, int nalloc, int elemSize)
+{
+    // For decrease in psVector size
+    if(nalloc < psVec->n) {
+        psVec->n = nalloc;
+    }
+
+    psVec->nalloc = nalloc;
+
+    return psRealloc(vec, nalloc*elemSize);
+}
+
+/*****************************************************************************/
+/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+/*****************************************************************************/
+psVector* psVectorAlloc(psType type, int nalloc)
+{
+    psElemType vecType = 0;
+    psDimen vecDim = 0;
+    psVector *psVec = NULL;
+
+    vecType = type.type;
+    vecDim =  type.dimen;
+
+    // Invalid nalloc
+    if(nalloc <= 0) {
+        psError(__func__, " : Line %d - Invalid value for nalloc. nalloc: %d\n", __LINE__, nalloc);
+        return NULL;
+    }
+
+    // Create vector struct
+    psVec = (psVector *)psAlloc(sizeof(psVector));
+
+    // Create vector data array
+    switch(vecType) {
+    case PS_TYPE_CHAR:
+        psVec->vec.c = (char *)p_psVectorAlloc(psVec, PS_TYPE_CHAR, nalloc, sizeof(char));
+        break;
+    case PS_TYPE_SHORT:
+        psVec->vec.s = (short *)p_psVectorAlloc(psVec, PS_TYPE_SHORT, nalloc, sizeof(short));
+        break;
+    case PS_TYPE_INT:
+        psVec->vec.i = (int *)p_psVectorAlloc(psVec, PS_TYPE_INT, nalloc, sizeof(int));
+        break;
+    case PS_TYPE_LONG:
+        psVec->vec.l = (long *)p_psVectorAlloc(psVec, PS_TYPE_LONG, nalloc, sizeof(long));
+        break;
+    case PS_TYPE_UCHAR:
+        psVec->vec.uc = (unsigned char *)p_psVectorAlloc(psVec, PS_TYPE_UCHAR, nalloc, sizeof(unsigned char));
+        break;
+    case PS_TYPE_USHORT:
+        psVec->vec.us = (unsigned short *)p_psVectorAlloc(psVec, PS_TYPE_USHORT, nalloc, sizeof(unsigned short));
+        break;
+    case PS_TYPE_UINT:
+        psVec->vec.ui = (unsigned int *)p_psVectorAlloc(psVec, PS_TYPE_UINT, nalloc, sizeof(unsigned int));
+        break;
+    case PS_TYPE_ULONG:
+        psVec->vec.ul = (unsigned long *)p_psVectorAlloc(psVec, PS_TYPE_ULONG, nalloc, sizeof(unsigned long));
+        break;
+    case PS_TYPE_FLOAT:
+        psVec->vec.f = (float *)p_psVectorAlloc(psVec, PS_TYPE_FLOAT, nalloc, sizeof(float));
+        break;
+    case PS_TYPE_DOUBLE:
+        psVec->vec.d = (double *)p_psVectorAlloc(psVec, PS_TYPE_DOUBLE, nalloc, sizeof(double));
+        break;
+    case PS_TYPE_COMPLEX:
+        psVec->vec.cf = (complex float *)p_psVectorAlloc(psVec, PS_TYPE_COMPLEX, nalloc, sizeof(complex float));
+        break;
+    case PS_TYPE_OTHER:
+        break;
+    default:
+        psError(__func__, " : Line %d - Invalid vector type. Type: %d\n", __LINE__, vecType);
+    }
+
+    return psVec;
+}
+
+psVector *psVectorRealloc(psVector *restrict psVec, int nalloc)
+{
+    psElemType vecType = 0;
+
+    vecType = psVec->type.type;
+
+    if(psVec == NULL) {                                 // For creating new psVector
+        psVec = psVectorAlloc(psVec->type, nalloc);
+    } else if(psVec->nalloc != nalloc) {                // No need to realloc to same size
+        switch (vecType) {
+        case PS_TYPE_CHAR:
+            psVec->vec.c = p_psVectorRealloc(psVec, psVec->vec.c, nalloc, sizeof(char));
+            break;
+        case PS_TYPE_SHORT:
+            psVec->vec.s = p_psVectorRealloc(psVec, psVec->vec.s, nalloc, sizeof(short));
+            break;
+        case PS_TYPE_INT:
+            psVec->vec.i = p_psVectorRealloc(psVec, psVec->vec.i, nalloc, sizeof(int));
+            break;
+        case PS_TYPE_LONG:
+            psVec->vec.l = p_psVectorRealloc(psVec, psVec->vec.l, nalloc, sizeof(long));
+            break;
+        case PS_TYPE_UCHAR:
+            psVec->vec.uc = p_psVectorRealloc(psVec, psVec->vec.uc, nalloc, sizeof(unsigned char));
+            break;
+        case PS_TYPE_USHORT:
+            psVec->vec.us = p_psVectorRealloc(psVec, psVec->vec.us, nalloc, sizeof(unsigned short));
+            break;
+        case PS_TYPE_UINT:
+            psVec->vec.ui = p_psVectorRealloc(psVec, psVec->vec.ui, nalloc, sizeof(unsigned int));
+            break;
+        case PS_TYPE_ULONG:
+            psVec->vec.ul = p_psVectorRealloc(psVec, psVec->vec.ul, nalloc, sizeof(unsigned long));
+            break;
+        case PS_TYPE_FLOAT:
+            psVec->vec.f = p_psVectorRealloc(psVec, psVec->vec.f, nalloc, sizeof(float));
+            break;
+        case PS_TYPE_DOUBLE:
+            psVec->vec.d = p_psVectorRealloc(psVec, psVec->vec.d, nalloc, sizeof(double));
+            break;
+        case PS_TYPE_COMPLEX:
+            psVec->vec.cf = p_psVectorRealloc(psVec, psVec->vec.cf, nalloc, sizeof(complex float));
+            break;
+        case PS_TYPE_OTHER:
+            break;
+        default:
+            psError(__func__, " : Line %d - Invalid vector type. Type: %d\n", __LINE__, vecType);
+        }
+    }
+
+    return psVec;
+}
+
+void psVectorFree(psVector *restrict psVec)
+{
+    psElemType vecType = 0;
+
+    vecType = psVec->type.type;
+
+    if (psVec == NULL) {
+        return;
+    }
+
+    switch (vecType) {
+    case PS_TYPE_CHAR:
+        psFree(psVec->vec.c);
+        break;
+    case PS_TYPE_SHORT:
+        psFree(psVec->vec.s);
+        break;
+    case PS_TYPE_INT:
+        psFree(psVec->vec.i);
+        break;
+    case PS_TYPE_LONG:
+        psFree(psVec->vec.l);
+        break;
+    case PS_TYPE_UCHAR:
+        psFree(psVec->vec.uc);
+        break;
+    case PS_TYPE_USHORT:
+        psFree(psVec->vec.us);
+        break;
+    case PS_TYPE_UINT:
+        psFree(psVec->vec.ui);
+        break;
+    case PS_TYPE_ULONG:
+        psFree(psVec->vec.ul);
+        break;
+    case PS_TYPE_FLOAT:
+        psFree(psVec->vec.f);
+        break;
+    case PS_TYPE_DOUBLE:
+        psFree(psVec->vec.d);
+        break;
+    case PS_TYPE_COMPLEX:
+        psFree(psVec->vec.cf);
+        break;
+    case PS_TYPE_OTHER:
+        break;
+    default:
+        psError(__func__, " : Line %d - Invalid vector type. Type: %d\n", __LINE__, vecType);
+    }
+
+    // Free vector struct
+    psFree(psVec);
+}
+
+psVector* psVoidPtrVectorAlloc(int nalloc)
+{
+    psVector *psVec = NULL;
+    psVec = psAlloc(sizeof(psVector));
+    psVec->vec.vp = p_psVectorAlloc(psVec, PS_TYPE_OTHER, nalloc, sizeof(void *));
+    return psVec;
+}
+
+psVector *psVoidPtrVectorRealloc(psVector *restrict psVec, int nalloc)
+{
+    int i = 0;
+
+    for (i = nalloc; i < psVec->n; i++) {               // For reduction in vector size
+        psMemDecrRefCounter(psVec->vec.vp[i]);
+    }
+
+    if(psVec == NULL) {                                 // For creating new psVector
+        psVec = psVoidPtrVectorAlloc(nalloc);
+    } else if(psVec->nalloc != nalloc) {                // No need to realloc to same size
+        psVec->vec.vp = p_psVectorRealloc(psVec, psVec->vec.vp, nalloc, sizeof(void *));
+    }
+
+    return psVec;
+}
+
+void psVoidPtrVectorFree(psVector *restrict psVec, void (*elemFree)(void *))
+{
+    int i = 0;
+
+    if(psVec == NULL) {
+        return;
+    }
+
+    for(i = 0; i < psVec->nalloc; i++) {
+        if(elemFree == NULL) {
+            psMemDecrRefCounter(psVec->vec.vp[i]);
+        } else {
+            elemFree(psMemDecrRefCounter(psVec->vec.vp[i]));
+        }
+    }
+
+    // Free pointer vector
+    psFree(psVec->vec.vp);
+    psFree(psVec);
+}
+
Index: /trunk/psLib/src/mathtypes/psVector.h
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.h	(revision 645)
+++ /trunk/psLib/src/mathtypes/psVector.h	(revision 645)
@@ -0,0 +1,200 @@
+/** @file  psVector.h
+ *
+ *  @brief Contains support for basic vector types
+ *
+ *  This file defines types and functions for one dimensional vectors which include: 
+ *      char
+ *      short
+ *      int
+ *      long
+ *      unsigned char
+ *      unsigned short
+ *      unsigned int
+ *      unsigned long
+ *      float
+ *      double
+ *      complex float
+ *      void **
+ *
+ *  @author Ross Harman, MHPCC
+ *   
+ *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-12 18:07:22 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+#ifndef PS_VECTOR_H
+#define PS_VECTOR_H
+
+#include <complex.h>
+
+/******************************************************************************/
+/*  DEFINE STATEMENTS                                                         */
+/******************************************************************************/
+
+// None
+
+/******************************************************************************/
+/*  TYPE DEFINITIONS                                                          */
+/******************************************************************************/
+
+/** Basic data types used by the containers.
+ *
+ * The basic types of the primitives used by psLib are defined within this enum. This enum is in turn used by
+ * the psType struct.
+ *
+ */
+typedef enum {
+    PS_TYPE_CHAR,       ///< Character.
+    PS_TYPE_SHORT,      ///< Short integer.
+    PS_TYPE_INT,        ///< Integer.
+    PS_TYPE_LONG,       ///< Long integer.
+    PS_TYPE_UCHAR,      ///< Unsigned character.
+    PS_TYPE_USHORT,     ///< Unsigned short integer.
+    PS_TYPE_UINT,       ///< Unsigned integer.
+    PS_TYPE_ULONG,      ///< Unsigned long integer.
+    PS_TYPE_FLOAT,      ///< Floating point.
+    PS_TYPE_DOUBLE,     ///< Double-precision floating point.
+    PS_TYPE_COMPLEX,    ///< Complex numbers consisting of floating point.
+    PS_TYPE_OTHER,      ///< Something else that's not supported for arithmetic.
+} psElemType;
+
+/** Dimensions of a data type.
+ *
+ * The dimensions of containers used by psLib are defined within this enum. This enum is used by the psType struct.
+ *
+ */
+typedef enum {
+    PS_DIMEN_SCALAR,    ///< Scalar.
+    PS_DIMEN_VECTOR,    ///< Vector.
+    PS_DIMEN_TRANSV,    ///< Transposed vector.
+    PS_DIMEN_IMAGE,     ///< Image.
+    PS_DIMEN_OTHER      ///< Something else that's not supported for arithmetic.
+} psDimen;
+
+/** The type of a data type.
+ *
+ * All psLib complex types consist of primitive components. This struct provides the description of those 
+ * primitives.
+ *
+ */
+typedef struct
+{
+    psElemType type;    ///< Primitive type.
+    psDimen dimen;      ///< Dimensionality.
+}
+psType;
+
+/** An vector to support primitive types.
+ *
+ * Struct for maintaining an vector of frequently used primitive types.
+ *
+ */
+typedef struct
+{
+    psType type;            ///< Type of data.
+    int nalloc;             ///< Total number of elements available.
+    int n;                  ///< Number of elements in use.
+
+    union {
+        char *c;            ///< Pointers to char integer data.
+        short *s;           ///< Pointers to short integer data.
+        int *i;             ///< Pointers to integer data.
+        long *l;            ///< Pointers to long integer data.
+        unsigned char *uc;  ///< Pointers to unsigned char integer data.
+        unsigned short *us; ///< Pointers to unsigned short integer data.
+        unsigned int *ui;   ///< Pointers to unsigned integer data.
+        unsigned long *ul;  ///< Pointers to unsigned long integer data.
+        float *f;           ///< Pointers to floating point data.
+        double *d;          ///< Pointers to double precision data.
+        complex float *cf;  ///< Pointers to complex floating point data.
+        void **vp;          ///< Void pointer vector.
+    }vec;                   ///< Union for data types.
+}
+psVector;
+
+/*****************************************************************************/
+/* FUNCTION PROTOTYPES                                                       */
+/*****************************************************************************/
+
+/** Allocate a vector.
+ *
+ * Uses psLib memory allocation functions to create a vector collection of data as defined by the psType type.
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+psVector *psVectorAlloc(
+    psType type,    ///< Type of data to be held by vector.
+    int nalloc      ///< Total number of elements to make available.
+);
+
+/** Reallocate a vector.
+ *
+ * Uses psLib memory allocation functions to reallocate a vector collection of data. The vector is reallocated
+ * according to the psType type member contained within the vector. 
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+psVector *psVectorRealloc(
+    psVector *restrict psVec,   ///< Vector to reallocate.
+    int nalloc                  ///< Total number of elements to make available.
+);
+
+/** Deallocate a vector.
+ *
+ * Uses psLib memory allocation functions to deallocate a vector collection of data. The vector is deallocated
+ * according to the psType type member contained within the vector. 
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+void psVectorFree(
+    psVector *restrict psVec  ///< Vector to free.
+);
+
+/** Allocate a void pointer vector.
+ *
+ * Uses psLib memory allocation functions to create a vector of void pointers as defined by the psVoidPtrVector
+ * struct.
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+psVector *psVoidPtrVectorAlloc(
+    int nalloc  ///< Number of elements to use.
+);
+
+/** Reallocate a void pointer vector.
+ *
+ * Uses psLib memory allocation functions to reallocate a vector of void pointers as defined by the 
+ * psVoidPtrVector struct. If the vector size is increased or decreased, this function does not allocate or 
+ * deallocate the contents of individual vector elements. The user must do this after calling this function.
+ *
+ * @return psVector*: Pointer to psVector.
+ *
+ */
+psVector *psVoidPtrVectorRealloc(
+    psVector *restrict psVec,   ///< Void pointer vector to destroy.
+    int nalloc                  ///< Number of elements.
+);
+
+/** Deallocate a void pointer vector.
+ *
+ * Uses psLib memory allocation functions to deallocate a vector of void pointers as defined by the 
+ * psVoidPtrVector struct. This function does not free the vector elements unless the user provides a callback 
+ * function. NULL may be passed as an alternative to supplying a callback, but the user must remember to 
+ * delete the vector elements afterwards. The user must not delete or deallocate the vector elements prior to 
+ * calling this function, as it requires valid elements for memory reference decrementation operations.
+ *
+ * @return: void
+ *
+ */
+void psVoidPtrVectorFree(
+    psVector *restrict psVec,   ///< Void pointer vector to destroy.
+    void (*elemFree)(void *)    ///< Optional callback function to remove vector elements.
+);
+
+#endif
