Index: /trunk/psLib/src/dataManip/psConstants.h
===================================================================
--- /trunk/psLib/src/dataManip/psConstants.h	(revision 2761)
+++ /trunk/psLib/src/dataManip/psConstants.h	(revision 2762)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-17 00:18:31 $
+ *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-20 21:39:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -429,9 +429,30 @@
 }
 
-
+#define PS_IMAGE_PRINT_F32(NAME) \
+printf("======== printing %s ========\n", #NAME); \
+for (int i = 0 ; i < NAME->numRows ; i++) { \
+    for (int j = 0 ; j < NAME->numCols ; j++) { \
+        printf("%.2f ", NAME->data.F32[i][j]); \
+    } \
+    printf("\n"); \
+}\
+
+#define PS_IMAGE_SET_F32(NAME, VALUE) \
+for (int i = 0 ; i < NAME->numRows ; i++) { \
+    for (int j = 0 ; j < NAME->numCols ; j++) { \
+        NAME->data.F32[i][j] = VALUE; \
+    } \
+}\
+
+#define PS_IMAGE_SET_U8(NAME, VALUE) \
+for (int i = 0 ; i < NAME->numRows ; i++) { \
+    for (int j = 0 ; j < NAME->numCols ; j++) { \
+        NAME->data.U8[i][j] = VALUE; \
+    } \
+}\
 
 /*****************************************************************************
     PS_READOUT macros:
- *****************************************************************************/
+*****************************************************************************/
 #define PS_READOUT_CHECK_NULL(NAME, RVAL) \
 if (NAME == NULL || NAME->image == NULL) { \
Index: /trunk/psLib/src/dataManip/psStats.c
===================================================================
--- /trunk/psLib/src/dataManip/psStats.c	(revision 2761)
+++ /trunk/psLib/src/dataManip/psStats.c	(revision 2762)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.103 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-16 23:04:18 $
+ *  @version $Revision: 1.104 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-20 21:39:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -793,7 +793,10 @@
         }
     }
-    if (countInt <= 1) {
+    if (countInt == 0) {
         stats->sampleStdev = NAN;
-        psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): no valid psVector elements.  Setting stats->sampleStdev = NAN.\n");
+        psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): no valid psVector elements (%d).  Setting stats->sampleStdev = NAN.\n", countInt);
+    } else if (countInt == 1) {
+        stats->sampleStdev = 0.0;
+        psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): only one valid psVector elements (%d).  Setting stats->sampleStdev = 0.0.\n", countInt);
     } else {
         countFloat = (float)countInt;
Index: /trunk/psLib/src/image/psImage.c
===================================================================
--- /trunk/psLib/src/image/psImage.c	(revision 2761)
+++ /trunk/psLib/src/image/psImage.c	(revision 2762)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-16 20:00:21 $
+ *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-20 21:39:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -396,4 +396,6 @@
 
 /*****************************************************************************
+XXX: update function description.
+ 
 p_psImagePixelInterpolation(image, x, y): this routine takes as input an
 image and coordinates (x, y) and produces as output the corresponding pixel
Index: /trunk/psLib/src/image/psImageStats.c
===================================================================
--- /trunk/psLib/src/image/psImageStats.c	(revision 2761)
+++ /trunk/psLib/src/image/psImageStats.c	(revision 2762)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-16 21:58:55 $
+ *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-20 21:39:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -450,16 +450,7 @@
 XXX: Use static variables for Chebyshev polynomials and scaling factors. 
  *****************************************************************************/
-psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs)
-{
-    PS_IMAGE_CHECK_NULL(input, NULL);
-    PS_IMAGE_CHECK_EMPTY(input, NULL);
-    if ((input->type.type != PS_TYPE_S8) &&
-            (input->type.type != PS_TYPE_U16) &&
-            (input->type.type != PS_TYPE_F32) &&
-            (input->type.type != PS_TYPE_F64)) {
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                "Unallowable image type.\n");
-    }
-    PS_POLY_CHECK_NULL(coeffs, NULL);
+psImage* p_psImageEvalPolynomialCheb(psImage* input,
+                                     const psPolynomial2D* coeffs)
+{
     PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL);
 
