Changeset 6322
- Timestamp:
- Feb 3, 2006, 12:05:22 PM (20 years ago)
- Location:
- trunk/psLib/src/math
- Files:
-
- 3 edited
-
psMinimizeLMM.c (modified) (15 diffs)
-
psMinimizePowell.c (modified) (9 diffs)
-
psStats.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psMinimizeLMM.c
r6226 r6322 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 1-27 20:08:58$12 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-02-03 22:05:22 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 48 48 49 49 // XXX EAM : can we use static copies of LUv, LUm, A? 50 // XXX: Add trace messages, check return codes.51 50 psBool p_psMinLM_GuessABP( 52 51 psImage *Alpha, … … 75 74 A = psImageCopy(NULL, alpha, PS_TYPE_F64); 76 75 for (int j = 0; j < params->n; j++) { 77 if ((paramMask != NULL) && (paramMask->data.U8[j])) 76 if ((paramMask != NULL) && (paramMask->data.U8[j])) { 78 77 continue; 78 } 79 79 A->data.F64[j][j] = alpha->data.F64[j][j] * (1.0 + lambda); 80 80 } … … 83 83 // these operations do not modify the input values (creates LUm, LUv) 84 84 LUm = psMatrixLUD(NULL, &LUv, A); 85 if (LUm == NULL) { 86 psError(PS_ERR_UNKNOWN, false, "psMatrixLUD() returned NULL\n"); 87 } 85 88 Beta = psMatrixLUSolve(Beta, LUm, beta, LUv); 89 if (Beta == NULL) { 90 psError(PS_ERR_UNKNOWN, false, "psMatrixLUSolve() returned NULL\n"); 91 } 86 92 Alpha = psMatrixInvert(Alpha, A, &det); 87 93 psFree(LUm); 94 psFree(LUv); 95 psFree(A); 96 97 if (Alpha == NULL) { 98 psError(PS_ERR_UNKNOWN, false, "psMatrixInvert() returned NULL\n"); 99 return(false); 100 } 88 101 # else 89 102 // gauss-jordan version … … 94 107 Alpha = psImageCopy(Alpha, alpha, PS_TYPE_F64); 95 108 for (int j = 0; j < params->n; j++) { 96 if ((paramMask != NULL) && (paramMask->data.U8[j])) 109 if ((paramMask != NULL) && (paramMask->data.U8[j])) { 97 110 continue; 111 } 98 112 Alpha->data.F64[j][j] = alpha->data.F64[j][j] * (1.0 + lambda); 99 113 } 100 114 101 // XXX: Check error codes! 102 psGaussJordan(Alpha, Beta); 103 psFree(A); 104 psFree(LUm); 105 psFree(LUv); 115 if (false == psGaussJordan(Alpha, Beta)) { 116 psError(PS_ERR_UNKNOWN, false, "psMatrixInvert() returned NULL\n"); 117 return(false); 118 } 106 119 # endif 107 120 108 121 // apply Beta to get new Params values 109 122 for (int j = 0; j < params->n; j++) { 110 if ((paramMask != NULL) && (paramMask->data.U8[j])) 123 if ((paramMask != NULL) && (paramMask->data.U8[j])) { 111 124 continue; 125 } 112 126 // Params->data.F32[j] = params->data.F32[j] - Beta->data.F64[j]; 113 127 // compare Beta to beta limits … … 126 140 } 127 141 } 128 # if (USE_LU_DECOMP)129 psFree(A);130 psFree(LUm);131 psFree(LUv);132 # endif133 142 134 143 return(true); … … 136 145 137 146 138 // XXX: Add trace messages, check return codes.139 147 bool psMinimizeGaussNewtonDelta( 140 148 psVector *delta, … … 146 154 psMinimizeLMChi2Func func) 147 155 { 156 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 148 157 // allocate internal arrays (current vs Guess) 149 158 psImage *alpha = psImageAlloc (params->n, params->n, PS_TYPE_F64); … … 152 161 psVector *Params = psVectorAlloc(params->n, PS_TYPE_F64); 153 162 psVector *dy = NULL; 163 psBool rc = true; 154 164 155 165 // the user provides the error or NULL. we need to convert … … 162 172 } 163 173 164 p_psMinLM_SetABX(alpha, beta, params, paramMask, x, y, dy, func); 165 p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0); 174 psF64 rcF64 = p_psMinLM_SetABX(alpha, beta, params, paramMask, x, y, dy, func); 175 if (isnan(rcF64)) { 176 psError(PS_ERR_UNKNOWN, false, "p_psMinLM_SetABX() retruned a NAN.\n"); 177 rc = false; 178 } 179 psTrace(__func__, 5, "p_psMinLM_SetABX() was succesful\n", __func__); 180 181 psBool rcBool = p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0); 182 if (rcBool == false) { 183 psError(PS_ERR_UNKNOWN, false, "p_psMinLM_GuessABP() retruned FALSE.\n"); 184 rc = false; 185 } 186 psTrace(__func__, 5, "p_psMinLM_GuessABP() was succesful\n", __func__); 166 187 167 188 psFree(alpha); … … 172 193 psFree(dy); 173 194 } 174 return (true); 195 psTrace(__func__, 3, "---- %s() end ----\n", __func__); 196 return(rc); 175 197 } 176 198 … … 235 257 236 258 for (psS32 j = 0; j < params->n; j++) { 237 if ((paramMask != NULL) && (paramMask->data.U8[j])) 259 if ((paramMask != NULL) && (paramMask->data.U8[j])) { 238 260 continue; 261 } 239 262 weight = deriv->data.F32[j] * dy->data.F32[i]; 240 263 for (psS32 k = 0; k <= j; k++) { 241 if ((paramMask != NULL) && (paramMask->data.U8[k])) 264 if ((paramMask != NULL) && (paramMask->data.U8[k])) { 242 265 continue; 266 } 243 267 alpha->data.F64[j][k] += weight * deriv->data.F32[k]; 244 268 } … … 394 418 } 395 419 if (psTraceGetLevel (__func__) >= 6) { 396 //XXX: p_psVectorPrintRow(psTraceGetDestination(), Params, "params guess"); 420 psTrace(__func__, 6, "The current Param vector: \n"); 421 for (psS32 i = 0 ; i < Params->n ; i++) { 422 psTrace(__func__, 6, "Params[%d] is %f\n", Params->data.F32[i]); 423 } 397 424 } 398 425 … … 416 443 } 417 444 if (psTraceGetLevel(__func__) >= 6) { 418 //XXX: p_psVectorPrintRow(psTraceGetDestination(), Params, "params guess"); 445 if (psTraceGetLevel (__func__) >= 6) { 446 psTrace(__func__, 6, "The current Param vector: \n"); 447 for (psS32 i = 0 ; i < Params->n ; i++) { 448 psTrace(__func__, 6, "Params[%d] is %f\n", Params->data.F32[i]); 449 } 450 } 419 451 } 420 452 … … 628 660 bool psMemCheckConstrain(psPtr tmp) 629 661 { 630 return( psMemGetDeallocator(tmp) == (psFreeFunc)constrainFree);631 } 662 return(psMemGetDeallocator(tmp) == (psFreeFunc) constrainFree); 663 } -
trunk/psLib/src/math/psMinimizePowell.c
r6186 r6322 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-0 1-23 22:25:31$11 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-02-03 22:05:22 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 15 *16 * XXX: must follow coding name standards on local functions.17 * XXX: put local functions in front.18 15 * 19 16 */ … … 69 66 /*****************************************************************************/ 70 67 /* GLOBAL VARIABLES */ 71 /* XXX: Do these conform to code standard? */72 68 /*****************************************************************************/ 73 69 static psMinimizeChi2PowellFunc Chi2PowellFunc = NULL; 74 static psVector * myValue;75 static psVector * myError;70 static psVector *PowellValue; 71 static psVector *PowellError; 76 72 /*****************************************************************************/ 77 73 /* FILE STATIC VARIABLES */ … … 97 93 Repeat this process until a local minimum is found. 98 94 99 XXX: 100 new algorithm: 95 XXX: new algorithm: 101 96 start at x=0, expand in one direction until the function 102 97 decreases. Then you have two points in the bracket. Keep going until it … … 104 99 direction. 105 100 106 XXX: 107 This is F32 only. Must add 108 F64 support (actually, make the defaults F64, 101 XXX: This is F32 only. Must add F64 support (actually, make the defaults F64, 109 102 and convert F32 vectors to F64). 110 103 111 XXX: 112 output bracket vector should be an input as well. 104 XXX: output bracket vector should be an input as well. 113 105 *****************************************************************************/ 114 106 psVector *p_psDetermineBracket( … … 355 347 *****************************************************************************/ 356 348 #define PS_LINEMIN_MAX_ITERATIONS 30 357 psF32 p_psLineMin(psMinimization *min, 358 psVector *params, 359 psVector *line, 360 const psVector *paramMask, 361 const psArray *coords, 362 psMinimizePowellFunc func) 349 psF32 p_psLineMin( 350 psMinimization *min, 351 psVector *params, 352 psVector *line, 353 const psVector *paramMask, 354 const psArray *coords, 355 psMinimizePowellFunc func) 363 356 { 364 357 PS_ASSERT_PTR_NON_NULL(min, NAN); … … 502 495 #define PS_MINIMIZE_POWELL_LINEMIN_ERROR_TOLERANCE 0.01 503 496 504 bool psMinimizePowell(psMinimization *min, 505 psVector *params, 506 const psVector *paramMask, 507 const psArray *coords, 508 psMinimizePowellFunc func) 497 bool psMinimizePowell( 498 psMinimization *min, 499 psVector *params, 500 const psVector *paramMask, 501 const psArray *coords, 502 psMinimizePowellFunc func) 509 503 { 510 504 PS_ASSERT_PTR_NON_NULL(min, NULL); … … 696 690 This functions uses global variables to receive the function pointer, the 697 691 data values, and the data errors. 692 698 693 XXX: This is F32 only. Must implement F64. 699 694 *****************************************************************************/ 700 static psF32 myPowellChi2Func(const psVector *params, 701 const psArray *coords) 695 static psF32 myPowellChi2Func( 696 const psVector *params, 697 const psArray *coords) 702 698 { 703 699 psTrace(__func__, 4, "---- myPowellChi2Func() begin ----\n"); 704 700 PS_ASSERT_VECTOR_NON_NULL(params, NAN); 705 701 PS_ASSERT_VECTOR_NON_EMPTY(params, NAN); 706 PS_ASSERT_VECTOR_NON_NULL( myValue, NAN);707 PS_ASSERT_VECTOR_NON_EMPTY( myValue, NAN);702 PS_ASSERT_VECTOR_NON_NULL(PowellValue, NAN); 703 PS_ASSERT_VECTOR_NON_EMPTY(PowellValue, NAN); 708 704 PS_ASSERT_PTR_NON_NULL(coords, NAN); 709 705 … … 714 710 715 711 tmp = Chi2PowellFunc(params, coords); 716 if ( myError == NULL) {712 if (PowellError == NULL) { 717 713 for (i=0;i<coords->n;i++) { 718 d = (tmp->data.F32[i] - myValue->data.F32[i]);714 d = (tmp->data.F32[i] - PowellValue->data.F32[i]); 719 715 chi2+= d * d; 720 716 } 721 717 } else { 722 718 for (i=0;i<coords->n;i++) { 723 d = (tmp->data.F32[i] - myValue->data.F32[i]) / myError->data.F32[i];719 d = (tmp->data.F32[i] - PowellValue->data.F32[i]) / PowellError->data.F32[i]; 724 720 chi2+= d * d; 725 721 } … … 741 737 psMinimizePowell(). 742 738 *****************************************************************************/ 743 bool psMinimizeChi2Powell(psMinimization *min, 744 psVector *params, 745 const psVector *paramMask, 746 const psArray *coords, 747 const psVector *value, 748 const psVector *error, 749 psMinimizeChi2PowellFunc model) 739 bool psMinimizeChi2Powell( 740 psMinimization *min, 741 psVector *params, 742 const psVector *paramMask, 743 const psArray *coords, 744 const psVector *value, 745 const psVector *error, 746 psMinimizeChi2PowellFunc model) 750 747 { 751 myValue = (psVector *) value;752 myError = (psVector *) error;748 PowellValue = (psVector *) value; 749 PowellError = (psVector *) error; 753 750 754 751 Chi2PowellFunc = model; -
trunk/psLib/src/math/psStats.c
r6315 r6322 16 16 * use ->min and ->max (PS_STAT_USE_RANGE) 17 17 * 18 * @version $Revision: 1.16 6$ $Name: not supported by cvs2svn $19 * @date $Date: 2006-02-03 01:30:14$18 * @version $Revision: 1.167 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2006-02-03 22:05:22 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 303 303 max of the input vector. If there was a problem with the max calculation, 304 304 this routine sets stats->max to NAN. 305 306 XXX: Do we need to factor errors into it?307 305 *****************************************************************************/ 308 306 psS32 p_psVectorMax(const psVector* myVector, … … 549 547 median of the input vector. Returns true on success (including if there were 550 548 no valid input vector elements). 551 552 XXX: Use static vectors for sort arrays.553 549 *****************************************************************************/ 554 550 bool p_psVectorSampleMedian(const psVector* myVector, … … 783 779 { 784 780 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 785 psVector* unsortedVector = NULL; // Temporary vector786 psVector* sortedVector = NULL; // Temporary vector787 psS32 i = 0; // Loop index variable788 psS32 count = 0; // # of points in this mean.789 psS32 nValues = 0; // # data points781 psVector* unsortedVector = NULL; 782 psVector* sortedVector = NULL; 783 psS32 i = 0; 784 psS32 count = 0; 785 psS32 nValues = 0; 790 786 791 787 // Determine how many data points fit inside this min/max range 792 // and are not ma xed, IFthe maskVector is not NULL.788 // and are not masked, if the maskVector is not NULL. 793 789 nValues = p_psVectorNValues(myVector, maskVector, maskVal, stats); 794 790 … … 796 792 unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32); 797 793 798 // Determine if we must only use data points within a min/max range.799 794 if (stats->options & PS_STAT_USE_RANGE) { 800 795 // Store all non-masked data points within the min/max range … … 1001 996 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1002 997 psTrace(__func__, 4, "Trace level is %d\n", psTraceGetLevel(__func__)); 1003 psF32 clippedMean = 0.0; // self-explanatory1004 psF32 clippedStdev = 0.0; // self-explanatory1005 psVector* tmpMask = NULL; // Temporary vector for masks during iterations.1006 static psStats *statsTmp = NULL; // Temporary psStats struct.1007 psS32 rc = 0; // Return code.998 psF32 clippedMean = 0.0; 999 psF32 clippedStdev = 0.0; 1000 psVector* tmpMask = NULL; 1001 static psStats *statsTmp = NULL; 1002 psS32 rc = 0; 1008 1003 1009 1004 // Ensure that stats->clipIter is within the proper range. … … 1189 1184 parameter). 1190 1185 1191 XXX: After you fit the polynomial, solve for X analytically.1192 1193 XXX: the vectors do not have to be the same length. Must insert the proper1194 tests to ensure that binNum is within acceptable ranges for both vectors.1195 1196 XXX: This currently assumes that the three points are monotonically increasing1197 or decreasing: so, it works for the cumulative histogram vectors, but not for1198 arbitrary vectors. We should probably test that condition.1199 1186 *****************************************************************************/ 1200 1187 psF32 fitQuadraticSearchForYThenReturnX( … … 1221 1208 psVector *x = psVectorAlloc(3, PS_TYPE_F64); 1222 1209 psVector *y = psVectorAlloc(3, PS_TYPE_F64); 1223 psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);1224 1225 1210 psF32 tmpFloat = 0.0f; 1226 1211 1227 if ((binNum > 0) && (binNum < (yVec->n - 2))) {1212 if ((binNum >= 1) && (binNum < (yVec->n - 2)) && (binNum < (xVec->n - 2))) { 1228 1213 // The general case. We have all three points. 1229 1214 x->data.F64[0] = (psF64) (0.5 * (xVec->data.F32[binNum - 1] + xVec->data.F32[binNum])); … … 1234 1219 y->data.F64[2] = yVec->data.F32[binNum + 1]; 1235 1220 psTrace(__func__, 6, "x vec (orig) is (%f %f %f %f)\n", xVec->data.F32[binNum - 1], 1236 xVec->data.F32[binNum], 1237 xVec->data.F32[binNum+1], 1238 xVec->data.F32[binNum+2]); 1239 psTrace(__func__, 6, "x vec is (%f %f %f)\n", x->data.F64[0], x->data.F64[1], x->data.F64[2]); 1240 psTrace(__func__, 6, "y vec is (%f %f %f)\n", y->data.F64[0], y->data.F64[1], y->data.F64[2]); 1221 xVec->data.F32[binNum], xVec->data.F32[binNum+1], xVec->data.F32[binNum+2]); 1222 psTrace(__func__, 6, "x data is (%f %f %f)\n", x->data.F64[0], x->data.F64[1], x->data.F64[2]); 1223 psTrace(__func__, 6, "y data is (%f %f %f)\n", y->data.F64[0], y->data.F64[1], y->data.F64[2]); 1241 1224 1242 1225 // … … 1246 1229 // so that the following checks are not necessary. 1247 1230 // 1248 if (y->data.F64[0] < y->data.F64[1]) { 1249 if (!(y->data.F64[1] <= y->data.F64[2])) { 1250 psError(PS_ERR_UNKNOWN, true, "This routine must be called with montically increasing or decreasing data points.\n"); 1251 psFree(x); 1252 psFree(y); 1253 psFree(yErr); 1254 psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__); 1255 return(NAN); 1256 } 1257 // Ensure that yVal is within the range of the bins we are using. 1258 if (!((y->data.F64[0] <= yVal) && (yVal <= y->data.F64[2]))) { 1259 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 1260 PS_ERRORTEXT_psStats_YVAL_OUT_OF_RANGE, 1261 (psF64)yVal, y->data.F64[2], y->data.F64[0]); 1262 } 1263 } else if (y->data.F64[0] > y->data.F64[1]) { 1264 if (!(y->data.F64[1] >= y->data.F64[2])) { 1265 psError(PS_ERR_UNKNOWN, true, "This routine must be called with montically increasing or decreasing data points.\n"); 1266 psFree(x); 1267 psFree(y); 1268 psFree(yErr); 1269 psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__); 1270 return(NAN); 1271 } 1272 // Ensure that yVal is within the range of the bins we are using. 1273 if (!((y->data.F64[2] <= yVal) && (yVal <= y->data.F64[0]))) { 1274 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 1275 PS_ERRORTEXT_psStats_YVAL_OUT_OF_RANGE, 1276 (psF64)yVal, y->data.F64[2], y->data.F64[0]); 1277 } 1278 } 1279 1280 yErr->data.F64[0] = 1.0; 1281 yErr->data.F64[1] = 1.0; 1282 yErr->data.F64[2] = 1.0; 1231 if (! (((y->data.F64[0] <= yVal) && (yVal <= y->data.F64[2])) || 1232 ((y->data.F64[2] <= yVal) && (yVal <= y->data.F64[0]))) ) { 1233 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 1234 PS_ERRORTEXT_psStats_YVAL_OUT_OF_RANGE, 1235 (psF64)yVal, y->data.F64[0], y->data.F64[2]); 1236 } 1237 1238 if (((y->data.F64[0] < y->data.F64[1]) && !(y->data.F64[1] <= y->data.F64[2])) || 1239 ((y->data.F64[0] > y->data.F64[1]) && !(y->data.F64[1] >= y->data.F64[2]))) { 1240 psError(PS_ERR_UNKNOWN, true, "This routine must be called with monotonically increasing or decreasing data points.\n"); 1241 psFree(x); 1242 psFree(y); 1243 psTrace(__func__, 5, "---- %s() end ----\n", __func__); 1244 return(NAN); 1245 } 1283 1246 1284 1247 // Determine the coefficients of the polynomial. 1285 1248 psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2); 1286 myPoly = psVectorFitPolynomial1D(myPoly, NULL, 0, y, yErr, x);1249 myPoly = psVectorFitPolynomial1D(myPoly, NULL, 0, y, NULL, x); 1287 1250 if (myPoly == NULL) { 1288 psError(PS_ERR_UNEXPECTED_NULL, 1289 false, 1251 psError(PS_ERR_UNEXPECTED_NULL, false, 1290 1252 PS_ERRORTEXT_psStats_STATS_FIT_QUADRATIC_POLYNOMIAL_1D_FIT); 1291 1253 psFree(x); 1292 1254 psFree(y); 1293 psFree(yErr);1294 1255 psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__); 1295 1256 return(NAN); … … 1309 1270 if (isnan(tmpFloat)) { 1310 1271 psError(PS_ERR_UNEXPECTED_NULL, 1311 false, 1312 PS_ERRORTEXT_psStats_STATS_FIT_QUADRATIC_POLY_MEDIAN); 1272 false, PS_ERRORTEXT_psStats_STATS_FIT_QUADRATIC_POLY_MEDIAN); 1313 1273 psFree(x); 1314 1274 psFree(y); 1315 psFree(yErr);1316 1275 psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__); 1317 1276 return(NAN); 1318 1277 } 1319 1320 1278 } else { 1321 // The special case where we have two points only at the beginning of 1322 // the vectors x and y. 1279 // These are special cases where the bin is at the beginning or end of the vector. 1323 1280 if (binNum == 0) { 1281 // We have two points only at the beginning of the vectors x and y. 1324 1282 tmpFloat = 0.5 * (xVec->data.F32[binNum] + 1325 1283 xVec->data.F32[binNum + 1]); … … 1339 1297 psFree(x); 1340 1298 psFree(y); 1341 psFree(yErr);1342 1299 1343 1300 psTrace(__func__, 5, "---- %s(%f) end ----\n", __func__, tmpFloat); … … 1542 1499 // ADD: Step 3. 1543 1500 // Interpolate to the exact 50% position: this is the robust histogram median. 1544 // XXX: Check return codes.1545 1501 // 1546 1502 stats->robustMedian = fitQuadraticSearchForYThenReturnX( … … 1549 1505 binMedian, 1550 1506 totalDataPoints/2.0); 1507 if (isnan(stats->robustMedian)) { 1508 psError(PS_ERR_UNKNOWN, false, "Failed to fit a quadratic and calculate the 50-percent position.\n"); 1509 psFree(tmpStatsMinMax); 1510 psFree(robustHistogram); 1511 psFree(cumulativeRobustHistogram); 1512 psFree(tmpMaskVec); 1513 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 1514 return(1); 1515 } 1551 1516 psTrace(__func__, 6, "Current robust median is %f\n", stats->robustMedian); 1552 1517 … … 2324 2289 binNum = (psS32)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize); 2325 2290 if (errorsF32 != NULL) { 2326 // XXX: Check return codes. 2327 UpdateHistogramBins(binNum, out, 2328 inF32->data.F32[i], 2329 errorsF32->data.F32[i]); 2291 psS32 rc = UpdateHistogramBins(binNum, out, inF32->data.F32[i], 2292 errorsF32->data.F32[i]); 2293 if (rc < 0) { 2294 psLogMsg(__func__, PS_LOG_WARN, "WARNING: Failed to update the histogram bins with the errors vector.\n"); 2295 } 2330 2296 } else { 2331 2297 // XXX: This if-statement really shouldn't be necessary. … … 2348 2314 } else { 2349 2315 if (errorsF32 != NULL) { 2350 // XXX: Check return codes. 2351 UpdateHistogramBins(binNum, out, 2352 inF32->data.F32[i], 2353 errors->data.F32[i]); 2316 psS32 rc = UpdateHistogramBins(binNum, out, 2317 inF32->data.F32[i], 2318 errors->data.F32[i]); 2319 if (rc < 0) { 2320 psLogMsg(__func__, PS_LOG_WARN, "WARNING: Failed to update the histogram bins with the errors vector.\n"); 2321 } 2354 2322 } else { 2355 2323 (out->nums->data.F32[binNum])+= 1.0;
Note:
See TracChangeset
for help on using the changeset viewer.
