Index: /trunk/archive/pslib/include/psFFT.h
===================================================================
--- /trunk/archive/pslib/include/psFFT.h	(revision 670)
+++ /trunk/archive/pslib/include/psFFT.h	(revision 671)
@@ -14,59 +14,78 @@
  */
 
-/** Forward FFT an image.  Returns a complex float image. */
+/**** Image FFT & Complex functions ****/
+
+/** FFT an image.  in: psF32 or psC32, out: psC32 */
 psImage *
-psImageFFT(const psImage *image		///< Image to transform
-    );
-
-/** Forward FFT an array of floating-point numbers. */
-psFloatArray *
-psFloatArrayFFT(const psFloatArray *arr	///< Array to transform
-    );
-
-/** Inverse FFT an image. */
-psImage *
-psImageInverseFFT(const psImage *fftImage ///< FFT-ed image to inverse-transform
-    );
-
-/** Inverse FFT an array of complex floating-point numbers */
-psComplexArray *
-psComplexArrayInverseFFT(const psComplexArray *fftArray ///< FFT-ed array to inverse-transform
-    );
+psImageFFT(const psImage *image,	///< image to transform (if forward, may be real)
+	   int dir) 			///< FFT direction (1: forward, -1: reverse)
+;
 
 /** Calculate power spectrum of an image */
 psImage *
-psImagePowerSpectrum(const psImage *image ///< Image to obtain power spectrum of
-    );
-
-/** Calculate power spectrum of an array of floating-point numbers */
-psFloatArray *
-psFloatArrayPowerSpectrum(const psFloatArray *arr ///< Array to obtain power spectrum of
-    );
-
-/* The below functions are provided to allow cross-correlations etc. */
+psImagePowerSpectrum(const psImage *image) ///< Image to obtain power spectrum of
+;
 
 /** Get the real part of an image */
 psImage *
 psImageReal(psImage *out,		///< Image for output (or NULL)
-	    const psImage *in		///< Image to get the real part of
-	    );
+	    const psImage *in)		///< Image to get the real part of
+;
 
-/** Get the real part of an array of complex floating-point numbers */
-psFloatArray *
-psComplexArrayReal(psFloatArray *out,	///< Array for output (or NULL)
-		   const psComplexArray *in ///< Array to get the real part of
-    );
+/** Get the imaginary part of an image */
+psImage *
+psImageImaginary(psImage *out,		///< Image for output (or NULL)
+		 const psImage *in)	///< Image to get the imaginary part of
+;
+
+/** Construct a complex image from real & imaginary parts */
+psImage *
+psImageComplex(psImage *out,		///< Image for output (or NULL)
+	       const psImage *real)	///< real part of image
+	       const psImage *imag)	///< imaginary part of image
+;
 
 /** Get the complex conjugate of an image */
 psImage *
 psImageConjugate(psImage *out,		///< Image for output (or NULL)
-		 const psImage *in	///< Image to get the complex conjugate of
-    );
+		 const psImage *in)	///< Image to get the complex conjugate of
+;
 
-/** Get the complex conjugate of an array of complex floating-point numbers */
-psComplexArray *
-psComplexArrayConjugate(psComplexArray *out, ///< Array for output (or NULL)
-			const psComplexArray *in ///< Array to get the complex conjugate of
-    );
+/**** Vector FFT & Complex functions ****/
+
+/** FFT a vector. in: psF32 or psC32, out: psC32 */
+psVector *
+psVectorFFT(const psVector *vector)	///< Vector to transform
+;
+
+/** Calculate power spectrum of a vector of floating-point numbers */
+psVector *
+psVectorPowerSpectrum(const psVector *vector) ///< Vector to obtain power spectrum of
+;
+
+/** Get the real part of a vector */
+psVector *
+psVectorReal(psVector *out,		///< Vector for output (or NULL)
+	     const psVector *in)	///< Vector to get the real part of
+;
+
+/** Get the imaginary part of a vector */
+psVector *
+psVectorImaginary(psVector *out,	///< Vector for output (or NULL)
+	     const psVector *in)	///< Vector to get the imaginary part of
+;
+
+/** Construct a complex vector from real & imaginary parts */
+psVector *
+psVectorComplex(psVector *out,		///< Vector for output (or NULL)
+	       const psVector *real)	///< real part of vector
+	       const psVector *imag)	///< imaginary part of vector
+;
+
+/** Get the complex conjugate of an vector of complex floating-point numbers */
+psVector *
+psVectorConjugate(psVector *out,	///< Vector for output (or NULL)
+		  const psVector *in)	///< Vector to get the complex conjugate of
+;
 
 /* \} */ // End of MathGroup Functions
