Index: /trunk/psLib/src/collections/psVector.h
===================================================================
--- /trunk/psLib/src/collections/psVector.h	(revision 1981)
+++ /trunk/psLib/src/collections/psVector.h	(revision 1982)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-05 01:43:57 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:52 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -59,4 +59,5 @@
 
 /*****************************************************************************/
+
 
 /** Allocate a vector.
Index: /trunk/psLib/src/dataManip/psFunctions.c
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.c	(revision 1981)
+++ /trunk/psLib/src/dataManip/psFunctions.c	(revision 1982)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-06 00:48:15 $
+ *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -2074,5 +2074,5 @@
     n = spline->n;
     binNum = p_psVectorBinDisectF32(spline->domains, (spline->n)+1, x);
-    if (binNum == -1) {
+    if (binNum < 0) {
         psLogMsg(__func__, PS_LOG_WARN,
                  "psSpline1DEval(): x ordinate (%f) is outside the spline range (%f - %f).",
Index: /trunk/psLib/src/dataManip/psMinimize.c
===================================================================
--- /trunk/psLib/src/dataManip/psMinimize.c	(revision 1981)
+++ /trunk/psLib/src/dataManip/psMinimize.c	(revision 1982)
@@ -7,8 +7,8 @@
  *  fit a 1-D polynomial to a set of data points.
  *
- *  @author George Gusciora, MHPCC
+ *  @author GLF, MHPCC
  *
- *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-05 23:14:15 $
+ *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -227,4 +227,9 @@
 supplied, but does not equal the domains specified in mySpline?
 XXX: can psSpline be NULL?
+ 
+XXX: reimplement this assuming that mySpline is NULL?
+ 
+XXX: What happens if X is NULL, then an index vector is generated for X, but
+that index vector lies outside the range vectors in mySpline?
  *****************************************************************************/
 psSpline1D *psVectorFitSpline1D(psSpline1D *mySpline,              ///< The spline which will be generated.
@@ -269,10 +274,10 @@
         CONVERT_VECTOR_F64_TO_F32(x, x32, x32Static);
     }
-    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(x, y);
-    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(yErr, y);
-
-    if (y->n != (1 + mySpline->n)) {
+    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(x32, y32);
+    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(yErr32, y32);
+
+    if (y32->n != (1 + mySpline->n)) {
         psError(__func__, "data size / spline size mismatch (%d %d)\n",
-                y->n, mySpline->n);
+                y32->n, mySpline->n);
         return(NULL);
     }
