IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 30, 2010, 9:37:39 AM (16 years ago)
Author:
eugene
Message:

updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/psLib/src/math/psMinimizePowell.c

    r28655 r28795  
    8383f(param + b * line) < f(param + c * line)
    8484a < b < c
    85  
     85
    8686Algorithm:
    87  
     87
    8888XXX completely ad hoc:
    8989start with the user-supplied starting parameter and
    9090call that b.  Calculate a/c as a fractional amount smaller/larger than b.
    9191Repeat this process until a local minimum is found.
    92  
     92
    9393XXX: new algorithm:
    9494start at x=0, expand in one direction until the function
     
    9696increases, or x is too large.  If thst does not work, expand in the other
    9797direction.
    98  
     98
    9999XXX: output bracket vector should be an input as well.
    100100*****************************************************************************/
     
    335335along that vector and returns the offset along that vector at which the
    336336minimum is determined.
    337  
     337
    338338XXX: This routine is not very efficient in terms of total evaluations of the
    339339function.
     
    491491points at which the function is varied are in the argument "coords" which is
    492492a psArray of psVectors: each vector represents a different coordinate.
    493  
     493
    494494XXX: We do not use Brent's method.
    495495 *****************************************************************************/
     
    709709This routine is to be used with the psMinimizeChi2Powell() function below.
    710710and the psMinimizePowell() function above.
    711  
     711
    712712The basic idea is calculate chi-squared for a set of params/coords/errors.
    713713This functions uses global variables to receive the function pointer, the
     
    764764This routine must minimize the chi-squared match of a set of data points and
    765765values for a possibly multi-dimensional function.
    766  
     766
    767767The basic idea is to use the psMinimizePowell() function defined above.  In
    768768order to do so, we defined above a function myPowellChi2Func() which takes
     
    780780    psMinimizeChi2PowellFunc model)
    781781{
     782    PS_ASSERT_VECTOR_NON_NULL(params, false);
     783    PS_ASSERT_VECTOR_TYPE(params, PS_TYPE_F32, false);
     784    PS_ASSERT_ARRAY_NON_NULL(coords, false);
     785    PS_ASSERT_VECTOR_NON_NULL(value, false);
     786    PS_ASSERT_VECTOR_TYPE(value, PS_TYPE_F32, false);
     787    PS_ASSERT_VECTORS_SIZE_EQUAL(coords, value, false);
     788
    782789    // Generate extended version of coords array, so we can pass in extra data to the chi^2 function
    783790    psArray *newCoords = psArrayAlloc(coords->n + 3);
     
    791798    newCoords->data[coords->n + 2] = &model;
    792799
    793     bool success = psMinimizePowell(min, params, constraint->paramMask, newCoords, myPowellChi2Func);
     800    bool success = psMinimizePowell(min, params, constraint ? constraint->paramMask : NULL,
     801                                    newCoords, myPowellChi2Func);
    794802
    795803    newCoords->data[coords->n - 1] = NULL; // We can't free the array with a function pointer on it
Note: See TracChangeset for help on using the changeset viewer.