Index: /trunk/archive/pslib/include/psImage.h
===================================================================
--- /trunk/archive/pslib/include/psImage.h	(revision 670)
+++ /trunk/archive/pslib/include/psImage.h	(revision 671)
@@ -26,5 +26,5 @@
     const struct psImage *parent;	///< parent, if a subimage 
     int Nchildren;			///< number of subimages 
-    struct psImage *children;		///< children of this region; array of Nchildren pointers
+    struct psImage **children;		///< children of this region; array of Nchildren pointers
 } psImage;
 
@@ -40,6 +40,6 @@
 psImageAlloc (int nx,			///< image width 
 	      int ny,			///< image height 
-	      psElemType type		///< image data type 
-    );
+	      psElemType type)		///< image data type 
+;
 
 /// Create a subimage of the specified area.
@@ -49,16 +49,16 @@
 	      int ny,			///< subimage width (<= image.ny - y0)  
 	      int x0,			///< subimage x-offset (0 <= x0 < nx)   
-	      int y0			///< subimage y-offset (0 <= y0 < ny)   
-    );
+	      int y0)			///< subimage y-offset (0 <= y0 < ny)   
+;
 
 /// Destroy the specified image (destroy children if they exist).
 void 
-psImageFree(psImage *restrict image	///< free this image
-    );
+psImageFree(psImage *restrict image)	///< free this image
+;
 
 /** Destroy the pixels of the specified image */
 psImage *
-psImageFreePixels(psImage *restrict image ///< Image whose pixels are to be freed
-    );
+psImageFreePixels(psImage *restrict image) ///< Image whose pixels are to be freed
+;
 
 /// Create a copy of the specified image.
@@ -66,12 +66,12 @@
 psImageCopy(psImage *output, 		///< target structure for output image data
 	    const psImage *input,	///< copy this image 
-	    psElemType type		///< element type of output image
-    );
+	    psElemType type)		///< element type of output image
+;
 
 /*** various image pixel extractions ***/
 
 /// Extract pixels from rectlinear region to a vector.
-psFloatArray *
-psImageSlice(psFloatArray *out,		///< Vector to output, or NULL
+psVector *
+psImageSlice(psVector *out,		///< Vector to output, or NULL
 	     const psImage *input,	///< extract slice from this image
 	     int x, 			///< starting x coord of region to slice
@@ -80,10 +80,10 @@
 	     int ny, 			///< width of region in y
 	     int direction,		///< direction of vector along slice
-	     const psStats *stats	///< defines statistics used to find output values
-    );
+	     const psStats *stats)	///< defines statistics used to find output values
+;
 
 /// Extract pixels along a line to a vector.
-psFloatArray *
-psImageCut(psFloatArray *out,		///< Vector to output, or NULL
+psVector *
+psImageCut(psVector *out,		///< Vector to output, or NULL
 	   const psImage *input,	///< extract cut from this image
 	   float xs, 			///< starting x coord of cut
@@ -92,16 +92,16 @@
 	   float ye, 			///< ending y coord of cut
 	   float dw, 			///< width of cut
-	   const psStats *stats		///< defines statistics used to find output values
-    );
+	   const psStats *stats)		///< defines statistics used to find output values
+;
 
 /// Extract radial annulii data to a vector.
-psFloatArray *
-psImageRadialCut(psFloatArray *out,	///< Vector to output, or NULL
+psVector *
+psImageRadialCut(psVector *out,		///< Vector to output, or NULL
 		 const psImage *input,	///< extract profile from this image
 		 float x, 		///< center x coord of annulii
 		 float y, 		///< center y coord of annulii
-		 const psFloatArray *radii, ///< Radii of the annuli
-		 const psStats *stats	///< defines statistics used to find output values
-    );
+		 const psVector *radii, ///< Radii of the annuli
+		 const psStats *stats)	///< defines statistics used to find output values
+;
 
 /*** various image geometry manipulation ***/
@@ -111,6 +111,6 @@
 	     const psImage *input,	///< rebin this image
 	     float scale, 		///< rebinning scale: doutput = scale*dinput
-	     const psStats *stats	///< defines statistics used to find output values
-    );
+	     const psStats *stats)	///< defines statistics used to find output values
+;
 
 /// Rotate image by given angle.
