Index: trunk/psLib/src/math/psFunctions.c
===================================================================
--- trunk/psLib/src/math/psFunctions.c	(revision 4876)
+++ trunk/psLib/src/math/psFunctions.c	(revision 4898)
@@ -7,6 +7,6 @@
 *  polynomials.  It also contains a Gaussian functions.
 *
-*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-08-25 22:52:29 $
+*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-08-30 01:14:13 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -871,4 +871,31 @@
     return(newPoly);
 }
+
+
+bool psMemCheckPolynomial1D(psPtr ptr)
+{
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)polynomial1DFree );
+}
+
+bool psMemCheckPolynomial2D(psPtr ptr)
+{
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)polynomial2DFree );
+}
+
+bool psMemCheckPolynomial3D(psPtr ptr)
+{
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)polynomial3DFree );
+}
+
+bool psMemCheckPolynomial4D(psPtr ptr)
+{
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)polynomial4DFree );
+}
+
+bool psMemCheckSpline1D(psPtr ptr)
+{
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)spline1DFree );
+}
+
 
 psF64 psPolynomial1DEval(const psPolynomial1D* poly, psF64 x)
Index: trunk/psLib/src/math/psFunctions.h
===================================================================
--- trunk/psLib/src/math/psFunctions.h	(revision 4876)
+++ trunk/psLib/src/math/psFunctions.h	(revision 4898)
@@ -12,6 +12,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-20 01:21:13 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-08-30 01:14:13 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -163,4 +163,56 @@
 );
 
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psPolynomial1D structure, false otherwise.
+ */
+bool psMemCheckPolynomial1D(
+    psPtr ptr                          ///< the pointer whose type to check
+);
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psPolynomial2D structure, false otherwise.
+ */
+bool psMemCheckPolynomial2D(
+    psPtr ptr                          ///< the pointer whose type to check
+);
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psPolynomial3D structure, false otherwise.
+ */
+bool psMemCheckPolynomial3D(
+    psPtr ptr                          ///< the pointer whose type to check
+);
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psPolynomial4D structure, false otherwise.
+ */
+bool psMemCheckPolynomial4D(
+    psPtr ptr                          ///< the pointer whose type to check
+);
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psSpline1D structure, false otherwise.
+ */
+bool psMemCheckSpline1D(
+    psPtr ptr                          ///< the pointer whose type to check
+);
+
+
+
 /** Evaluates a 1-D polynomial at specific coordinates.
  *
Index: trunk/psLib/src/math/psMinimize.c
===================================================================
--- trunk/psLib/src/math/psMinimize.c	(revision 4876)
+++ trunk/psLib/src/math/psMinimize.c	(revision 4898)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.131 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-24 01:04:37 $
+ *  @version $Revision: 1.132 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-08-30 01:14:13 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1372,5 +1372,8 @@
 }
 
-
+static void minimizationFree(psMinimization *min)
+{
+    // There are non dynamic allocated items
+}
 
 /******************************************************************************
@@ -1382,4 +1385,5 @@
 
     psMinimization *min = psAlloc(sizeof(psMinimization));
+    psMemSetDeallocator(min, (psFreeFunc)minimizationFree);
     *(int*)&min->maxIter = maxIter;
     *(float*)&min->tol = tol;
@@ -1390,4 +1394,10 @@
     return(min);
 }
+
+bool psMemCheckMinimization(psPtr ptr)
+{
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)minimizationFree );
+}
+
 
 // This macro takes as input the vector BASE and adds a multiple of the vector
Index: trunk/psLib/src/math/psMinimize.h
===================================================================
--- trunk/psLib/src/math/psMinimize.h	(revision 4876)
+++ trunk/psLib/src/math/psMinimize.h	(revision 4898)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-11 23:04:32 $
+ *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-08-30 01:14:13 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -60,4 +60,15 @@
 );
 
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psMinimization structure, false otherwise.
+ */
+bool psMemCheckMinimization(
+    psPtr ptr                          ///< the pointer whose type to check
+);
+
+
 /** Derive a polynomial fit.
  *
Index: trunk/psLib/src/math/psStats.c
===================================================================
--- trunk/psLib/src/math/psStats.c	(revision 4876)
+++ trunk/psLib/src/math/psStats.c	(revision 4898)
@@ -14,6 +14,6 @@
  *      stats->binsize
  *
- *  @version $Revision: 1.138 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-27 19:55:16 $
+ *  @version $Revision: 1.139 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-08-30 01:14:13 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1753,4 +1753,9 @@
 static void histogramFree(psHistogram* myHist);
 
+static void statsFree(psStats *newStruct)
+{
+    // There are non dynamic allocated items
+}
+
 /******************************************************************************
     psStatsAlloc(): This routine must create a new psStats data structure.
@@ -1761,4 +1766,5 @@
 
     newStruct = (psStats* ) psAlloc(sizeof(psStats));
+    psMemSetDeallocator(newStruct, (psFreeFunc)statsFree);
     newStruct->sampleMean = NAN;
     newStruct->sampleMedian = NAN;
@@ -1787,4 +1793,12 @@
 }
 
+
+bool psMemCheckStats(psPtr ptr)
+{
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)statsFree );
+}
+
+
+
 /******************************************************************************
 psHistogramAlloc(lower, upper, n): allocate a uniform histogram structure
@@ -1885,4 +1899,12 @@
     psFree(myHist->nums);
 }
+
+
+bool psMemCheckHistogram(psPtr ptr)
+{
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)histogramFree );
+}
+
+
 
 /*****************************************************************************
Index: trunk/psLib/src/math/psStats.h
===================================================================
--- trunk/psLib/src/math/psStats.h	(revision 4876)
+++ trunk/psLib/src/math/psStats.h	(revision 4898)
@@ -14,6 +14,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-23 23:23:05 $
+ *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-08-30 01:14:13 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -105,4 +105,16 @@
 );
 
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psStats structure, false otherwise.
+ */
+bool psMemCheckStats(
+    psPtr ptr                          ///< the pointer whose type to check
+);
+
+
 /******************************************************************************
     Histogram functions and data structures.
@@ -140,4 +152,16 @@
 );
 
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psHistogram structure, false otherwise.
+ */
+bool psMemCheckHistogram(
+    psPtr ptr                          ///< the pointer whose type to check
+);
+
+
 /** Allocator for psHistogram where the bounds of the bins are explicitly
  *  specified.