@@ -282,7 +287,7 @@
     if (2 == (mySpline->spline[0])->n) {
         for (i=0;i<mySpline->n;i++) {
-            slope = (y->data.F32[i+1] - y->data.F32[i]) /
+            slope = (y32->data.F32[i+1] - y32->data.F32[i]) /
                     (mySpline->domains[i+1] - mySpline->domains[i]);
-            (mySpline->spline[i])->coeff[0] = y->data.F32[i] -
+            (mySpline->spline[i])->coeff[0] = y32->data.F32[i] -
                                               (slope * mySpline->domains[i]);
 
@@ -307,6 +312,6 @@
     // If we get here, then we know these are cubic splines.  We first
     // generate the second derivatives at each data point.
-    mySpline->p_psDeriv2 = CalculateSecondDerivs(x, y);
-    for (i=0;i<y->n;i++)
+    mySpline->p_psDeriv2 = CalculateSecondDerivs(x32, y32);
+    for (i=0;i<y32->n;i++)
         psTrace(".psLib.dataManip.psVectorFitSpline1D", 6,
                 "Second deriv[%d] is %f\n", i, mySpline->p_psDeriv2[i]);
@@ -316,5 +321,5 @@
     // and Numerical Recipes in C.
     for (i=0;i<numSplines;i++) {
-        H = x->data.F32[i+1] - x->data.F32[i];
+        H = x32->data.F32[i+1] - x32->data.F32[i];
         psTrace(".psLib.dataManip.psVectorFitSpline1D", 4,
                 "x data (%f - %f) (%f)\n", x->data.F32[i], x->data.F32[i+1], H);
@@ -323,15 +328,15 @@
         //
         // From (1)
-        (mySpline->spline[i])->coeff[0] = (y->data.F32[i] * x->data.F32[i+1]/H);
+        (mySpline->spline[i])->coeff[0] = (y32->data.F32[i] * x32->data.F32[i+1]/H);
         // From (2)
-        ((mySpline->spline[i])->coeff[0])-= ((y->data.F32[i+1] * x->data.F32[i])/H);
+        ((mySpline->spline[i])->coeff[0])-= ((y32->data.F32[i+1] * x32->data.F32[i])/H);
         // From (3)
-        tmp = (x->data.F32[i+1] * x->data.F32[i+1] * x->data.F32[i+1]) / (H * H * H);
-        tmp-= (x->data.F32[i+1] / H);
+        tmp = (x32->data.F32[i+1] * x32->data.F32[i+1] * x32->data.F32[i+1]) / (H * H * H);
+        tmp-= (x32->data.F32[i+1] / H);
         tmp*= (mySpline->p_psDeriv2)[i] * H * H / 6.0;
         ((mySpline->spline[i])->coeff[0])+= tmp;
         // From (4)
-        tmp = -(x->data.F32[i] * x->data.F32[i] * x->data.F32[i]) / (H * H * H);
-        tmp+= (x->data.F32[i] / H);
+        tmp = -(x32->data.F32[i] * x32->data.F32[i] * x32->data.F32[i]) / (H * H * H);
+        tmp+= (x32->data.F32[i] / H);
         tmp*= (mySpline->p_psDeriv2)[i+1] * H * H / 6.0;
         ((mySpline->spline[i])->coeff[0])+= tmp;
@@ -341,14 +346,14 @@
         //
         // From (1)
-        (mySpline->spline[i])->coeff[1] = -(y->data.F32[i]) / H;
+        (mySpline->spline[i])->coeff[1] = -(y32->data.F32[i]) / H;
         // From (2)
-        ((mySpline->spline[i])->coeff[1])+= (y->data.F32[i+1] / H);
+        ((mySpline->spline[i])->coeff[1])+= (y32->data.F32[i+1] / H);
         // From (3)
-        tmp = -3.0 * (x->data.F32[i+1] * x->data.F32[i+1]) / (H * H * H);
+        tmp = -3.0 * (x32->data.F32[i+1] * x32->data.F32[i+1]) / (H * H * H);
         tmp+= (1.0 / H);
         tmp*= ((mySpline->p_psDeriv2)[i]) * H * H / 6.0;
         ((mySpline->spline[i])->coeff[1])+= tmp;
         // From (4)
-        tmp = 3.0 * (x->data.F32[i] * x->data.F32[i]) / (H * H * H);
+        tmp = 3.0 * (x32->data.F32[i] * x32->data.F32[i]) / (H * H * H);
         tmp-= (1.0 / H);
         tmp*= ((mySpline->p_psDeriv2)[i+1]) * H * H / 6.0;
@@ -359,7 +364,7 @@
         //
         // From (3)
-        (mySpline->spline[i])->coeff[2] = ((mySpline->p_psDeriv2)[i]) * 3.0 * x->data.F32[i+1] / (6.0 * H);
+        (mySpline->spline[i])->coeff[2] = ((mySpline->p_psDeriv2)[i]) * 3.0 * x32->data.F32[i+1] / (6.0 * H);
         // From (4)
-        ((mySpline->spline[i])->coeff[2])-= (((mySpline->p_psDeriv2)[i+1]) * 3.0 * x->data.F32[i] / (6.0 * H));
+        ((mySpline->spline[i])->coeff[2])-= (((mySpline->p_psDeriv2)[i+1]) * 3.0 * x32->data.F32[i] / (6.0 * H));
 
         //
Index: /trunk/psLib/src/dataManip/psMinimize.h
===================================================================
--- /trunk/psLib/src/dataManip/psMinimize.h	(revision 1981)
+++ /trunk/psLib/src/dataManip/psMinimize.h	(revision 1982)
@@ -6,8 +6,8 @@
  *  chi-squared minimization, and 1-D polynomial fitting routines.
  *
- *  @author George Gusciora, MHPCC
+ *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-05 22:47:21 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/math/psMinimize.c
===================================================================
--- /trunk/psLib/src/math/psMinimize.c	(revision 1981)
+++ /trunk/psLib/src/math/psMinimize.c	(revision 1982)
@@ -7,8 +7,8 @@
  *  fit a 1-D polynomial to a set of data points.
  *
- *  @author George Gusciora, MHPCC
+ *  @author GLF, MHPCC
  *
- *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-05 23:14:15 $
+ *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -227,4 +227,9 @@
 supplied, but does not equal the domains specified in mySpline?
 XXX: can psSpline be NULL?
+ 
+XXX: reimplement this assuming that mySpline is NULL?
+ 
+XXX: What happens if X is NULL, then an index vector is generated for X, but
+that index vector lies outside the range vectors in mySpline?
  *****************************************************************************/
 psSpline1D *psVectorFitSpline1D(psSpline1D *mySpline,              ///< The spline which will be generated.
@@ -269,10 +274,10 @@
         CONVERT_VECTOR_F64_TO_F32(x, x32, x32Static);
     }
-    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(x, y);
-    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(yErr, y);
-
-    if (y->n != (1 + mySpline->n)) {
+    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(x32, y32);
+    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(yErr32, y32);
+
+    if (y32->n != (1 + mySpline->n)) {
         psError(__func__, "data size / spline size mismatch (%d %d)\n",
-                y->n, mySpline->n);
+                y32->n, mySpline->n);
         return(NULL);
     }
@@ -282,7 +287,7 @@
     if (2 == (mySpline->spline[0])->n) {
         for (i=0;i<mySpline->n;i++) {
-            slope = (y->data.F32[i+1] - y->data.F32[i]) /
+            slope = (y32->data.F32[i+1] - y32->data.F32[i]) /
                     (mySpline->domains[i+1] - mySpline->domains[i]);
-            (mySpline->spline[i])->coeff[0] = y->data.F32[i] -
+            (mySpline->spline[i])->coeff[0] = y32->data.F32[i] -
                                               (slope * mySpline->domains[i]);
 
@@ -307,6 +312,6 @@
     // If we get here, then we know these are cubic splines.  We first
     // generate the second derivatives at each data point.
-    mySpline->p_psDeriv2 = CalculateSecondDerivs(x, y);
-    for (i=0;i<y->n;i++)
+    mySpline->p_psDeriv2 = CalculateSecondDerivs(x32, y32);
+    for (i=0;i<y32->n;i++)
         psTrace(".psLib.dataManip.psVectorFitSpline1D", 6,
                 "Second deriv[%d] is %f\n", i, mySpline->p_psDeriv2[i]);
@@ -316,5 +321,5 @@
     // and Numerical Recipes in C.
     for (i=0;i<numSplines;i++) {
-        H = x->data.F32[i+1] - x->data.F32[i];
+        H = x32->data.F32[i+1] - x32->data.F32[i];
         psTrace(".psLib.dataManip.psVectorFitSpline1D", 4,
                 "x data (%f - %f) (%f)\n", x->data.F32[i], x->data.F32[i+1], H);
@@ -323,15 +328,15 @@
         //
         // From (1)
-        (mySpline->spline[i])->coeff[0] = (y->data.F32[i] * x->data.F32[i+1]/H);
+        (mySpline->spline[i])->coeff[0] = (y32->data.F32[i] * x32->data.F32[i+1]/H);
         // From (2)
-        ((mySpline->spline[i])->coeff[0])-= ((y->data.F32[i+1] * x->data.F32[i])/H);
+        ((mySpline->spline[i])->coeff[0])-= ((y32->data.F32[i+1] * x32->data.F32[i])/H);
         // From (3)
-        tmp = (x->data.F32[i+1] * x->data.F32[i+1] * x->data.F32[i+1]) / (H * H * H);
-        tmp-= (x->data.F32[i+1] / H);
+        tmp = (x32->data.F32[i+1] * x32->data.F32[i+1] * x32->data.F32[i+1]) / (H * H * H);
+        tmp-= (x32->data.F32[i+1] / H);
         tmp*= (mySpline->p_psDeriv2)[i] * H * H / 6.0;
         ((mySpline->spline[i])->coeff[0])+= tmp;
         // From (4)
-        tmp = -(x->data.F32[i] * x->data.F32[i] * x->data.F32[i]) / (H * H * H);
-        tmp+= (x->data.F32[i] / H);
+        tmp = -(x32->data.F32[i] * x32->data.F32[i] * x32->data.F32[i]) / (H * H * H);
+        tmp+= (x32->data.F32[i] / H);
         tmp*= (mySpline->p_psDeriv2)[i+1] * H * H / 6.0;
         ((mySpline->spline[i])->coeff[0])+= tmp;
@@ -341,14 +346,14 @@
         //
         // From (1)
-        (mySpline->spline[i])->coeff[1] = -(y->data.F32[i]) / H;
+        (mySpline->spline[i])->coeff[1] = -(y32->data.F32[i]) / H;
         // From (2)
-        ((mySpline->spline[i])->coeff[1])+= (y->data.F32[i+1] / H);
+        ((mySpline->spline[i])->coeff[1])+= (y32->data.F32[i+1] / H);
         // From (3)
-        tmp = -3.0 * (x->data.F32[i+1] * x->data.F32[i+1]) / (H * H * H);
+        tmp = -3.0 * (x32->data.F32[i+1] * x32->data.F32[i+1]) / (H * H * H);
         tmp+= (1.0 / H);
         tmp*= ((mySpline->p_psDeriv2)[i]) * H * H / 6.0;
         ((mySpline->spline[i])->coeff[1])+= tmp;
         // From (4)
-        tmp = 3.0 * (x->data.F32[i] * x->data.F32[i]) / (H * H * H);
+        tmp = 3.0 * (x32->data.F32[i] * x32->data.F32[i]) / (H * H * H);
         tmp-= (1.0 / H);
         tmp*= ((mySpline->p_psDeriv2)[i+1]) * H * H / 6.0;
@@ -359,7 +364,7 @@
         //
         // From (3)
-        (mySpline->spline[i])->coeff[2] = ((mySpline->p_psDeriv2)[i]) * 3.0 * x->data.F32[i+1] / (6.0 * H);
+        (mySpline->spline[i])->coeff[2] = ((mySpline->p_psDeriv2)[i]) * 3.0 * x32->data.F32[i+1] / (6.0 * H);
         // From (4)
-        ((mySpline->spline[i])->coeff[2])-= (((mySpline->p_psDeriv2)[i+1]) * 3.0 * x->data.F32[i] / (6.0 * H));
+        ((mySpline->spline[i])->coeff[2])-= (((mySpline->p_psDeriv2)[i+1]) * 3.0 * x32->data.F32[i] / (6.0 * H));
 
         //
Index: /trunk/psLib/src/math/psMinimize.h
===================================================================
--- /trunk/psLib/src/math/psMinimize.h	(revision 1981)
+++ /trunk/psLib/src/math/psMinimize.h	(revision 1982)
@@ -6,8 +6,8 @@
  *  chi-squared minimization, and 1-D polynomial fitting routines.
  *
- *  @author George Gusciora, MHPCC
+ *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-05 22:47:21 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/math/psPolynomial.c
===================================================================
--- /trunk/psLib/src/math/psPolynomial.c	(revision 1981)
+++ /trunk/psLib/src/math/psPolynomial.c	(revision 1982)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-06 00:48:15 $
+ *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -2074,5 +2074,5 @@
     n = spline->n;
     binNum = p_psVectorBinDisectF32(spline->domains, (spline->n)+1, x);
-    if (binNum == -1) {
+    if (binNum < 0) {
         psLogMsg(__func__, PS_LOG_WARN,
                  "psSpline1DEval(): x ordinate (%f) is outside the spline range (%f - %f).",
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 1981)
+++ /trunk/psLib/src/math/psSpline.c	(revision 1982)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-06 00:48:15 $
+ *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -2074,5 +2074,5 @@
     n = spline->n;
     binNum = p_psVectorBinDisectF32(spline->domains, (spline->n)+1, x);
-    if (binNum == -1) {
+    if (binNum < 0) {
         psLogMsg(__func__, PS_LOG_WARN,
                  "psSpline1DEval(): x ordinate (%f) is outside the spline range (%f - %f).",
Index: /trunk/psLib/src/mathtypes/psVector.h
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.h	(revision 1981)
+++ /trunk/psLib/src/mathtypes/psVector.h	(revision 1982)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-05 01:43:57 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-06 21:30:52 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -59,4 +59,5 @@
 
 /*****************************************************************************/
+
 
 /** Allocate a vector.
Index: /trunk/psLib/test/dataManip/tst_psFunc04.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psFunc04.c	(revision 1981)
+++ /trunk/psLib/test/dataManip/tst_psFunc04.c	(revision 1982)
@@ -17,5 +17,5 @@
 #define N 8
 
-int main()
+int t00()
 {
     int testStatus = true;
@@ -68,2 +68,60 @@
     return (!testStatus);
 }
+
+int t01()
+{
+    int testStatus = true;
+    int memLeaks=0;
+    int i;
+    float x;
+    float y;
+    int  currentId = psMemGetId();
+    psSpline1D *tmpSpline;
+    psVector *data;
+
+    psTraceSetLevel(".", 0);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc()");
+    data = psVectorAlloc(N+1, PS_TYPE_F32);
+    tmpSpline = psSpline1DAlloc(N, 1, 1.0, 10.0);
+
+    for (i=0;i<N+1;i++) {
+        data->data.F32[i] = tmpSpline->domains[i];
+    }
+    psVectorFitSpline1D(tmpSpline, data, data, NULL);
+
+    for (i=0;i<N+1;i++) {
+        x = 0.5 + (float) i+1;
+        y = psSpline1DEval(tmpSpline, x);
+        if (fabs(x-y) > FLT_EPSILON) {
+            printf("ERROR: f(%f) is %f\n", x, y);
+            testStatus = true;
+        }
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    psFree(data);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc()",
+                testStatus);
+
+    return (!testStatus);
+}
+
+int main()
+{
+    t00();
+    //    t01();
+}
Index: /trunk/psLib/test/dataManip/tst_psFunc07.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psFunc07.c	(revision 1981)
+++ /trunk/psLib/test/dataManip/tst_psFunc07.c	(revision 1982)
@@ -12,5 +12,5 @@
 #include "psFunctions.h"
 
-#define NUM_SPLINES 5
+#define NUM_SPLINES 50
 #define A 4.0
 #define B -3.0
@@ -20,4 +20,5 @@
 #define MAX 30
 #define ERROR_TOLERANCE 0.10
+#define OFFSET (NUM_SPLINES * ERROR_TOLERANCE)
 
 float myFunc(float x)
@@ -26,5 +27,5 @@
 }
 
-int main()
+int t00()
 {
     int testStatus = true;
@@ -37,8 +38,4 @@
     psVector *y = NULL;
     psVector *newY = NULL;
-    float NRX[NUM_SPLINES+2];
-    float NRY[NUM_SPLINES+2];
-    //    float tmpY;
-    //    float derivs[NUM_SPLINES+2];
 
     psTraceSetLevel(".", 0);
@@ -46,7 +43,4 @@
     /****************************************************************************/
     testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
     x = psVectorAlloc(NUM_SPLINES+1, PS_TYPE_F32);
     newX = psVectorAlloc(NUM_SPLINES+1, PS_TYPE_F32);
@@ -55,8 +49,8 @@
 
     for (i=0;i<NUM_SPLINES+1;i++) {
-        NRX[i+1] = x->data.F32[i] = tmpSpline->domains[i];
-        NRY[i+1] = y->data.F32[i] = myFunc(x->data.F32[i]);
-        //        printf("DATA: (x, y) is (%f, %f)\n", x->data.F32[i], y->data.F32[i]);
+        x->data.F32[i] = tmpSpline->domains[i];
+        y->data.F32[i] = myFunc(x->data.F32[i]);
     }
+
     for (i=0;i<NUM_SPLINES;i++) {
         newX->data.F32[i]= ((x->data.F32[i] + x->data.F32[i+1])/2.0);
@@ -66,16 +60,16 @@
     /*   psLib Code      */
     /****************************************************************************/
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc()");
 
     psVectorFitSpline1D(tmpSpline, x, y, NULL);
     newY = psSpline1DEvalVector(newX, tmpSpline);
 
-    for (i=0;i<NUM_SPLINES+1;i++) {
+    for (i=OFFSET;i<NUM_SPLINES-OFFSET+1;i++) {
         if ( fabs( newY->data.F32[i] - myFunc(newX->data.F32[i]) ) > fabs( ERROR_TOLERANCE * myFunc(newX->data.F32[i]) ) ) {
             printf("ERROR[%d]: f(%f) is %f.  Should be %f\n", i,
                    newX->data.F32[i], newY->data.F32[i], myFunc(newX->data.F32[i]));
         }
-        //        tmpY = p_psNRSpline1DEval(tmpSpline, x, y, newX->data.F32[i]);
-        //        printf("HMMM: p_psNRSpline1DEval(%f) is %f.  Should be %f\n",
-        //                newX->data.F32[i], tmpY, myFunc(newX->data.F32[i]));
     }
 
@@ -99,2 +93,74 @@
     return (!testStatus);
 }
+
+int t00()
+{
+    int testStatus = true;
+    int memLeaks=0;
+    int  currentId = psMemGetId();
+    int i;
+    psSpline1D *tmpSpline = NULL;
+    psVector *x = NULL;
+    psVector *newX = NULL;
+    psVector *y = NULL;
+    psVector *newY = NULL;
+
+    psTraceSetLevel(".", 0);
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    x = psVectorAlloc(NUM_SPLINES+1, PS_TYPE_F32);
+    newX = psVectorAlloc(NUM_SPLINES+1, PS_TYPE_F32);
+    y = psVectorAlloc(NUM_SPLINES+1, PS_TYPE_F32);
+    tmpSpline = psSpline1DAlloc(NUM_SPLINES, 3, MIN, MAX);
+
+    for (i=0;i<NUM_SPLINES+1;i++) {
+        x->data.F32[i] = tmpSpline->domains[i];
+        y->data.F32[i] = myFunc(x->data.F32[i]);
+    }
+
+    for (i=0;i<NUM_SPLINES;i++) {
+        newX->data.F32[i]= ((x->data.F32[i] + x->data.F32[i+1])/2.0);
+    }
+    newX->data.F32[NUM_SPLINES] = x->data.F32[NUM_SPLINES];
+    /****************************************************************************/
+    /*   psLib Code      */
+    /****************************************************************************/
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc()");
+
+    psVectorFitSpline1D(tmpSpline, x, y, NULL);
+    newY = psSpline1DEvalVector(newX, tmpSpline);
+
+    for (i=OFFSET;i<NUM_SPLINES-OFFSET+1;i++) {
+        if ( fabs( newY->data.F32[i] - myFunc(newX->data.F32[i]) ) > fabs( ERROR_TOLERANCE * myFunc(newX->data.F32[i]) ) ) {
+            printf("ERROR[%d]: f(%f) is %f.  Should be %f\n", i,
+                   newX->data.F32[i], newY->data.F32[i], myFunc(newX->data.F32[i]));
+        }
+    }
+
+    psFree(x);
+    psFree(newX);
+    psFree(y);
+    p_psSpline1DFree(tmpSpline);
+    psFree(newY);
+
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc()",
+                testStatus);
+
+    return (!testStatus);
+}
+
+int main()
+{
+    t00();
+}
