IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 24, 2006, 10:52:59 AM (19 years ago)
Author:
magnier
Message:

added some asserts, testing GaussNewton values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psMinimizeLMM.c

    r9730 r10178  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-10-24 22:52:56 $
     12 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-11-24 20:52:59 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6363    psF64 lambda)
    6464{
     65    PS_ASSERT_VECTOR_TYPE(Alpha,     PS_TYPE_F64,  false);
     66    PS_ASSERT_VECTOR_TYPE(Beta,      PS_TYPE_F64,  false);
     67    PS_ASSERT_VECTOR_TYPE(Params,    PS_TYPE_F32,  false);
     68    PS_ASSERT_VECTOR_TYPE(alpha,     PS_TYPE_F64,  false);
     69    PS_ASSERT_VECTOR_TYPE(beta,      PS_TYPE_F64,  false);
     70    PS_ASSERT_VECTOR_TYPE(params,    PS_TYPE_F32,  false);
     71    if (paramMask) {
     72        PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_MASK, false);
     73    }
     74
    6575    # define USE_LU_DECOMP 0
    6676    # if (USE_LU_DECOMP)
     
    125135    for (int j = 0; j < params->n; j++) {
    126136        if ((paramMask != NULL) && (paramMask->data.U8[j])) {
     137            Params->data.F32[j] = 0;
    127138            continue;
    128139        }
     
    163174    psImage  *Alpha  = psImageAlloc (params->n, params->n, PS_TYPE_F64);
    164175    psVector *beta   = psVectorAlloc(params->n, PS_TYPE_F64);
    165     psVector *Params = psVectorAlloc(params->n, PS_TYPE_F64);
     176    psVector *Params = psVectorAlloc(params->n, PS_TYPE_F32);
    166177    psVector *dy     = NULL;
    167178    psBool rc = true;
     
    182193    }
    183194    psTrace("psLib.math", 5, "p_psMinLM_SetABX() was succesful\n");
     195    // dump some useful info if trace is defined
     196    if (psTraceGetLevel("psLib.math") >= 6) {
     197        p_psImagePrint(psTraceGetDestination(), alpha, "alpha guess (0)");
     198        p_psVectorPrint(psTraceGetDestination(), beta, "beta guess (0)");
     199        p_psVectorPrint(psTraceGetDestination(), params, "params guess (0)");
     200    }
    184201
    185202    psBool rcBool = p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0);
     
    189206    }
    190207    psTrace("psLib.math", 5, "p_psMinLM_GuessABP() was succesful\n");
     208    if (psTraceGetLevel("psLib.math") >= 6) {
     209        p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (1)");
     210        p_psVectorPrint(psTraceGetDestination(), delta, "delta guess (1)");
     211        p_psVectorPrint(psTraceGetDestination(), Params, "params guess (1)");
     212    }
    191213
    192214    psFree(alpha);
     
    237259    PS_ASSERT_VECTOR_NON_NULL(y, NAN);
    238260    PS_ASSERT_VECTOR_NON_NULL(dy, NAN);
     261
     262    PS_ASSERT_VECTOR_TYPE(params,    PS_TYPE_F32,  false);
     263    if (paramMask) {
     264        PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_MASK, false);
     265    }
    239266
    240267    psF64 chisq;
     
    404431        p_psImagePrint(psTraceGetDestination(), alpha, "alpha guess (0)");
    405432        p_psVectorPrint(psTraceGetDestination(), beta, "beta guess (0)");
     433    }
     434    if (psTraceGetLevel("psLib.math") >= 5) {
    406435        p_psVectorPrint(psTraceGetDestination(), params, "params guess (0)");
    407     }
    408     if (psTraceGetLevel ("psLib.math.psMinimizeLMChi2") >= 6) {
    409         psTrace("psLib.math", 6, "The current Param vector: \n");
    410         for (psS32 i = 0 ; i < Params->n ; i++) {
    411             psTrace("psLib.math", 6, "Params[%d] is %f\n", i, Params->data.F32[i]);
    412         }
    413436    }
    414437
     
    433456            p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (1)");
    434457            p_psVectorPrint(psTraceGetDestination(), Beta, "beta guess (1)");
     458        }
     459        if (psTraceGetLevel("psLib.math") >= 5) {
    435460            p_psVectorPrint(psTraceGetDestination(), Params, "params guess (1)");
    436         }
    437         if (psTraceGetLevel("psLib.math") >= 6) {
    438             if (psTraceGetLevel ("psLib.math") >= 6) {
    439                 psTrace("psLib.math", 6, "The current Param vector: \n");
    440                 for (psS32 i = 0 ; i < Params->n ; i++) {
    441                     psTrace("psLib.math", 6, "Params[%d] is %f\n", i, Params->data.F32[i]);
    442                 }
    443             }
    444461        }
    445462
     
    452469        }
    453470
    454         // XXX EAM alternate convergence criterion:
     471        // convergence criterion:
    455472        // compare the delta (min->value - Chisq) with the
    456473        // expected delta from the linear model (dLinear)
Note: See TracChangeset for help on using the changeset viewer.