@@ -525,2 +516,54 @@
     return input;
 }
+
+psImage* p_psImageEvalPolynomialOrd(psImage* input,
+                                    const psPolynomial2D* coeffs)
+{
+    PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_ORD, NULL);
+
+    for (int row = 0; row < input->numRows ; row++) {
+        for (int col = 0; col < input->numCols ; col++) {
+            if (input->type.type == PS_TYPE_S8) {
+                input->data.S8[row][col] = (psS8) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
+            } else if (input->type.type == PS_TYPE_U16) {
+                input->data.U16[row][col] = (psS16) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
+            } else if (input->type.type == PS_TYPE_F32) {
+                input->data.F32[row][col] = psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
+            } else if (input->type.type == PS_TYPE_F64) {
+                input->data.F64[row][col] = (psF64) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
+            }
+        }
+    }
+
+    return(input);
+}
+
+
+/*****************************************************************************
+XXX: I added normal polynomials to this routine.  Let IfA know, put it in the
+psLib SDR.
+ *****************************************************************************/
+psImage* psImageEvalPolynomial(psImage* input,
+                               const psPolynomial2D* coeffs)
+{
+    PS_IMAGE_CHECK_NULL(input, NULL);
+    PS_IMAGE_CHECK_EMPTY(input, NULL);
+    if ((input->type.type != PS_TYPE_S8) &&
+            (input->type.type != PS_TYPE_U16) &&
+            (input->type.type != PS_TYPE_F32) &&
+            (input->type.type != PS_TYPE_F64)) {
+        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
+                "Unallowable image type.\n");
+    }
+    PS_POLY_CHECK_NULL(coeffs, NULL);
+
+    if (coeffs->type == PS_POLYNOMIAL_ORD) {
+        return(p_psImageEvalPolynomialOrd(input, coeffs));
+    } else if (coeffs->type == PS_POLYNOMIAL_CHEB) {
+        return(p_psImageEvalPolynomialCheb(input, coeffs));
+    }
+    printf("XXX: Error: wrong polynomial type\n");
+    // XXX: psError()
+    return(NULL);
+}
+
Index: /trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.c	(revision 2761)
+++ /trunk/psLib/src/imageops/psImageStats.c	(revision 2762)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-16 21:58:55 $
+ *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-20 21:39:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -450,16 +450,7 @@
 XXX: Use static variables for Chebyshev polynomials and scaling factors. 
  *****************************************************************************/
-psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs)
-{
-    PS_IMAGE_CHECK_NULL(input, NULL);
-    PS_IMAGE_CHECK_EMPTY(input, NULL);
-    if ((input->type.type != PS_TYPE_S8) &&
-            (input->type.type != PS_TYPE_U16) &&
-            (input->type.type != PS_TYPE_F32) &&
-            (input->type.type != PS_TYPE_F64)) {
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                "Unallowable image type.\n");
-    }
-    PS_POLY_CHECK_NULL(coeffs, NULL);
+psImage* p_psImageEvalPolynomialCheb(psImage* input,
+                                     const psPolynomial2D* coeffs)
+{
     PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL);
 
@@ -525,2 +516,54 @@
     return input;
 }
