- Timestamp:
- Jul 30, 2010, 9:37:39 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psLib/src/math/psMinimizePowell.c
r28655 r28795 83 83 f(param + b * line) < f(param + c * line) 84 84 a < b < c 85 85 86 86 Algorithm: 87 87 88 88 XXX completely ad hoc: 89 89 start with the user-supplied starting parameter and 90 90 call that b. Calculate a/c as a fractional amount smaller/larger than b. 91 91 Repeat this process until a local minimum is found. 92 92 93 93 XXX: new algorithm: 94 94 start at x=0, expand in one direction until the function … … 96 96 increases, or x is too large. If thst does not work, expand in the other 97 97 direction. 98 98 99 99 XXX: output bracket vector should be an input as well. 100 100 *****************************************************************************/ … … 335 335 along that vector and returns the offset along that vector at which the 336 336 minimum is determined. 337 337 338 338 XXX: This routine is not very efficient in terms of total evaluations of the 339 339 function. … … 491 491 points at which the function is varied are in the argument "coords" which is 492 492 a psArray of psVectors: each vector represents a different coordinate. 493 493 494 494 XXX: We do not use Brent's method. 495 495 *****************************************************************************/ … … 709 709 This routine is to be used with the psMinimizeChi2Powell() function below. 710 710 and the psMinimizePowell() function above. 711 711 712 712 The basic idea is calculate chi-squared for a set of params/coords/errors. 713 713 This functions uses global variables to receive the function pointer, the … … 764 764 This routine must minimize the chi-squared match of a set of data points and 765 765 values for a possibly multi-dimensional function. 766 766 767 767 The basic idea is to use the psMinimizePowell() function defined above. In 768 768 order to do so, we defined above a function myPowellChi2Func() which takes … … 780 780 psMinimizeChi2PowellFunc model) 781 781 { 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 782 789 // Generate extended version of coords array, so we can pass in extra data to the chi^2 function 783 790 psArray *newCoords = psArrayAlloc(coords->n + 3); … … 791 798 newCoords->data[coords->n + 2] = &model; 792 799 793 bool success = psMinimizePowell(min, params, constraint->paramMask, newCoords, myPowellChi2Func); 800 bool success = psMinimizePowell(min, params, constraint ? constraint->paramMask : NULL, 801 newCoords, myPowellChi2Func); 794 802 795 803 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.
