Index: /trunk/psLib/src/math/psMinimizeLMM.h
===================================================================
--- /trunk/psLib/src/math/psMinimizeLMM.h	(revision 10251)
+++ /trunk/psLib/src/math/psMinimizeLMM.h	(revision 10252)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-06-30 02:20:06 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-11-29 02:17:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -41,4 +41,39 @@
 #define PS_MAX_LMM_ITERATIONS 100
 #define PS_MAX_MINIMIZE_ITERATIONS 100
+#define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val
+        #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val
+
+                typedef enum {
+                    PS_MINIMIZE_BETA_LIMIT,
+                    PS_MINIMIZE_PARAM_MIN,
+                    PS_MINIMIZE_PARAM_MAX
+                } psMinConstraintMode;
+
+/** Specifies the format of a user-defined function that the general Levenberg-
+ *  Marquardt minimizer routine will accept.
+ *
+ *  @return float:   the single float value of the function given the parameters,
+ *       positions, and derivatives.
+ */
+typedef
+float (*psMinimizeLMChi2Func)(
+    psVector *deriv,                   ///< derivatives of the function
+    const psVector *params,            ///< the parameters used to evaluate the function
+    const psVector *x                  ///< positions for evaluation
+);
+
+/** Specifies the format of a user-defined function which check the parameters
+ *  against the allowed limits.  used by the general Levenberg-Marquardt minimizer.
+ *
+ *  @return float:   the single float value of the function given the parameters,
+ *       positions, and derivatives.
+ */
+typedef
+bool (*psMinimizeLMLimitFunc)(
+    psMinConstraintMode mode,   ///< which limit to check
+    int nParam,    ///< which param to check
+    float *params,   ///< current param value set
+    float *beta       ///< current beta value, if needed
+);
 
 /** A data structure for minimization routines.
@@ -56,5 +91,4 @@
 psMinimization;
 
-
 /** A data structure for minimization routines.
  *
@@ -64,23 +98,18 @@
 {
     psVector *paramMask;                ///< valid / invalid parameters
-    psVector *paramMax;                 ///< max allowed parameters
-    psVector *paramMin;                 ///< min allowed parameters
-    psVector *paramDelta;               ///< max allowed param swing
+    psMinimizeLMLimitFunc checkLimits; ///< user-supplied function to test the parameter limits
 }
-psMinConstrain;
+psMinConstraint;
 
-psMinConstrain *psMinConstrainAlloc();
+psMinConstraint *psMinConstraintAlloc();
 
-#define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val
-        #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val
-
-                /** Allocates a psMinimization structure.
-                 *
-                 *  @return psMinimization* :   a new psMinimization struct
-                */
-                psMinimization *psMinimizationAlloc(
-                    int maxIter,                       ///< Number of minimization iterations to perform.
-                    float tol                          ///< Requested error tolerance
-                );
+/** Allocates a psMinimization structure.
+ *
+ *  @return psMinimization* :   a new psMinimization struct
+ */
+psMinimization *psMinimizationAlloc(
+    int maxIter,                       ///< Number of minimization iterations to perform.
+    float tol                          ///< Requested error tolerance
+);
 
 /*  Checks the type of a particular pointer.
@@ -94,18 +123,4 @@
 );
 
-
-/** Specifies the format of a user-defined function that the general Levenberg-
- *  Marquardt minimizer routine will accept.
- *
- *  @return float:   the single float value of the function given the parameters,
- *       positions, and derivatives.
- */
-typedef
-float (*psMinimizeLMChi2Func)(
-    psVector *deriv,                   ///< derivatives of the function
-    const psVector *params,            ///< the parameters used to evaluate the function
-    const psVector *x                  ///< positions for evaluation
-);
-
 /** Minimizes a specified function based on the Levenberg-Marquardt method.
  *
@@ -116,5 +131,5 @@
     psImage *covar,                    ///< Covariance matrix
     psVector *params,                  ///< "Best Guess" for the parameters that minimize func
-    psMinConstrain *constrain,         ///< Constraints on the parameters
+    psMinConstraint *constraint, ///< Constraints on the parameters
     const psArray *x,                  ///< Measurement ordinates of multiple vectors
     const psVector *y,                 ///< Measurement coordinates
@@ -135,7 +150,7 @@
 /** Function used to set parameters for generating "best guess" in minimizing Chi-Squared value.
  *
- *  @return psF64:    Chi-squared value for new guess
+ *  @return psF32:    Chi-squared value for new guess
  */
-psF64 p_psMinLM_SetABX (
+psF32 p_psMinLM_SetABX (
     psImage  *alpha,                   ///< alpha guess
     psVector *beta,                    ///< beta guess
@@ -149,8 +164,17 @@
 
 
+psBool p_psMinLM_GuessABP(
+    psImage  *Alpha,
+    psVector *Beta,
+    psVector *Params,
+    const psImage  *alpha,
+    const psVector *beta,
+    const psVector *params,
+    const psVector *paramMask,
+    psMinimizeLMLimitFunc checkLimits,
+    psF32 lambda
+);
+
 /* \} */// End of MathGroup Functions
-
-
-
 
 #endif // #ifndef PS_MINIMIZE_LMM_H