@@ -118,6 +118,6 @@
 psImageRotate(psImage *out,		///< Image to output, or NULL
 	      const psImage *input,	///< rotate this image
-	      float angle		///< rotate by this amount anti-clockwise (degrees)
-    );
+	      float angle)		///< rotate by this amount anti-clockwise (degrees)
+;
 
 /// Shift image by an arbitrary number of pixels in either direction.
@@ -128,6 +128,6 @@
 	     float dx,			///< shift by this amount in x
 	     float dy,			///< shift by this amount in y
-	     float exposed		///< set exposed pixels to this value
-    );
+	     float exposed)		///< set exposed pixels to this value
+;
 
 /// Roll image by an integer number of pixels in either direction.
@@ -137,30 +137,30 @@
 	    const psImage *input,	///< roll this image
 	    int dx, 			///< roll this amount in x
-	    int dy			///< roll this amount in y
-    );
+	    int dy)			///< roll this amount in y
+;
 
 /// Determine statistics for image (or subimage).
 psStats *
 psImageGetStats(psStats *stats,		///< defines statistics to be calculated & target
-		const psImage *input 	///< image (or subimage) to calculate stats
-		);
+		const psImage *input) 	///< image (or subimage) to calculate stats
+;
 
 /// Construct a histogram from an image (or subimage).
 psHistogram *
 psImageHistogram(psHistogram *hist,	///< input histogram description & target
-		 const psImage *input	///< determine histogram of this image
-    );
+		 const psImage *input)	///< determine histogram of this image
+;
 
 /// Fit a 2-D polynomial surface to an image.
 psPolynomial2D *
 psImageFitPolynomial(psPolynomial2D *coeffs, ///< coefficient structure carries in desired terms & target
-		     const psImage *input ///< image to fit
-    );
+		     const psImage *input) ///< image to fit
+;
 
 /// Evaluate a 2-D polynomial surface to image pixels.
 psImage *
 psImageEvalPolynomial(const psImage *input, ///< image to produce
-		      const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
-    );
+		      const psPolynomial2D *coeffs) ///< coefficient structure carries in desired terms
+;
 
 /*** image input/output routines ***/
@@ -175,6 +175,6 @@
 		   const char *extname,	///< MEF extension name ("PHU" for primary header)
 		   int extnum,		///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-		   const char *filename	///< file to read data from
-    );
+		   const char *filename)	///< file to read data from
+;
 
 /// Read an image or subimage from file descriptor.
@@ -188,6 +188,6 @@
 		    const char *extname, ///< MEF extension name ("PHU" for primary header)
 		    int extnum, 	///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-		    FILE *f		///< file descriptor to read data from		   
-    );
+		    FILE *f)		///< file descriptor to read data from		   
+;
 
 /// Write an image section to named file (which may exist).
@@ -199,6 +199,6 @@
 		    const char *extname, ///< MEF extension name ("PHU" for primary header)
 		    int extnum, 	///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-		    const char *filename ///< file to write data to		   
-    );
+		    const char *filename) ///< file to write data to		   
+;
 
 /// Write an image section to named file (which may exist).
@@ -210,6 +210,6 @@
 		     const char *extname, ///< MEF extension name			   
 		     int extnum, 	///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-		     FILE *f		///< file descriptor to write data to		   
-    );
+		     FILE *f)		///< file descriptor to write data to		   
+;
 
 /// Read only header from image file.
@@ -218,6 +218,6 @@
 		  const char *extname, 	///< MEF extension name ("PHU" for primary header)
 		  int extnum,		///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-		  const char *filename	///< file to read from
-    );
+		  const char *filename)	///< file to read from
+;
 
 /// Read only header from image file descriptor.
@@ -226,6 +226,6 @@
 		   const char *extname,	///< MEF extension name ("PHU" for primary header)
 		   int extnum,		///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
-		   FILE *f		///< file descriptor to read from
-    );
+		   FILE *f)		///< file descriptor to read from
+;
 
 /*** basic pixel manipulations ***/
@@ -236,12 +236,12 @@
 	    float vmin, 		///< set min-clipped pixels to vmin
 	    float max,			///< clip pixels with values > max
-	    float vmax			///< set max-clipped pixels to vmax
-    );
+	    float vmax)			///< set max-clipped pixels to vmax
+;
 
 /// Clip NaN image pixels to given value.  Return number of clipped pixels.
 int
 psImageClipNaN(psImage *input,		///< clip this image & target
-	       float value		///< set nan pixels to this value
-    );
+	       float value)		///< set nan pixels to this value
+;
 
 /// Overlay subregion of image with another image.  Return number of pixels replaced.
