Changeset 10274
- Timestamp:
- Nov 29, 2006, 7:55:25 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r10173 r10274 16 16 * use ->min and ->max (PS_STAT_USE_RANGE) 17 17 * 18 * @version $Revision: 1.19 0$ $Name: not supported by cvs2svn $19 * @date $Date: 2006-11-2 3 05:33:28$18 * @version $Revision: 1.191 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2006-11-29 17:55:25 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1103 1103 psError(PS_ERR_UNKNOWN, false, "Failed to calculate the min/max of the input vector.\n"); 1104 1104 psFree(statsMinMax); 1105 psFree(mask);1106 1105 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1107 1106 return false; … … 1157 1156 psFree(statsMinMax); 1158 1157 psFree(histogram); 1159 psFree(mask);1160 1158 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1161 1159 return false; … … 1195 1193 psError(PS_ERR_UNKNOWN, false, "Failed to fit a gaussian to the robust histogram.\n"); 1196 1194 psFree(statsMinMax); 1195 psFree(histogram); 1197 1196 psFree(x); 1198 1197 psFree(y); 1199 1198 psFree(minimizer); 1200 1199 psFree(params); 1201 psFree(mask);1202 1200 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1203 1201 return false; … … 1294 1292 psError(PS_ERR_UNKNOWN, false, "Failed to calculate the min/max of the input vector.\n"); 1295 1293 psFree(statsMinMax); 1296 psFree(mask);1297 1294 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1298 1295 return false; … … 1312 1309 stats->robustN50 = numValid; 1313 1310 psFree(statsMinMax); 1314 psFree(mask);1315 1311 1316 1312 psTrace("psLib.math", 4, "---- %s(0) end ----\n", __func__); … … 1371 1367 psFree(histogram); 1372 1368 psFree(cumulative); 1373 psFree(mask);1374 1369 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1375 1370 return false; … … 1388 1383 psFree(histogram); 1389 1384 psFree(cumulative); 1390 psFree(mask);1391 1385 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1392 1386 return false; … … 1424 1418 psFree(histogram); 1425 1419 psFree(cumulative); 1426 psFree(mask);1427 1420 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1428 1421 return false; … … 1543 1536 psFree(statsMinMax); 1544 1537 psFree(cumulative); 1545 psFree(mask);1546 1538 psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__); 1547 1539 return false; … … 1561 1553 "could not determine the robustUQ: fitQuadraticSearchForYThenReturnX() returned a NAN.\n"); 1562 1554 psFree(statsMinMax); 1563 psFree(mask);1564 1555 psTrace("psLib.math", 4, "---- %s(1) end ----\n", __func__); 1565 1556 return false; … … 1584 1575 stats->fittedStdev = stats->robustStdev; // pass the guess sigma 1585 1576 stats->fittedMean = stats->robustMedian; // pass the guess mean 1586 vectorFittedStats (myVector, errors, mask, maskVal, stats); 1577 if (!vectorFittedStats(myVector, errors, mask, maskVal, stats)) { 1578 psError(PS_ERR_UNKNOWN, false, "Unable to estimate statistics (pass 1)"); 1579 psFree(statsMinMax); 1580 psFree(mask); 1581 1582 return false; 1583 } 1587 1584 // if there is a large swing in sigma, try a second time 1588 1585 if ((stats->fittedStdev/stats->robustStdev) < 0.75) { 1589 vectorFittedStats (myVector, errors, mask, maskVal, stats); 1586 if (!vectorFittedStats (myVector, errors, mask, maskVal, stats)) { 1587 psError(PS_ERR_UNKNOWN, false, "Unable to estimate statistics (pass 2)"); 1588 psFree(statsMinMax); 1589 psFree(mask); 1590 1591 return false; 1592 } 1590 1593 } 1591 1594 } … … 1966 1969 The stats structure. 1967 1970 1968 XXX: Should we free stats if the asserts fail? 1971 XXX: Should we free stats if the asserts fail? NO; we don't own it (RHL). 1969 1972 *****************************************************************************/ 1970 1973 psStats* psVectorStats( … … 2052 2055 if (!vectorRobustStats(inF32, errorsF32, maskU8, maskVal, stats)) { 2053 2056 psError(PS_ERR_UNKNOWN, false, _("Failed to calculate the specified statistic.")); 2054 psFree(stats);2055 2057 psFree(inF32); 2056 2058 psFree(errorsF32);
Note:
See TracChangeset
for help on using the changeset viewer.
