IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 26, 2006, 11:53:57 AM (19 years ago)
Author:
magnier
Message:

fixed error in p_psMinLM_GuessAB: failed to set masked parameters!
removed unnecessary psVectorCopy in psMinimizeLMM (had been causing a

segfault because of an old trace line)

cleaned up trace lines
added several asserts

File:
1 edited

Legend:

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

    r10178 r10192  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-11-24 20:52:59 $
     12 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-11-26 21:53:57 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7979    psImage  *A   = NULL;
    8080    psF32    det;
    81 
    8281    // LU decomposition version
    8382    psTrace("psLib.math", 5, "using LUD version\n");
     
    135134    for (int j = 0; j < params->n; j++) {
    136135        if ((paramMask != NULL) && (paramMask->data.U8[j])) {
    137             Params->data.F32[j] = 0;
     136            Params->data.F32[j] = params->data.F32[j];
    138137            continue;
    139138        }
     
    336335coords.
    337336 
    338 NOTES: EAM: this is my re-implementation of MinLM
    339  
    340 XXX: EAM : constraints added 2006.02.15
    341  
    342 XXX: Put the ASSERTS in.
    343  
    344337XXX: This must work for both F32 and F64.  F32 is currently implemented.
    345338     Note: since the LUD routines are only implemented in F64, then we
    346339     will have to convert all F32 input vectors to F64 regardless.  So,
    347      the F64 port might be.
     340     the F64 port might be an optimization.
    348341 
    349342  *****************************************************************************/
     
    360353    psTrace("psLib.math", 3, "---- begin ----\n");
    361354    PS_ASSERT_PTR_NON_NULL(min, false);
    362     // XXX: If covar not NULL, do asserts...
    363355    PS_ASSERT_VECTOR_NON_NULL(params, false);
    364356    PS_ASSERT_VECTOR_NON_EMPTY(params, false);
     
    369361    psVector *paramMax = NULL;
    370362    if (constrain != NULL) {
    371         // XXX EAM : fill out the asserts
    372363        paramDelta = constrain->paramDelta;
    373364        paramMin = constrain->paramMin;
    374365        paramMax = constrain->paramMax;
    375366        paramMask = constrain->paramMask;
     367        PS_ASSERT_VECTOR_TYPE(paramDelta, PS_TYPE_F32, false);
     368        PS_ASSERT_VECTOR_TYPE(paramMin, PS_TYPE_F32, false);
     369        PS_ASSERT_VECTOR_TYPE(paramMax, PS_TYPE_F32, false);
     370        PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramDelta, false);
     371        PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramMin, false);
     372        PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramMax, false);
    376373        if (paramMask != NULL) {
    377374            PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_U8, false);
     
    409406    psF64 lambda = 0.001;
    410407
    411     // why is this needed here??? the initial guess on params is provided by the user
    412     Params = psVectorCopy(Params, params, PS_TYPE_F32);
    413 
    414408    // the user provides the error or NULL.  we need to convert
    415409    // to appropriate weights
     
    472466        // compare the delta (min->value - Chisq) with the
    473467        // expected delta from the linear model (dLinear)
    474         // accept new guess (if improvement), or increase lambda
     468        // accept new guess if it is an improvement (rho > 0), or else increase lambda
    475469        psF64 rho = (min->value - Chisq) / dLinear;
    476470
     
    482476            p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (2)");
    483477            p_psVectorPrint(psTraceGetDestination(), Beta, "beta guess (2)");
    484             p_psVectorPrint(psTraceGetDestination(), Params, "params guess (2)");
    485478        }
    486479
Note: See TracChangeset for help on using the changeset viewer.