Index: trunk/psLib/src/math/psMinimizeLMM.c
===================================================================
--- trunk/psLib/src/math/psMinimizeLMM.c	(revision 10178)
+++ trunk/psLib/src/math/psMinimizeLMM.c	(revision 10192)
@@ -10,6 +10,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-11-24 20:52:59 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-11-26 21:53:57 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -79,5 +79,4 @@
     psImage  *A   = NULL;
     psF32    det;
-
     // LU decomposition version
     psTrace("psLib.math", 5, "using LUD version\n");
@@ -135,5 +134,5 @@
     for (int j = 0; j < params->n; j++) {
         if ((paramMask != NULL) && (paramMask->data.U8[j])) {
-            Params->data.F32[j] = 0;
+            Params->data.F32[j] = params->data.F32[j];
             continue;
         }
@@ -336,14 +335,8 @@
 coords.
  
-NOTES: EAM: this is my re-implementation of MinLM
- 
-XXX: EAM : constraints added 2006.02.15
- 
-XXX: Put the ASSERTS in.
- 
 XXX: This must work for both F32 and F64.  F32 is currently implemented.
      Note: since the LUD routines are only implemented in F64, then we
      will have to convert all F32 input vectors to F64 regardless.  So,
-     the F64 port might be.
+     the F64 port might be an optimization.
  
   *****************************************************************************/
@@ -360,5 +353,4 @@
     psTrace("psLib.math", 3, "---- begin ----\n");
     PS_ASSERT_PTR_NON_NULL(min, false);
-    // XXX: If covar not NULL, do asserts...
     PS_ASSERT_VECTOR_NON_NULL(params, false);
     PS_ASSERT_VECTOR_NON_EMPTY(params, false);
@@ -369,9 +361,14 @@
     psVector *paramMax = NULL;
     if (constrain != NULL) {
-        // XXX EAM : fill out the asserts
         paramDelta = constrain->paramDelta;
         paramMin = constrain->paramMin;
         paramMax = constrain->paramMax;
         paramMask = constrain->paramMask;
+        PS_ASSERT_VECTOR_TYPE(paramDelta, PS_TYPE_F32, false);
+        PS_ASSERT_VECTOR_TYPE(paramMin, PS_TYPE_F32, false);
+        PS_ASSERT_VECTOR_TYPE(paramMax, PS_TYPE_F32, false);
+        PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramDelta, false);
+        PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramMin, false);
+        PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramMax, false);
         if (paramMask != NULL) {
             PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_U8, false);
@@ -409,7 +406,4 @@
     psF64 lambda = 0.001;
 
-    // why is this needed here??? the initial guess on params is provided by the user
-    Params = psVectorCopy(Params, params, PS_TYPE_F32);
-
     // the user provides the error or NULL.  we need to convert
     // to appropriate weights
@@ -472,5 +466,5 @@
         // compare the delta (min->value - Chisq) with the
         // expected delta from the linear model (dLinear)
-        // accept new guess (if improvement), or increase lambda
+        // accept new guess if it is an improvement (rho > 0), or else increase lambda
         psF64 rho = (min->value - Chisq) / dLinear;
 
@@ -482,5 +476,4 @@
             p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (2)");
             p_psVectorPrint(psTraceGetDestination(), Beta, "beta guess (2)");
-            p_psVectorPrint(psTraceGetDestination(), Params, "params guess (2)");
         }
 