+
+psImage* p_psImageEvalPolynomialOrd(psImage* input,
+                                    const psPolynomial2D* coeffs)
+{
+    PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_ORD, NULL);
+
+    for (int row = 0; row < input->numRows ; row++) {
+        for (int col = 0; col < input->numCols ; col++) {
+            if (input->type.type == PS_TYPE_S8) {
+                input->data.S8[row][col] = (psS8) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
+            } else if (input->type.type == PS_TYPE_U16) {
+                input->data.U16[row][col] = (psS16) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
+            } else if (input->type.type == PS_TYPE_F32) {
+                input->data.F32[row][col] = psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
+            } else if (input->type.type == PS_TYPE_F64) {
+                input->data.F64[row][col] = (psF64) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col);
+            }
+        }
+    }
+
+    return(input);
+}
+
+
+/*****************************************************************************
+XXX: I added normal polynomials to this routine.  Let IfA know, put it in the
+psLib SDR.
+ *****************************************************************************/
+psImage* psImageEvalPolynomial(psImage* input,
+                               const psPolynomial2D* coeffs)
+{
+    PS_IMAGE_CHECK_NULL(input, NULL);
+    PS_IMAGE_CHECK_EMPTY(input, NULL);
+    if ((input->type.type != PS_TYPE_S8) &&
+            (input->type.type != PS_TYPE_U16) &&
+            (input->type.type != PS_TYPE_F32) &&
+            (input->type.type != PS_TYPE_F64)) {
+        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
+                "Unallowable image type.\n");
+    }
+    PS_POLY_CHECK_NULL(coeffs, NULL);
+
+    if (coeffs->type == PS_POLYNOMIAL_ORD) {
+        return(p_psImageEvalPolynomialOrd(input, coeffs));
+    } else if (coeffs->type == PS_POLYNOMIAL_CHEB) {
+        return(p_psImageEvalPolynomialCheb(input, coeffs));
+    }
+    printf("XXX: Error: wrong polynomial type\n");
+    // XXX: psError()
+    return(NULL);
+}
+
Index: /trunk/psLib/src/math/psConstants.h
===================================================================
--- /trunk/psLib/src/math/psConstants.h	(revision 2761)
+++ /trunk/psLib/src/math/psConstants.h	(revision 2762)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-17 00:18:31 $
+ *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-20 21:39:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -429,9 +429,30 @@
 }
 
-
+#define PS_IMAGE_PRINT_F32(NAME) \
+printf("======== printing %s ========\n", #NAME); \
+for (int i = 0 ; i < NAME->numRows ; i++) { \
+    for (int j = 0 ; j < NAME->numCols ; j++) { \
+        printf("%.2f ", NAME->data.F32[i][j]); \
+    } \
+    printf("\n"); \
+}\
+
+#define PS_IMAGE_SET_F32(NAME, VALUE) \
+for (int i = 0 ; i < NAME->numRows ; i++) { \
+    for (int j = 0 ; j < NAME->numCols ; j++) { \
+        NAME->data.F32[i][j] = VALUE; \
+    } \
+}\
+
+#define PS_IMAGE_SET_U8(NAME, VALUE) \
+for (int i = 0 ; i < NAME->numRows ; i++) { \
+    for (int j = 0 ; j < NAME->numCols ; j++) { \
+        NAME->data.U8[i][j] = VALUE; \
+    } \
+}\
 
 /*****************************************************************************
     PS_READOUT macros:
- *****************************************************************************/
+*****************************************************************************/
 #define PS_READOUT_CHECK_NULL(NAME, RVAL) \
 if (NAME == NULL || NAME->image == NULL) { \
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 2761)
+++ /trunk/psLib/src/math/psStats.c	(revision 2762)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.103 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-16 23:04:18 $
+ *  @version $Revision: 1.104 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-20 21:39:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -793,7 +793,10 @@
         }
     }
-    if (countInt <= 1) {
+    if (countInt == 0) {
         stats->sampleStdev = NAN;
-        psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): no valid psVector elements.  Setting stats->sampleStdev = NAN.\n");
+        psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): no valid psVector elements (%d).  Setting stats->sampleStdev = NAN.\n", countInt);
+    } else if (countInt == 1) {
+        stats->sampleStdev = 0.0;
+        psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): only one valid psVector elements (%d).  Setting stats->sampleStdev = 0.0.\n", countInt);
     } else {
         countFloat = (float)countInt;
Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 2761)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 2762)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-16 20:00:21 $
+ *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-20 21:39:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -396,4 +396,6 @@
 
 /*****************************************************************************
+XXX: update function description.
+ 
 p_psImagePixelInterpolation(image, x, y): this routine takes as input an
 image and coordinates (x, y) and produces as output the corresponding pixel
