IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6420


Ignore:
Timestamp:
Feb 9, 2006, 6:12:02 PM (20 years ago)
Author:
gusciora
Message:

....

File:
1 edited

Legend:

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

    r6346 r6420  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-02-07 23:14:21 $
     11 *  NOTE: XXX: The SDR is silent about data types.  F32 is implemented here.
     12 *
     13 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-02-10 04:12:02 $
    1315 *
    1416 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    98100increases, or x is too large.  If thst does not work, expand in the other
    99101direction.
    100  
    101 XXX: This is F32 only.  Must add F64 support (actually, make the defaults F64,
    102 and convert F32 vectors to F64).
    103102 
    104103XXX: output bracket vector should be an input as well.
     
    341340XXX: This routine is not very efficient in terms of total evaluations of the
    342341function.
    343 XXX: This is F32 only (make it F64).
    344342XXX: Since this is an internal function, many of the parameter checks are
    345343     redundant.
    346 XXX: Don't modify the psMinimization argument.
    347344 *****************************************************************************/
    348345#define PS_LINEMIN_MAX_ITERATIONS 30
    349 psF32 p_psLineMin(
     346static psF32 LineMin(
    350347    psMinimization *min,
    351348    psVector *params,
     
    385382    psS32 numIterations = 0;
    386383
    387     psTrace(__func__, 4, "---- p_psLineMin() begin ----\n");
     384    psTrace(__func__, 4, "---- LineMin() begin ----\n");
    388385    PS_VECTOR_F32_CHECK_ZERO_VECTOR(line, boolLineIsNull);
    389386
    390387    if (boolLineIsNull == true) {
    391388        min->value = func(params, coords);
    392         psTrace(__func__, 2, "p_psLineMin() called with zero line vector.  Return 0.0.  Function value is %f\n", min->value);
     389        psTrace(__func__, 2, "LineMin() called with zero line vector.  Return 0.0.  Function value is %f\n", min->value);
    393390        return(0.0);
    394391    }
     
    410407    while (numIterations < PS_LINEMIN_MAX_ITERATIONS) {
    411408        numIterations++;
    412         psTrace(__func__, 6, "p_psLineMin(): iteration %d\n", numIterations);
     409        psTrace(__func__, 6, "LineMin(): iteration %d\n", numIterations);
    413410
    414411        a = bracket->data.F32[0];
     
    464461            min->value = func(params, coords);
    465462            psFree(bracket);
    466             psTrace(__func__, 4, "---- p_psLineMin() end.a (%f) (%f) ----\n", mul, min->value);
     463            psTrace(__func__, 4, "---- LineMin() end.a (%f) (%f) ----\n", mul, min->value);
    467464            return(mul);
    468465        }
     
    472469    PS_VECTOR_ADD_MULTIPLE(params, paramMask, line, params, mul);
    473470    min->value = func(params, coords);
    474     psTrace(__func__, 4, "---- p_psLineMin() end.b (%f) %f ----\n", mul, min->value);
     471    psTrace(__func__, 4, "---- LineMin() end.b (%f) %f ----\n", mul, min->value);
    475472
    476473    psFree(bracket);
     
    488485 
    489486XXX: We do not use Brent's method.
    490  
    491 XXX: The SDR is silent about data types.  F32 is implemented here.
    492 Reimplement in F64, convert F32 vectors to F64.
    493487 *****************************************************************************/
    494488#define PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS 20
     
    574568                P_PSMINIMIZATION_SET_MAXITER((&dummyMin),PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS);
    575569                *(float*)&dummyMin.tol = PS_MINIMIZE_POWELL_LINEMIN_ERROR_TOLERANCE;
    576                 mul = p_psLineMin(&dummyMin,
    577                                   Q,
    578                                   ((psVector *) v->data[i]),
    579                                   myParamMask,
    580                                   coords,
    581                                   func);
     570                mul = LineMin(&dummyMin, Q, ((psVector *) v->data[i]),
     571                              myParamMask, coords, func);
    582572                if (isnan(mul)) {
    583573                    psError(PS_ERR_UNKNOWN, false,
     
    594584                currFuncVal = dummyMin.value;
    595585            }
     586            // XXX: how can it be that we are not saving mul anywhere?
    596587        }
    597588        psTrace(__func__, 6, "New function value is %f\n", currFuncVal);
     589        // XXX: There must be a bug here.  How can currFuncVal be the current function value?
     590        // It is simply the minimum along one of the parameter dimensions.
    598591
    599592        // 4: Set the vector u = Q - P
     
    616609        }
    617610
    618         mul = p_psLineMin(&dummyMin, params, u, myParamMask, coords, func);
     611        mul = LineMin(&dummyMin, params, u, myParamMask, coords, func);
    619612        if (isnan(mul)) {
    620613            psError(PS_ERR_UNKNOWN, false,
     
    628621            psFree(v);
    629622            min->iter = iterationNumber;
    630             // XXX: Ensure that currFuncVal is the correct value to use here.
    631623            min->value = currFuncVal;
    632             // XXX: ensure that the lastDelta should be 0.0.
    633624            min->lastDelta = 0.0;
    634625            psTrace(__func__, 4, "---- psMinimizePowell() end (1)(true) ----\n");
     
    690681This functions uses global variables to receive the function pointer, the
    691682data values, and the data errors.
    692  
    693 XXX: This is F32 only.  Must implement F64.
    694683 *****************************************************************************/
    695684static psF32 myPowellChi2Func(
Note: See TracChangeset for help on using the changeset viewer.