Index: /trunk/psLib/src/math/psMinimizeLMM.c
===================================================================
--- /trunk/psLib/src/math/psMinimizeLMM.c	(revision 10177)
+++ /trunk/psLib/src/math/psMinimizeLMM.c	(revision 10178)
@@ -10,6 +10,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-10-24 22:52:56 $
+ *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-11-24 20:52:59 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -63,4 +63,14 @@
     psF64 lambda)
 {
+    PS_ASSERT_VECTOR_TYPE(Alpha,     PS_TYPE_F64,  false);
+    PS_ASSERT_VECTOR_TYPE(Beta,      PS_TYPE_F64,  false);
+    PS_ASSERT_VECTOR_TYPE(Params,    PS_TYPE_F32,  false);
+    PS_ASSERT_VECTOR_TYPE(alpha,     PS_TYPE_F64,  false);
+    PS_ASSERT_VECTOR_TYPE(beta,      PS_TYPE_F64,  false);
+    PS_ASSERT_VECTOR_TYPE(params,    PS_TYPE_F32,  false);
+    if (paramMask) {
+        PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_MASK, false);
+    }
+
     # define USE_LU_DECOMP 0
     # if (USE_LU_DECOMP)
@@ -125,4 +135,5 @@
     for (int j = 0; j < params->n; j++) {
         if ((paramMask != NULL) && (paramMask->data.U8[j])) {
+            Params->data.F32[j] = 0;
             continue;
         }
@@ -163,5 +174,5 @@
     psImage  *Alpha  = psImageAlloc (params->n, params->n, PS_TYPE_F64);
     psVector *beta   = psVectorAlloc(params->n, PS_TYPE_F64);
-    psVector *Params = psVectorAlloc(params->n, PS_TYPE_F64);
+    psVector *Params = psVectorAlloc(params->n, PS_TYPE_F32);
     psVector *dy     = NULL;
     psBool rc = true;
@@ -182,4 +193,10 @@
     }
     psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n");
+    // dump some useful info if trace is defined
+    if (psTraceGetLevel("psLib.math") >= 6) {
+        p_psImagePrint(psTraceGetDestination(), alpha, "alpha guess (0)");
+        p_psVectorPrint(psTraceGetDestination(), beta, "beta guess (0)");
+        p_psVectorPrint(psTraceGetDestination(), params, "params guess (0)");
+    }
 
     psBool rcBool = p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0);
@@ -189,4 +206,9 @@
     }
     psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n");
+    if (psTraceGetLevel("psLib.math") >= 6) {
+        p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (1)");
+        p_psVectorPrint(psTraceGetDestination(), delta, "delta guess (1)");
+        p_psVectorPrint(psTraceGetDestination(), Params, "params guess (1)");
+    }
 
     psFree(alpha);
@@ -237,4 +259,9 @@
     PS_ASSERT_VECTOR_NON_NULL(y, NAN);
     PS_ASSERT_VECTOR_NON_NULL(dy, NAN);
+
+    PS_ASSERT_VECTOR_TYPE(params,    PS_TYPE_F32,  false);
+    if (paramMask) {
+        PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_MASK, false);
+    }
 
     psF64 chisq;
@@ -404,11 +431,7 @@
         p_psImagePrint(psTraceGetDestination(), alpha, "alpha guess (0)");
         p_psVectorPrint(psTraceGetDestination(), beta, "beta guess (0)");
+    }
+    if (psTraceGetLevel("psLib.math") >= 5) {
         p_psVectorPrint(psTraceGetDestination(), params, "params guess (0)");
-    }
-    if (psTraceGetLevel ("psLib.math.psMinimizeLMChi2") >= 6) {
-        psTrace("psLib.math", 6, "The current Param vector: \n");
-        for (psS32 i = 0 ; i < Params->n ; i++) {
-            psTrace("psLib.math", 6, "Params[%d] is %f\n", i, Params->data.F32[i]);
-        }
     }
 
@@ -433,13 +456,7 @@
             p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (1)");
             p_psVectorPrint(psTraceGetDestination(), Beta, "beta guess (1)");
+        }
+        if (psTraceGetLevel("psLib.math") >= 5) {
             p_psVectorPrint(psTraceGetDestination(), Params, "params guess (1)");
-        }
-        if (psTraceGetLevel("psLib.math") >= 6) {
-            if (psTraceGetLevel ("psLib.math") >= 6) {
-                psTrace("psLib.math", 6, "The current Param vector: \n");
-                for (psS32 i = 0 ; i < Params->n ; i++) {
-                    psTrace("psLib.math", 6, "Params[%d] is %f\n", i, Params->data.F32[i]);
-                }
-            }
         }
 
@@ -452,5 +469,5 @@
         }
 
-        // XXX EAM alternate convergence criterion:
+        // convergence criterion:
         // compare the delta (min->value - Chisq) with the
         // expected delta from the linear model (dLinear)