@@ -251,6 +251,6 @@
 		      int x0,		///< x offset of overlay subimage 
 		      int y0,		///< y offset of overlay subimage 
-		      const char *op	///< overlay operation 
-    );
+		      const char *op)	///< overlay operation 
+;
 
 /* \} */ // End of AstroGroup Functions
Index: /trunk/archive/pslib/include/psLib.h
===================================================================
--- /trunk/archive/pslib/include/psLib.h	(revision 670)
+++ /trunk/archive/pslib/include/psLib.h	(revision 671)
@@ -16,5 +16,4 @@
 /** @defgroup AstroGroup Astronomy-Specific Utilities */
 
-
 /** @ingroup SystemGroup */
 # include <psMemory.h>
@@ -25,5 +24,6 @@
 
 /** @ingroup DataGroup */
-# include <psStdArrays.h>
+# include <psTypes.h>
+# include <psVectors.h>
 # include <psHash.h>
 # include <psDlist.h>
Index: /trunk/archive/pslib/include/psMinimize.h
===================================================================
--- /trunk/archive/pslib/include/psMinimize.h	(revision 670)
+++ /trunk/archive/pslib/include/psMinimize.h	(revision 671)
@@ -13,30 +13,30 @@
 
 /** Find the minimum of a particular non-linear function */
-psFloatArray *
-psMinimize(psFloatArray *restrict initialGuess,	///< Initial guess and answer
-	   float (*myFunction)(const psFloatArray *restrict), ///< Function to minimize
-	   float (*myFuncDeriv)(const psFloatArray *restrict), ///< Derivatives of function, or NULL
-	   const psIntArray *restrict paramMask //!< 1 = fit for parameter, 0 = hold parameter constant
-	   );
+psVector *
+psMinimize(psVector *restrict initialGuess, ///< Initial guess and answer
+	   float (*myFunction)(const psVector *restrict), ///< Function to minimize
+	   float (*myFuncDeriv)(const psVector *restrict), ///< Derivatives of function, or NULL
+	   const psVector *restrict paramMask) ///< 1 = fit for parameter, 0 = hold parameter constant
+;
 
 
 /** Minimize chi^2 for input data */
-psFloatArray *
-psMinimizeChi2(psFloatArray *restrict initialGuess, ///< Initial guess and answer
-	       float (*evalModel)(const psFloatArray *restrict,
-				  const psFloatArray *restrict), ///< Model to fit; (domain and params)
-	       const psFloatArray *restrict domain, ///< The domain values for the corresponding measurements
-	       const psFloatArray *restrict data, ///< Data to fit
-	       const psFloatArray *restrict errors, ///< Errors in the data
-	       const psIntArray *restrict paramMask ///< 1 = fit for parameter, 0 = hold parameter constant
-    );
+psVector *
+psMinimizeChi2(psVector *restrict initialGuess,	///< Initial guess and answer
+	       float (*evalModel)(const psVector *restrict,
+				  const psVector *restrict), ///< Model to fit; (domain and params)
+	       const psVector *restrict domain, ///< The domain values for the corresponding measurements
+	       const psVector *restrict data, ///< Data to fit
+	       const psVector *restrict errors, ///< Errors in the data
+	       const psVector *restrict paramMask) ///< 1 = fit for parameter, 0 = hold parameter constant
+;
 
 /** Derive a polynomial fit by chi^2 minimisation --- can be done analytically */
 psPolynomial1D *
-psGetArrayPolynomial(psPolynomial1D myPoly, ///< Polynomial to fit
-		     const psFloatArray *restrict x, ///< Ordinates (or NULL to just use the indices)
-		     const psFloatArray *restrict y, ///< Coordinates
-		     const psFloatArray *restrict yErr ///< Errors in coordinates, or NULL
-    );
+psVectorFitPolynomial(psPolynomial1D myPoly, ///< Polynomial to fit
+		     const psVector *restrict x, ///< Ordinates (or NULL to just use the indices)
+		     const psVector *restrict y, ///< Coordinates
+		     const psVector *restrict yErr) ///< Errors in coordinates, or NULL
+;
 
 /* \} */ // End of MathGroup Functions
Index: /trunk/archive/pslib/include/psSort.h
===================================================================
--- /trunk/archive/pslib/include/psSort.h	(revision 670)
+++ /trunk/archive/pslib/include/psSort.h	(revision 671)
@@ -13,14 +13,14 @@
 
 /** Sort an array. Inputs not restrict-ed to allow sort in place */
