Index: trunk/archive/pslib/include/psMath.h
===================================================================
--- trunk/archive/pslib/include/psMath.h	(revision 208)
+++ trunk/archive/pslib/include/psMath.h	(revision 218)
@@ -1,101 +1,4 @@
 #if !defined (PS_MATH_H)
 #define PS_MATH_H
-
-typedef enum {				// type of val is:
-    PS_DATA_FLOAT,			// float (.f)
-    PS_DATA_INT,			// int (.i)
-    PS_DATA_ARRAY,			// array (.v)
-    PS_DATA_IMAGE,			// image (.v)
-    PS_DATA_NTYPE			// Number of types; must be last
-} psDataItemType;
-
-/// basic data structure.
-typedef struct {
-    int id;
-    char *name;
-    psDataItemType type;
-    union {
-	float f;
-	int i;
-	void *v;
-    }
-} psDataItem;
-
-psDataItem *
-psDataItemBinaryOp (psDataItem *out,	///< destination value (may be NULL) 
-		    psDataItem *in1,	///< first input value 
-		    char *operator,	///< operator 
-		    psDataItem *in2	///< second input value 
-);
-
-psDataItem *
-psDataItemUnaryOp (psDataItem *out,	///< destination value (may be NULL) 
-		   psDataItem *in1,	///< input value 
-		   char *operator	///< operator 
-);
-
-/*** test: given an image "A", calculate log (a^2) ***/
-
-/*** example 1: data type abstraction */
-
-/*
-psImage A, Y;
-psDI a, b, x, y;
-
-a.v = A;
-a.type = PS_DATA_IMAGE;
-x.f = 2.0;
-x.type = PS_DATA_FLOAT;
-
-b = psDataItemBinaryOp (NULL, a, "^", x);
-y = psDataItemUnaryOp (NULL, b, "log");
-Y = y.v;
-*/
-
-/*** example 2: explicit functions ***/
-
-/*
-psImage A, B, Y;
-
-B = psImageOpScalar (NULL, A, "^", 2.0);
-Y = psImageOp (NULL, B, "log");
-*/
-
-/* in the later example, we would have the following functions */
-
-/// Perform a binary operation on two images.
-psImage *
-psImageOpImage (psImage *out,		///< destination image (may be NULL) 
-		psImage *in1,		///< first input image 
-		char *operator,		///< operator 
-		psImage *in2		///< second input image 
-);
-
-/// Perform a binary operation on two images.
-psImage *
-psImageOpScalar (psImage *out,		///< destination image (may be NULL) 
-		 psImage *in1,		///< input image 
-		 char *operator,	///< operator 
-		 float in2		///< input float 
-);
-
-/// Perform a binary operation on two images.
-psImage *
-psScalarOpImage (psImage *out,		///< destination image (may be NULL) 
-		 float in1,		///< input float 
-		 char *operator,	///< operator 
-		 psImage *in2		///< input image 
-);
-
-/** for a set of N data types, you need a collection of N^2 - 1 functions **/
-
-/*** example 3: embedded data type */
-
-/*
-psImage A, B, Y;
-
-B = psBinaryOp (NULL, A, "^", psScalar(2));
-Y = psUnaryOp (NULL, B, "log");
-*/
 
 /** in this method, the data types (psImage, psVector) include embedded information about their data type in
@@ -106,4 +9,29 @@
  */
 
+/** Perform a binary operation on two data items (psImage, psVector, psScalar). */
+psType *
+psBinaryOp (void *out,			///< destination (may be NULL) 
+	    void *in1,			///< first input
+	    char *operator,		///< operator 
+	    void *in2			///< second input
+);
+
+/** Perform a binary operation on two data items (psImage, psVector, psScalar). */
+psType *
+psUnaryOp (void *out,			///< destination (may be NULL) 
+	   void *in,			///< input
+	   char *operator,		///< operator 
+);
+
+/** create a psType-ed structure from a constant value. */
+p_ps_Scalar *
+psScalar (double value);
+
+/** create a psType-ed structure from a specified type  */
+p_ps_Scalar *
+psScalarType (char *mode, 		///< type description 
+	      ...			///< value (or values) of specified types
+);
+
 typedef struct {
     psType type;
@@ -112,6 +40,31 @@
 	float f;
 	double d;
+	complex float c;
     }
 } p_psScalar;
 
+/* examples of usage:
+
+psImage A, B, C;
+psVector X, Y;
+
+calculate C = sin(A^2)
+
+B = psBinaryOp (NULL, A, "^", psScalar(2));
+C = psUnaryOp (NULL, B, "sin");
+psFree (B);
+
+calculate Y = X^2
+
+Y = psBinaryOp (NULL, Y, "^", psScalar(2));
+
+Y = psBinaryOp (NULL, A, "^", X);
+
+Y = psBinaryOp (NULL, A, "^", psVectorTranspose(X));
+
+psFree (B);
+
+*/
+
+
 #endif
