Index: /trunk/doc/pslib/psLibSDRS.tex
===================================================================
--- /trunk/doc/pslib/psLibSDRS.tex	(revision 337)
+++ /trunk/doc/pslib/psLibSDRS.tex	(revision 338)
@@ -1,5 +1,4 @@
-%%% $Id: psLibSDRS.tex,v 1.16 2004-04-01 02:34:37 eugene Exp $
+%%% $Id: psLibSDRS.tex,v 1.17 2004-04-01 02:40:28 price Exp $
 \documentclass[panstarrs]{panstarrs}
-%\documentclass[panstarrs]{panstarrs}
 
 % basic document variables
@@ -870,15 +869,5 @@
 section~\ref{math}.  
 
-\subsection{Simple Array types}
-
-\begin{verbatim}
-psIntArray
-psFloatArray
-psDoubleArray
-psComplexArray
-psVoidPtrArray
-\end{verbatim}
-
-\subsubsection{Arrays of Simple Types}
+\subsection{Arrays of Simple Types}
 
 We require several types of basic one-dimensional arrays: arrays of
@@ -934,5 +923,5 @@
 functions may be easily generated with C pre-processor macros.
 
-\subsubsection{Arrays of Pointer Types}
+\subsection{Arrays of Pointer Types}
 
 Arrays of pointer types need some additional specification.  We
@@ -1500,4 +1489,10 @@
 psMatrixToVector(psMatrix *myMatrix     ///< Matrix to convert
     );
+
+/** Convert vector to matrix. */
+psImage *
+psVectorToMatrix(psImage *out,		//!< Matrix to return, or NULL
+		 psVector *myVector	//!< Vector to convert
+    );
 \end{verbatim}
 
@@ -2198,5 +2193,6 @@
 images, e.g.\ dividing one image by another, subtracting a vector
 from an image, etc.  Both binary operations and unary operations are
-required.
+required.  To avoid the burden of memorizing a ton of APIs, we specify
+two generic APIs for the binary and unary operations.
 
 \begin{verbatim}
@@ -2212,5 +2208,5 @@
 
 \begin{verbatim}
-/** Perform a binary operation on two data items (psImage, psVector, psScalar).
+/** Perform a unary operation on two data items (psImage, psVector, psScalar).
 */
 psType *
@@ -2227,10 +2223,70 @@
 perform the onerous task of creating the loops.
 
+Vectors are defined as arrays of floats:
+\begin{verbatim}
+/** Define a vector as an array of real numbers */
+typedef psFloatArray psVector;
+#define psVectorAlloc(S,N) psFloatArrayAlloc(S,N) ///< Constructor
+#define psVectorRealloc(A,S) psFloatArrayRealloc(A,S) ///< Reallocator
+#define psVectorFree(A) psFloatArrayFree(A) ///< Destructor
+\end{verbatim}
+
 It is desirable to use the same functions for both vectors and
 images, so inputs are \code{void*}; this necessitates that vectors
 and images each have a type element at a pre-determined and constant
-location in the \code{struct}.  It is further desirable to allow
-scalar values to be used within these functions, which requires the
-following additions:
+location in the \code{struct}.
+
+\begin{verbatim}
+/** The type of a data type */
+typedef struct {
+    psElemType type;			///< The type
+    psDimen dimen;			///< The dimensionality
+} psType;
+
+/** 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;
+\end{verbatim}
+
+Binary operations between an image and a vector have a potential
+ambiguity --- do the vector elements correspond to the rows or the
+columns?  For this reason, we define two vector types: a ``vector''
+(\code{PS_DIMEN_VECTOR}), and a ``transposed vector''
+(\code{PS_DIMEN_TRANSV}).  We specify that a ``vector'', when involved
+in binary operations on an image, acts on the rows, while a
+``transposed vector'' in the same context acts on the columns.
+Vectors, when created, will be created as ``vectors'', but may be
+converted to ``transposed vectors'' using the following function:
+
+\begin{verbatim}
+/** 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{verbatim}
+
+It is further desirable to allow scalar values to be used within these
+functions, which requires the following additions:
 
 \begin{verbatim}
@@ -2859,5 +2915,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-\subsection{Astronomy Images}
+\subsection{Astronomical Images}
 
 \subsubsection{Overview}