-psFloatArray *
-psSort(psFloatArray *out,		///< Sorted array to return. May be NULL
-       const psFloatArray *restrict myArray	///< Array to sort
-    );
+psVector *
+psSort(psVector *out,			///< Sorted array to return. May be NULL
+       const psVector *restrict in)	///< Array to sort
+;
 
 /** Sort an array, along with some other stuff.  Returns an index array */
-psIntArray *
-psSortIndex(psIntArray *restrict out,	///< Output index array (may be NULL)
-	    const psFloatArray *restrict myArray ///< Array to sort
-    );
+psVector *
+psSortIndex(psVector *restrict out,	///< Output index array (may be NULL)
+	    const psVector *restrict in) ///< Array to sort
+;
 
 /* \} */ // End of MathGroup Functions
Index: /trunk/archive/pslib/include/psStats.h
===================================================================
--- /trunk/archive/pslib/include/psStats.h	(revision 670)
+++ /trunk/archive/pslib/include/psStats.h	(revision 671)
@@ -39,11 +39,11 @@
     double sampleUQ;			///< upper quartile of sample
     double sampleLQ;			///< lower quartile of sample
-    double robustMean;			///< robust mean of array
+    double robustMean;			///< robust mean of data
     int    robustMeanNvalues;		///< number of measurements used for robust mean
-    double robustMedian;		///< robust median of array
+    double robustMedian;		///< robust median of data
     int    robustMedianNvalues;		///< number of measurements used for robust median
-    double robustMode;			///< Robust mode of array
+    double robustMode;			///< Robust mode of data
     int    robustModeNvalues;		///< Number of measurements used for robust mode
-    double robustStdev;			///< robust standard deviation of array
+    double robustStdev;			///< robust standard deviation of data
     double robustUQ;			///< robust upper quartile
     double robustLQ;			///< robust lower quartile
@@ -53,29 +53,29 @@
     double clipSigma;			///< Nsigma used for clipping; user input
     int    clipIter;			///< Number of clipping iterations; user input
-    double min;				///< minimum data value in array
-    double max;				///< maximum data value in array
-    int    nValues;			///< number of data values in array
+    double min;				///< minimum data value in data
+    double max;				///< maximum data value in data
+    int    nValues;			///< number of data values in data
     psStatsOptions options;		///< bitmask of calculated values
 } psStats;
 
 
-/** Do Statistics on an array.  Returns a status value. \ingroup MathGroup */
+/** Do Statistics on a vector.  Returns a status value. \ingroup MathGroup */
 psStats *
-psArrayStats(psStats *stats,		///< stats structure defines stats to be calculated, how and result
-	     const psFloatArray *restrict myArray, ///< Array to be analysed
-	     const psIntArray *restrict maskArray, ///< Ignore elements where (maskArray & maskVal) != 0
-						   ///< May be NULL
-	     unsigned int maskVal	///< Only mask elements with one of these bits set in maskArray
-    );
+psVectorStats(psStats *stats,		///< stats structure defines stats to be calculated, how and result
+	     const psVector *restrict myArray, ///< Array to be analysed
+	     const psVector *restrict maskArray, ///< Ignore elements where (maskArray & maskVal) != 0
+					///< May be NULL
+	     unsigned int maskVal)	///< Only mask elements with one of these bits set in maskArray
+;
 
 /** Constructor */
 psStats *
-psStatsAlloc(psStatsOptions options	///< Statistics to measure
-    );
+psStatsAlloc(psStatsOptions options)	///< Statistics to measure
+;
 
 /** Destructor */
 void
-psStatsFree(psStats *restrict stats	///< Stats structure to destroy
-    );
+psStatsFree(psStats *restrict stats)	///< Stats structure to destroy
+;
 
 /***********************************************************************************************************/
@@ -83,6 +83,6 @@
 /** Histograms  */
 typedef struct {
-    const psFloatArray *restrict bounds; ///< Bounds for the bins
-    psIntArray *nums;			///< Number in each of the bins
+    const psVector *restrict bounds;	///< Bounds for the bins
+    psVector *nums;			///< Number in each of the bins
     const float minVal, maxVal;		///< Minimum and maximum values
     int minNum, maxNum;			///< Number below the minimum and above the maximum
@@ -94,25 +94,25 @@
 psHistogramAlloc(float lower,		///< Lower limit for the bins
 		 float upper,		///< Upper limit for the bins
-		 int n			///< Number of the bins
-    );
+		 int n)			///< Number of the bins
+;
 
 /** Generic constructor \ingroup MathGroup */
 psHistogram *
