Changeset 6226 for trunk/psLib/src/math
- Timestamp:
- Jan 27, 2006, 10:08:58 AM (21 years ago)
- Location:
- trunk/psLib/src/math
- Files:
-
- 3 edited
-
psMinimizeLMM.c (modified) (6 diffs)
-
psMinimizeLMM.h (modified) (3 diffs)
-
psMinimizePolyFit.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psMinimizeLMM.c
r6204 r6226 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-01-2 6 21:10:22$12 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-01-27 20:08:58 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 277 277 NOTES: EAM: this is my re-implementation of MinLM 278 278 279 XXX: Must implement code to handle the constrain->min, ->max, ->delta members. 280 279 281 XXX: Put the ASSERTS in. 280 282 … … 283 285 will have to convert all F32 input vectors to F64 regardless. So, 284 286 the F64 port might be. 287 285 288 *****************************************************************************/ 286 289 psBool psMinimizeLMChi2( … … 288 291 psImage *covar, 289 292 psVector *params, 290 const psVector *paramMask,293 psMinConstrain *constrain, 291 294 const psArray *x, 292 295 const psVector *y, … … 300 303 PS_ASSERT_VECTOR_NON_EMPTY(params, false); 301 304 PS_ASSERT_VECTOR_TYPE(params, PS_TYPE_F32, false); 302 if (paramMask != NULL) { 303 PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_U8, false); 304 PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramMask, false); 305 psVector *paramMask = NULL; 306 if (constrain != NULL) { 307 paramMask = constrain->paramMask; 308 if (paramMask != NULL) { 309 PS_ASSERT_VECTOR_TYPE(paramMask, PS_TYPE_U8, false); 310 PS_ASSERT_VECTORS_SIZE_EQUAL(params, paramMask, false); 311 } 312 if (constrain->paramMin != NULL) { 313 psLogMsg(__func__, PS_LOG_WARN, "WARNING: the constrain->paramMin vector is currently ignored.\n"); 314 } 315 if (constrain->paramMax != NULL) { 316 psLogMsg(__func__, PS_LOG_WARN, "WARNING: the constrain->paramMax vector is currently ignored.\n"); 317 } 318 if (constrain->paramDelta != NULL) { 319 psLogMsg(__func__, PS_LOG_WARN, "WARNING: the constrain->paramDelta vector is currently ignored.\n"); 320 } 305 321 } 306 322 PS_ASSERT_PTR_NON_NULL(x, false); … … 592 608 return( psMemGetDeallocator(ptr) == (psFreeFunc)minimizationFree ); 593 609 } 610 611 612 static void constrainFree(psMinConstrain *tmp) 613 { 614 // There are no dynamically allocated items 615 } 616 617 psMinConstrain* psMinConstrainAlloc() 618 { 619 psMinConstrain *tmp = psAlloc(sizeof(psMinConstrain)); 620 tmp->paramMask = NULL; 621 tmp->paramMax = NULL; 622 tmp->paramMin = NULL; 623 tmp->paramDelta = NULL; 624 625 return(tmp); 626 } 627 628 bool psMemCheckConstrain(psPtr tmp) 629 { 630 return( psMemGetDeallocator(tmp) == (psFreeFunc)constrainFree ); 631 } -
trunk/psLib/src/math/psMinimizeLMM.h
r6185 r6226 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-01-2 3 20:44:29$10 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-01-27 20:08:58 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 psMinimization; 53 53 54 55 /** A data structure for minimization routines. 56 * 57 * 58 */ 59 typedef struct 60 { 61 psVector *paramMask; ///< valid / invalid parameters 62 psVector *paramMax; ///< max allowed parameters 63 psVector *paramMin; ///< min allowed parameters 64 psVector *paramDelta; ///< max allowed param swing 65 } 66 psMinConstrain; 67 68 psMinConstrain *psMinConstrainAlloc(); 69 54 70 #define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val 55 71 #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val 56 57 72 58 73 /** Allocates a psMinimization structure. … … 97 112 psImage *covar, ///< Covariance matrix 98 113 psVector *params, ///< "Best Guess" for the parameters that minimize func 99 const psVector *paramMask, ///< Parameters to be held fixed by the minimizer114 psMinConstrain *constrain, ///< Constraints on the parameters 100 115 const psArray *x, ///< Measurement ordinates of multiple vectors 101 116 const psVector *y, ///< Measurement coordinates -
trunk/psLib/src/math/psMinimizePolyFit.c
r6204 r6226 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-01-2 6 21:10:22$12 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-01-27 20:08:58 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1032 1032 psF32 minClipSigma; 1033 1033 psF32 maxClipSigma; 1034 if (isnan(stats->max) || isfinite(stats->max)) { 1034 if (isfinite(stats->max)) { 1035 maxClipSigma = fabs(stats->max); 1036 } else { 1035 1037 maxClipSigma = fabs(stats->clipSigma); 1036 } else {1037 maxClipSigma = fabs(stats->max);1038 }1039 if (isnan(stats->min) || isfinite(stats->min)){1038 } 1039 if (isfinite(stats->min)) { 1040 minClipSigma = fabs(stats->min); 1041 } else { 1040 1042 minClipSigma = fabs(stats->clipSigma); 1041 } else {1042 minClipSigma = fabs(stats->min);1043 1043 } 1044 1044
Note:
See TracChangeset
for help on using the changeset viewer.