-psHistogramAllocGeneric(const psFloatArray *restrict bounds, ///< Bounds for the bins
+psHistogramAllocGeneric(const psVector *restrict bounds, ///< Bounds for the bins
 			float minVal,	///< Minimum value
-			float maxVal	///< Maximum value
-    );
+			float maxVal)	///< Maximum value
+;
 
 /** Destructor \ingroup MathGroup **/
 void
-psHistogramFree(psHistogram *restrict myHist ///< Histogram to destroy
-    );
+psHistogramFree(psHistogram *restrict myHist) ///< Histogram to destroy
+;
 
 
 /** Calculate a histogram \ingroup MathGroup **/
 psHistogram *
-psGetArrayHistogram(psHistogram *restrict myHist, ///< Histogram data
-		    const psFloatArray *restrict myArray ///< Array to analyse
-    );
+psVectorHistogram(psHistogram *restrict myHist, ///< Histogram data
+		  const psVector *restrict myArray) ///< Array to analyse
+;
 
 #endif
Index: unk/archive/pslib/include/psStdArrays.h
===================================================================
--- /trunk/archive/pslib/include/psStdArrays.h	(revision 670)
+++ 	(revision )
@@ -1,202 +1,0 @@
-#if !defined(PS_TYPES_H)
-#define PS_TYPES_H
-
-/** \file psStdArrays.h
- *  \brief Support for basic flat arrays
- *  \ingroup DataGroup
- */
-
-/** Types of the elements of vectors, images, etc. */
-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 */
-typedef enum {
-    PS_DIMEN_SCALAR,			///< Scalar
-    PS_DIMEN_VECTOR,			///< A vector
-    PS_DIMEN_TRANSV,			///< A transposed vector
-    PS_DIMEN_IMAGE,			///< An image
-    PS_DIMEN_OTHER			///< Something else that's not supported for arithmetic
-} psDimen;
-
-/** The type of a data type */
-typedef struct {
-    psElemType type;			///< The type
-    psDimen dimen;			///< The dimensionality
-} psType;
-
-/************************************************************************************************************/
-
-/**
- * ps- typedefs. These should NOT be used generally, but only where the number of bits in a type must be
- * guaranteed, or for use in macros to preserve the standard naming conventions.
- */
-typedef float          psFloat;         ///< BITPIX -32 (float)
-typedef float          psF32;		///< BITPIX -32 (float)
-typedef double         psDouble;
-typedef double         psF64;		///< BITPIX -64 (double)
-
-typedef complex float  psComplex;
-
-typedef int8_t         psS8;
-typedef int16_t        psS16;
-typedef int32_t        psS32;
-typedef int64_t        psS64;
-typedef int8_t         psChar;
-typedef int16_t        psShort;
-typedef int32_t        psInt;
-typedef int64_t        psLong;
-
-typedef uint8_t        psU8;		///< BITPIX 8   
-typedef uint16_t       psU16;		///< BITPIX 16  
-typedef uint32_t       psU32;		///< BITPIX 32  
-typedef uint64_t       psU64;		
-typedef uint8_t        psUchar;		///< BITPIX 8   
-typedef uint16_t       psUshort;	///< BITPIX 16  
-typedef uint32_t       psUint;		///< BITPIX 32  
-typedef uint64_t       psUlong;		
-
-/************************************************************************************************************/
-
-/** An array of real numbers */
-typedef struct {
-    psType type;			///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
-    int nAlloc;				///< Total number of elements available
-    int n;				///< Number of elements in use
-    float *arr;				///< The array data
-} psFloatArray;
-
-/** Constructor \ingroup DataGroup */
-psFloatArray *psFloatArrayAlloc(int nAlloc)	///< Total number of elements to make available
-;
-
-/** Reallocator \ingroup DataGroup */
-psFloatArray *psFloatArrayRealloc(psFloatArray *myArray, ///< Array to reallocate
-				  int nAlloc) ///< Total number of elements to make available
-;
-
-/** Destructor \ingroup DataGroup */
-void psFloatArrayFree(psFloatArray *restrict myArray) ///< Array to free
-;
-
-/************************************************************************************************************/
-
-/** Define a vector as an array of real numbers */
-typedef psFloatArray psVector;
-#define psVectorAlloc(N) psFloatArrayAlloc(N) ///< Constructor
-#define psVectorRealloc(A,N) psFloatArrayRealloc(A,N) ///< Reallocator
-#define psVectorFree(A) psFloatArrayFree(A) ///< Destructor
-
-/** Transpose a vector.  Changes the type to a PS_DIMEN_TRANSV */
-psVector *psVectorTranspose(psVector *out, ///< Output vector, or NULL
-			    psVector *myVector) ///< Vector to be transposed
-;
-
-/************************************************************************************************************/
-
-/** An array of complex numbers */
-typedef struct {
-    psType type;			///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
-    int nAlloc;				///< Total number of elements available
-    int n;				///< Number of elements in use
-    complex float *arr;			///< The array data
-} psComplexArray;
-
-/** Constructor \ingroup DataGroup */
-psComplexArray *psComplexArrayAlloc(int nAlloc) ///< Total number of elements to make available
-;
-
-/** Reallocator \ingroup DataGroup */
-psComplexArray *psComplexArrayRealloc(psComplexArray *myArray, ///< Array to reallocate
-				      int nAlloc)	///< Total number of elements to make available
-;
-
-/** Destructor \ingroup DataGroup */
-void psComplexArrayFree(psComplexArray *restrict myArray) ///< Array to free
-;
-
-/************************************************************************************************************/
-
-/** An array of integers */
-typedef struct {
-    psType type;			///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
-    int nAlloc;				///< Total number of elements available
-    int n;				///< Number of elements in use
-    int *arr;				///< The array data
-} psIntArray;
-
-/** Constructor \ingroup DataGroup */
-psIntArray *psIntArrayAlloc(int nAlloc)	///< Total number of elements to make available
-;
-
-/** Reallocator \ingroup DataGroup */
-psIntArray *psIntArrayRealloc(psIntArray *myArray, ///< Array to reallocate
-			      int nAlloc)	///< Total number of elements to make available
-;
-
-/** Destructor \ingroup DataGroup */
-void psIntArrayFree(psIntArray *restrict myArray) ///< Array to free
-;
-
-/************************************************************************************************************/
-
-/** An array of double-precision real numbers */
-typedef struct {
-    psType type;			///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
-    int nAlloc;				///< Total number of elements available
-    int n;				///< Number of elements in use
-    double *arr;			///< The array data
-} psDoubleArray;
-
-/** Constructor \ingroup DataGroup */
-psDoubleArray *psDoubleArrayAlloc(int nAlloc) ///< Total number of elements to make available
-;
-
-/** Reallocator \ingroup DataGroup */
-psDoubleArray *psDoubleArrayRealloc(psDoubleArray *myArray, ///< Array to reallocate
-				    int nAlloc)	///< Total number of elements to make available
-;
-
-/** Destructor \ingroup DataGroup */
-void psDoubleArrayFree(psDoubleArray *restrict myArray) ///< Array to free
-;
-
-/*****************************************************************************/
-/** Array of pointers to void.
- *  psVoidPtrArray is special, as it needs to have a destructor that
- *  accepts a destructor for the array elements
- */
-typedef struct {
-    psType type;			///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT
-    int n;				///< Number of elements in use 
-    int nAlloc;				///< Number of total elements
-    void **arr;				///< The elements
-} psVoidPtrArray;
-
-/** Constructor \ingroup DataGroup */
-psVoidPtrArray *psVoidPtrArrayAlloc(int nAlloc) ///< Number of elements to use
-;
-
-/** Reallocate \ingroup DataGroup */
-psVoidPtrArray *psVoidPtrArrayRealloc(psVoidPtrArray *arr, ///< Array to reallocate
-				      int nAlloc) ///< Number of elements
-;
-
-/** Destructor \ingroup DataGroup */
-void psVoidPtrArrayFree(psVoidPtrArray *arr, ///< array to destroy
-			void (*elemFree)(void *)) ///< destructor for array data
-;
-
-#endif
Index: /trunk/archive/pslib/include/psType.h
===================================================================
--- /trunk/archive/pslib/include/psType.h	(revision 671)
+++ /trunk/archive/pslib/include/psType.h	(revision 671)
@@ -0,0 +1,70 @@
+#if !defined(PS_TYPES_H)
+#define PS_TYPES_H
+
+/** \file psStdArrays.h
+ *  \brief Support for basic flat arrays
+ *  \ingroup DataGroup
+ */
+
+/** Types of the elements of vectors, images, etc. */
+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 */
+typedef enum {
+    PS_DIMEN_SCALAR,			///< Scalar
+    PS_DIMEN_VECTOR,			///< A vector
+    PS_DIMEN_TRANSV,			///< A transposed vector
+    PS_DIMEN_IMAGE,			///< An image
+    PS_DIMEN_OTHER			///< Something else that's not supported for arithmetic
+} psDimen;
+
+/** The type of a data type */
+typedef struct {
+    psElemType type;			///< The type
+    psDimen dimen;			///< The dimensionality
+} psType;
+
+/************************************************************************************************************/
+
+/**
+ * ps- typedefs. These should NOT be used generally, but only where the number of bits in a type must be
+ * guaranteed, or for use in macros to preserve the standard naming conventions.
+ */
+typedef float          psFloat;         ///< BITPIX -32 (float)
+typedef float          psF32;		///< BITPIX -32 (float)
+typedef double         psDouble;
+typedef double         psF64;		///< BITPIX -64 (double)
+
+typedef complex float  psComplex;
+
+typedef int8_t         psS8;
+typedef int16_t        psS16;
+typedef int32_t        psS32;
+typedef int64_t        psS64;
+typedef int8_t         psChar;
+typedef int16_t        psShort;
+typedef int32_t        psInt;
+typedef int64_t        psLong;
+
+typedef uint8_t        psU8;		///< BITPIX 8   
+typedef uint16_t       psU16;		///< BITPIX 16  
+typedef uint32_t       psU32;		///< BITPIX 32  
+typedef uint64_t       psU64;		
+typedef uint8_t        psUchar;		///< BITPIX 8   
+typedef uint16_t       psUshort;	///< BITPIX 16  
+typedef uint32_t       psUint;		///< BITPIX 32  
+typedef uint64_t       psUlong;		
+
Index: /trunk/archive/pslib/include/psVector.h
===================================================================
--- /trunk/archive/pslib/include/psVector.h	(revision 671)
+++ /trunk/archive/pslib/include/psVector.h	(revision 671)
@@ -0,0 +1,68 @@
+# ifndef PS_VECTOR_H
+# define PS_VECTOR_H
+
+/** \file psVector.h
+ *  \brief Basic vector definitions and operations.
+ *  \ingroup DataGroup
+ */
+
+/// basic vector data structure.
+typedef struct {
+    psType type; 			///< vector data type and dimension
+    const int n;			///< size of vector 
+    const int nalloc;			///< data region relative to parent 
+    union {
+	float *arr;			///< Pointers to floating-point data (default)
+	short int *arr_si;		///< Pointers to short-integer data
+	int *arr_i;			///< Pointers to integer data
+	long int *arr_li;		///< Pointers to long-integer data
+	unsigned short int *arr_usi;	///< Pointers to unsigned-short-integer data
+	unsigned int *arr_ui;		///< Pointers to unsigned-integer data
+	unsigned long int *arr_uli;	///< Pointers to unsigned-long-integer data
+	float *arr_f;			///< Pointers to floating-point data
+	double *arr_d;		        ///< Pointers to double-precision data
+	complex float *arr_complex;	///< Pointers to complex floating-point data
+	void **arr_v;
+    } arr;
+} psVector;
+
+/** Functions **************************************************************/
+/** \addtogroup DataGroup Astronomy-Specific Utilities
+ *  \{
+ */
+
+/*** Vector structure manipulation ***/
+
+/// Create a vector of the specified size and type.
+psVector *
+psVectorAlloc (int nalloc,		///< vector length 
+	       psElemType type		///< vector data type 
+    );
+
+/// Extend a vector 
+psVector *
+psVectorRealloc (int nalloc,		///< vector length 
+		 psElemType type	///< vector data type 
+    );
+
+/// Create a subvector of the specified range.
+psVector *
+psVectorSubset(const psVector *vector,	///< parent vector 
+	       int start, 		///< subvector range start 
+	       int end			///< subvector range end 
+    );
+
+/// Destroy the specified vector
+void 
+psVectorFree(psVector *restrict vector	///< free this vector
+	     void (*elemFree)(void *))  ///< destructor for array data
+;
+
+/** Transpose a vector.  Changes the type to a PS_DIMEN_TRANSV */
+psVector *psVectorTranspose(psVector *out, ///< Output vector, or NULL
+			    psVector *myVector) ///< Vector to be transposed
+;
+
+/* \} */ // End of DataGroup Functions
+
+#endif
