Changeset 5116 for trunk/psLib/src/math/psStats.c
- Timestamp:
- Sep 23, 2005, 2:46:45 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (80 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r5115 r5116 17 17 * 18 18 * 19 * @version $Revision: 1.14 8$ $Name: not supported by cvs2svn $20 * @date $Date: 2005-09-24 00: 26:36$19 * @version $Revision: 1.149 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2005-09-24 00:46:45 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 81 81 psBool p_psGetStatValue(const psStats* stats, psF64 *value) 82 82 { 83 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 83 84 // switch (stats->options & ~(PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE | PS_STAT_ROBUST_FOR_SAMPLE)) { 84 85 switch (stats->options & ~(PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE)) { 85 86 case PS_STAT_SAMPLE_MEAN: 86 87 *value = stats->sampleMean; 88 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 87 89 return true; 88 90 89 91 case PS_STAT_SAMPLE_MEDIAN: 90 92 *value = stats->sampleMedian; 93 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 91 94 return true; 92 95 93 96 case PS_STAT_SAMPLE_STDEV: 94 97 *value = stats->sampleStdev; 98 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 95 99 return true; 96 100 97 101 case PS_STAT_ROBUST_MEAN: 98 102 *value = stats->robustMean; 103 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 99 104 return true; 100 105 101 106 case PS_STAT_ROBUST_MEDIAN: 102 107 *value = stats->robustMedian; 108 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 103 109 return true; 104 110 105 111 case PS_STAT_ROBUST_MODE: 106 112 *value = stats->robustMode; 113 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 107 114 return true; 108 115 109 116 case PS_STAT_ROBUST_STDEV: 110 117 *value = stats->robustStdev; 118 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 111 119 return true; 112 120 113 121 case PS_STAT_CLIPPED_MEAN: 114 122 *value = stats->clippedMean; 123 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 115 124 return true; 116 125 117 126 case PS_STAT_CLIPPED_STDEV: 118 127 *value = stats->clippedStdev; 128 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 119 129 return true; 120 130 121 131 case PS_STAT_MAX: 122 132 *value = stats->max; 133 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 123 134 return true; 124 135 125 136 case PS_STAT_MIN: 126 137 *value = stats->min; 138 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 127 139 return true; 128 140 129 141 default: 142 psTrace(__func__, 4, "---- %s(false) end ----\n", __func__); 130 143 return false; 131 144 } … … 160 173 psStats* stats) 161 174 { 175 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 162 176 163 177 psS32 i = 0; // Loop index variable … … 285 299 stats->sampleMean = mean; 286 300 if (isnan(mean)) { 301 psTrace(__func__, 4, "---- %s(-1) end ----\n", __func__); 287 302 return(-1); 288 303 } else { 304 psTrace(__func__, 4, "---- %s(0) end ----\n", __func__); 289 305 return(0); 290 306 } … … 304 320 psStats* stats) 305 321 { 322 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 306 323 psS32 i = 0; // Loop index variable 307 324 psF32 max = -PS_MAX_F32; // The calculated maximum … … 354 371 } else { 355 372 stats->max = NAN; 373 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 356 374 return(1); 357 375 } 376 psTrace(__func__, 4, "---- %s(0) end ----\n", __func__); 358 377 return(0); 359 378 } … … 369 388 psStats* stats) 370 389 { 390 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 371 391 psS32 i = 0; // Loop index variable 372 392 psF32 min = PS_MAX_F32; // The calculated maximum … … 419 439 } else { 420 440 stats->min = NAN; 441 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 421 442 return(1); 422 443 } 444 psTrace(__func__, 4, "---- %s(0) end ----\n", __func__); 423 445 return(0); 424 446 } … … 435 457 psStats* stats) 436 458 { 459 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 437 460 PS_ASSERT_VECTOR_NON_NULL(myVector, -1); 438 461 PS_ASSERT_PTR_NON_NULL(stats, -1); … … 445 468 (stats->min <= myVector->data.F32[i]) && 446 469 (myVector->data.F32[i] <= stats->max)) { 470 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 447 471 return(true); 448 472 } … … 452 476 if ((stats->min <= myVector->data.F32[i]) && 453 477 (myVector->data.F32[i] <= stats->max)) { 478 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 454 479 return(true); 455 480 } … … 460 485 for (i = 0; i < myVector->n; i++) { 461 486 if (!(maskVal & maskVector->data.U8[i])) { 487 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 462 488 return(true); 463 489 } … … 465 491 } else { 466 492 if (myVector->n > 0) { 493 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 467 494 return(true); 468 495 } 469 496 } 470 497 } 498 psTrace(__func__, 4, "---- %s(false) end ----\n", __func__); 471 499 return(false); 472 500 } … … 483 511 psStats* stats) 484 512 { 513 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 485 514 PS_ASSERT_VECTOR_NON_NULL(myVector, -1); 486 515 PS_ASSERT_PTR_NON_NULL(stats, -1); … … 517 546 } 518 547 548 psTrace(__func__, 4, "---- %s(%d) end ----\n", __func__, numData); 519 549 return (numData); 520 550 } … … 532 562 psStats* stats) 533 563 { 564 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 534 565 psVector* unsortedVector = NULL; // Temporary vector 535 566 psVector* sortedVector = NULL; // Temporary vector … … 598 629 false, 599 630 PS_ERRORTEXT_psStats_STATS_SAMPLE_MEDIAN_SORT_PROBLEM); 631 psTrace(__func__, 4, "---- %s(false) end ----\n", __func__); 600 632 return(false); 601 633 } … … 615 647 616 648 // Return "true" on success. 649 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 617 650 return(true); 618 651 } … … 631 664 psF32 sigma) 632 665 { 633 psTrace(__func__, 3, "---- %s() begin ----\n", __func__);634 psTrace(__func__, 6, "(histogram->nums->n, sigma) is (%d, %.2f\n", (int) histogram->nums->n, sigma);666 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 667 psTrace(__func__, 5, "(histogram->nums->n, sigma) is (%d, %.2f\n", (int) histogram->nums->n, sigma); 635 668 PS_ASSERT_PTR_NON_NULL(histogram, NULL); 636 669 PS_ASSERT_PTR_NON_NULL(histogram->bounds, NULL); 637 670 PS_ASSERT_PTR_NON_NULL(histogram->nums, NULL); 671 if (psTraceGetLevel(__func__) >= 8) { 672 PS_VECTOR_PRINT_F32(histogram->nums); 673 } 638 674 639 675 psS32 numBins = histogram->nums->n; … … 668 704 false, 669 705 PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM); 670 psTrace(__func__, 3, "---- %s(NULL) end ----\n", __func__);706 psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__); 671 707 return(NULL); 672 708 } … … 684 720 false, 685 721 PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM); 686 psTrace(__func__, 3, "---- %s(NULL) end ----\n", __func__);722 psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__); 687 723 return(NULL); 688 724 } … … 745 781 } 746 782 747 psTrace(__func__, 3, "---- %s(psVector) end ----\n", __func__); 783 if (psTraceGetLevel(__func__) >= 8) { 784 PS_VECTOR_PRINT_F32(smooth); 785 } 786 psTrace(__func__, 4, "---- %s(psVector) end ----\n", __func__); 748 787 return(smooth); 749 788 } … … 766 805 psStats* stats) 767 806 { 807 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 768 808 psVector* unsortedVector = NULL; // Temporary vector 769 809 psVector* sortedVector = NULL; // Temporary vector … … 820 860 false, 821 861 PS_ERRORTEXT_psStats_STATS_SAMPLE_MEDIAN_SORT_PROBLEM); 862 psTrace(__func__, 4, "---- %s(false) end ----\n", __func__); 822 863 return(false); 823 864 } … … 832 873 psFree(unsortedVector); 833 874 psFree(sortedVector); 875 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 834 876 return(true); 835 877 } … … 853 895 psStats* stats) 854 896 { 897 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 855 898 psS32 i = 0; // Loop index variable 856 899 psS32 countInt = 0; // # of data points being used … … 870 913 stats->sampleStdev = NAN; 871 914 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): p_psVectorSampleMean() reported a NAN mean.\n"); 915 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 872 916 return; 873 917 } … … 928 972 stats->sampleStdev = sqrtf((sumSquares - (sumDiffs * sumDiffs / countFloat)) / (countFloat - 1)); 929 973 } 974 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 930 975 } 931 976 /****************************************************************************** … … 947 992 psStats* stats) 948 993 { 994 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 949 995 psS32 i = 0; // Loop index variable 950 996 psS32 countInt = 0; // # of data points being used … … 967 1013 stats->sampleStdev = NAN; 968 1014 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): p_psVectorSampleMean() reported a NAN mean.\n"); 1015 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 969 1016 return; 970 1017 } … … 1047 1094 } 1048 1095 } 1096 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 1049 1097 } 1050 1098 … … 1075 1123 psStats* stats) 1076 1124 { 1125 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1077 1126 psF32 clippedMean = 0.0; // self-explanatory 1078 1127 psF32 clippedStdev = 0.0; // self-explanatory … … 1121 1170 stats->clippedMean = NAN; 1122 1171 stats->clippedStdev = NAN; 1172 psTrace(__func__, 4, "---- %s(-2) end ----\n", __func__); 1123 1173 return(-2); 1124 1174 } … … 1130 1180 stats->clippedMean = NAN; 1131 1181 stats->clippedStdev = NAN; 1182 psTrace(__func__, 4, "---- %s(-2) end ----\n", __func__); 1132 1183 return(-2); 1133 1184 } … … 1184 1235 1185 1236 psFree(tmpMask); 1237 psTrace(__func__, 4, "---- %s(%d) end ----\n", __func__, rc); 1186 1238 return(rc); 1187 1239 } … … 1257 1309 psF64 outHigh) 1258 1310 { 1311 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1259 1312 switch (myData->type.type) { 1260 1313 case PS_TYPE_U8: … … 1296 1349 break; 1297 1350 } 1351 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 1298 1352 } 1299 1353 … … 1315 1369 psF32 getThisValue) 1316 1370 { 1371 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1317 1372 PS_ASSERT_POLY_NON_NULL(myPoly, NAN); 1318 1373 PS_ASSERT_FLOAT_LARGER_THAN(rangeHigh, rangeLow, NAN); … … 1324 1379 if (!((fLo <= getThisValue) && (fHi >= getThisValue))) { 1325 1380 psError(PS_ERR_UNKNOWN, true, "The requested y value (%f) does not fall within the specified range (%f to %f)\n", getThisValue, fLo, fHi); 1381 psTrace(__func__, 4, "---- %s(NAN) end ----\n", __func__); 1326 1382 return(NAN); 1327 1383 } … … 1351 1407 numIterations++; 1352 1408 } 1409 psTrace(__func__, 4, "---- %s(%f) end ----\n", __func__, midpoint); 1353 1410 return (midpoint); 1354 1411 } … … 1377 1434 psF32 yVal) 1378 1435 { 1379 psTrace(__func__, 3, "---- %s() begin ----\n", __func__);1380 psTrace(__func__, 6, "binNum, yVal is (%d, %f)\n", binNum, yVal);1436 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1437 psTrace(__func__, 5, "binNum, yVal is (%d, %f)\n", binNum, yVal); 1381 1438 if (psTraceGetLevel(__func__) >= 8) { 1382 1439 PS_VECTOR_PRINT_F32(xVec); … … 1424 1481 psFree(y); 1425 1482 psFree(yErr); 1426 psTrace(__func__, 3, "---- %s(NAN) end ----\n", __func__);1483 psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__); 1427 1484 return(NAN); 1428 1485 } … … 1440 1497 psFree(y); 1441 1498 psFree(yErr); 1442 psTrace(__func__, 3, "---- %s(NAN) end ----\n", __func__);1499 psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__); 1443 1500 return(NAN); 1444 1501 } … … 1466 1523 psFree(y); 1467 1524 psFree(yErr); 1468 psTrace(__func__, 3, "---- %s(NAN) end ----\n", __func__);1525 psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__); 1469 1526 return(NAN); 1470 1527 } … … 1489 1546 psFree(y); 1490 1547 psFree(yErr); 1491 psTrace(__func__, 3, "---- %s(NAN) end ----\n", __func__);1548 psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__); 1492 1549 return(NAN); 1493 1550 } … … 1517 1574 psFree(yErr); 1518 1575 1519 psTrace(__func__, 3, "---- %s(%f) end ----\n", __func__, tmpFloat);1576 psTrace(__func__, 5, "---- %s(%f) end ----\n", __func__, tmpFloat); 1520 1577 return(tmpFloat); 1521 1578 } … … 1526 1583 psVector *PsVectorDup(psVector *in) 1527 1584 { 1585 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1528 1586 PS_ASSERT_VECTOR_NON_NULL(in, NULL); 1529 1587 psVector *out = psVectorAlloc(in->n, in->type.type); … … 1539 1597 } else { 1540 1598 psError(PS_ERR_UNKNOWN, true, "Unallowable vector type.\n"); 1599 psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__); 1541 1600 return(NULL); 1542 1601 } 1602 psTrace(__func__, 4, "---- %s(psVector) end ----\n", __func__); 1543 1603 return(out); 1544 1604 } 1545 1546 /******************************************************************************1547 XXX: This function need to be written. Actually, it simply needs to be1548 retrieved from the CVS repository, since it was written earlier, then1549 discarded. At present, it was deleted from the CVS repository, so we might1550 have to retrieve it from tape.1551 *****************************************************************************/1552 psVector *Fit1DGaussian(psVector *x, psVector*y)1553 {1554 psError(PS_ERR_UNKNOWN, true, "This code has not been implemented yet.\n");1555 // XXX: This function was previously part of psStats.c, was removed, was1556 // purged from CVS, and now needs to be retrieved from tape.1557 1558 return(NULL);1559 }1560 1561 1562 1605 1563 1606 /****************************************************************************** … … 1568 1611 const psVector *coords) 1569 1612 { 1613 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1570 1614 PS_ASSERT_VECTOR_NON_NULL(params, NAN); 1571 1615 PS_ASSERT_VECTOR_SIZE(params, 2, NAN); … … 1593 1637 // printf("f(x, mean, stdev) = f(%.2f %.2f %.2f) is %.2f\n", x, mean, stdev, psGaussian(x, mean, stdev, false)); 1594 1638 1639 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 1595 1640 return(psGaussian(x, mean, stdev, false)); 1596 1641 } … … 1602 1647 psF32 y) 1603 1648 { 1604 // printf("HEY: LinInterpolate(%.2f %.2f %.2f %.2f %.2f)\n", x0, x1, y0, y1, y); 1649 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1650 psTrace(__func__, 5, "LinInterpolate(%.2f %.2f %.2f %.2f %.2f)\n", x0, x1, y0, y1, y); 1605 1651 if (y0 == y1) { 1606 1652 psLogMsg(__func__, PS_LOG_WARN, "WARNING: y0 == y1. Cannot interpolate. Returning NaN.\n"); 1607 1653 return(NAN); 1608 1654 } 1609 // printf("HMMM: LinInterpolate(%.2f %.2f %.2f %.2f %.2f %.2f)\n", x0, x1, y0, y1, y, 0 + y * (x1 - x0) / (y1 - y0)); 1610 1655 1656 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 1611 1657 return(x0 + y * (x1 - x0) / (y1 - y0)); 1612 1658 } 1613 1659 1660 // XXX: Get rid of this, or put it in psConstants.h 1614 1661 void PRINT_LEAKS() 1615 1662 { … … 1635 1682 1636 1683 /****************************************************************************** 1637 p_psVectorRobustStats(myVector, maskVector, maskVal, stats): this procedure 1638 calculates a variety of robust stat measures: 1639 PS_STAT_ROBUST_MEAN 1640 PS_STAT_ROBUST_MEDIAN 1641 PS_STAT_ROBUST_MODE 1642 PS_STAT_ROBUST_STDEV 1643 PS_STAT_ROBUST_QUARTILE 1644 I have included all that computation in a single function, as opposed to 1645 breaking it across several functions for one primary reason: they all require 1646 the same basic initial processing steps (calculate the histogram, etc.). 1647 1648 Inputs 1649 myVector 1650 maskVector 1651 maskVal 1652 stats 1653 Returns 1654 0 on success. 1655 1656 XXX: Check for errors in psLib routines that we call. 1657 *****************************************************************************/ 1658 1659 1660 /****************************************************************************** 1661 1662 p_psVectorRobustStatsNew(myVector, maskVector, maskVal, stats): This is the new 1684 p_psVectorRobustStats(myVector, maskVector, maskVal, stats): This is the new 1663 1685 version of the robust stats routine. 1664 1686 … … 1674 1696 1675 1697 XXX: Check for errors in psLib routines that we call. 1698 1699 XXX: Review and ensure that all memory is free'ed at premature exits. 1676 1700 *****************************************************************************/ 1677 psS32 p_psVectorRobustStats New(const psVector* myVector,1678 const psVector* errors,1679 const psVector* maskVector,1680 psU32 maskVal,1681 psStats* stats)1682 { 1683 psTrace(__func__, 3, "---- %s() begin ----\n", __func__);1701 psS32 p_psVectorRobustStats(const psVector* myVector, 1702 const psVector* errors, 1703 const psVector* maskVector, 1704 psU32 maskVal, 1705 psStats* stats) 1706 { 1707 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 1684 1708 if (psTraceGetLevel(__func__) >= 8) { 1685 1709 PS_VECTOR_PRINT_F32(myVector); … … 1722 1746 psFree(tmpMaskVec); 1723 1747 psFree(tmpScalar); 1724 psTrace(__func__, 3, "---- %s(1) end ----\n", __func__);1748 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 1725 1749 return(1); 1726 1750 } … … 1749 1773 psFree(tmpScalar); 1750 1774 1751 psTrace(__func__, 3, "---- %s(0) end ----\n", __func__);1775 psTrace(__func__, 4, "---- %s(0) end ----\n", __func__); 1752 1776 return(0); 1753 1777 } … … 1807 1831 psFree(tmpScalar); 1808 1832 psFree(tmpMaskVec); 1809 psTrace(__func__, 3, "---- %s(1) end ----\n", __func__);1833 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 1810 1834 return(1); 1811 1835 } … … 1862 1886 psFree(tmpScalar); 1863 1887 psFree(tmpMaskVec); 1864 psTrace(__func__, 3, "---- %s(1) end ----\n", __func__);1888 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 1865 1889 return(1); 1866 1890 } … … 1973 1997 psFree(tmpScalar); 1974 1998 psFree(tmpMaskVec); 1975 psTrace(__func__, 3, "---- %s(1) end ----\n", __func__);1999 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 1976 2000 return(1); 1977 2001 } … … 2031 2055 psFree(tmpScalar); 2032 2056 psFree(tmpMaskVec); 2033 psTrace(__func__, 3, "---- %s(1) end ----\n", __func__);2057 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 2034 2058 return(1); 2035 2059 } … … 2083 2107 psFree(cumulativeRobustHistogram); 2084 2108 psFree(tmpStatsMinMax); 2085 psTrace(__func__, 3, "---- %s(1) end ----\n", __func__);2109 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 2086 2110 return(1); 2087 2111 } … … 2179 2203 psFree(params); 2180 2204 psFree(tmpMaskVec); 2181 psTrace(__func__, 3, "---- %s(1) end ----\n", __func__);2205 psTrace(__func__, 4, "---- %s(1) end ----\n", __func__); 2182 2206 return(1); 2183 2207 } … … 2213 2237 psFree(robustHistogram); 2214 2238 2215 psTrace(__func__, 3, "---- %s(0) end ----\n", __func__);2239 psTrace(__func__, 4, "---- %s(0) end ----\n", __func__); 2216 2240 return(0); 2217 2241 } … … 2243 2267 psStats* psStatsAlloc(psStatsOptions options) 2244 2268 { 2269 psTrace(__func__, 3,"---- %s() begin ----\n", __func__); 2245 2270 psStats* newStruct = NULL; 2246 2271 … … 2270 2295 newStruct->options = options; 2271 2296 2297 psTrace(__func__, 3, "---- %s(psStats) end ----\n", __func__); 2272 2298 return (newStruct); 2273 2299 } … … 2295 2321 psHistogram* psHistogramAlloc(float lower, float upper, int n) 2296 2322 { 2323 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 2324 psTrace(__func__, 5, "(lower, upper, n) is (%f, %f, %d)\n", lower, upper, n); 2297 2325 PS_ASSERT_INT_POSITIVE(n, NULL); 2298 2326 PS_FLOAT_COMPARE(lower, upper, NULL); … … 2329 2357 newHist->uniform = true; 2330 2358 2359 psTrace(__func__, 3, "---- %s(psHistogram) end ----\n", __func__); 2331 2360 return (newHist); 2332 2361 } … … 2343 2372 psHistogram* psHistogramAllocGeneric(const psVector* bounds) 2344 2373 { 2374 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 2345 2375 PS_ASSERT_VECTOR_NON_NULL(bounds, NULL); 2346 2376 PS_ASSERT_VECTOR_TYPE(bounds, PS_TYPE_F32, NULL); … … 2371 2401 newHist->uniform = false; 2372 2402 2403 psTrace(__func__, 3, "---- %s(psHistogram) end ----\n", __func__); 2373 2404 return (newHist); 2374 2405 } … … 2406 2437 psF32 error) 2407 2438 { 2439 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 2408 2440 PS_ASSERT_PTR_NON_NULL(out, -1); 2409 2441 PS_ASSERT_PTR_NON_NULL(out->bounds, -1); … … 2444 2476 if (boxcarLeftBinNum == boxcarRightBinNum) { 2445 2477 out->nums->data.F32[binNum]+= 1.0; 2478 psTrace(__func__, 3, "---- %s(0) end ----\n", __func__); 2446 2479 return(0); 2447 2480 } … … 2471 2504 // Return 0 on success. 2472 2505 // 2506 psTrace(__func__, 3, "---- %s(0) end ----\n", __func__); 2473 2507 return(0); 2474 2508 } … … 2495 2529 psMaskType maskVal) 2496 2530 { 2531 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 2497 2532 PS_ASSERT_PTR_NON_NULL(out, NULL); 2498 2533 PS_ASSERT_VECTOR_NON_NULL(out->bounds, NULL); … … 2595 2630 psFree(errorsF32); 2596 2631 } 2632 2633 psTrace(__func__, 3, "---- %s(psHistogram) end ----\n", __func__); 2597 2634 return (out); 2598 2635 } … … 2610 2647 psVector* p_psConvertToF32(psVector* in) 2611 2648 { 2649 psTrace(__func__, 4,"---- %s() begin ----\n", __func__); 2612 2650 if (in == NULL) { 2613 2651 return(NULL); … … 2670 2708 strType); 2671 2709 } 2710 2711 psTrace(__func__, 4,"---- %s(psVector) end ----\n", __func__); 2672 2712 return (tmp); 2673 2713 } … … 2692 2732 psMaskType maskVal) 2693 2733 { 2734 psTrace(__func__, 3,"---- %s() begin ----\n", __func__); 2694 2735 PS_ASSERT_PTR_NON_NULL(stats, NULL); 2695 2736 PS_ASSERT_VECTOR_NON_NULL(in, stats); … … 2754 2795 // Since the various robust stats quantities share much computation, they 2755 2796 // are grouped together in a single private function: 2756 // p_psVectorRobustStats New()2797 // p_psVectorRobustStats() 2757 2798 if ((stats->options & PS_STAT_ROBUST_MEAN) || 2758 2799 (stats->options & PS_STAT_ROBUST_MEDIAN) || … … 2760 2801 (stats->options & PS_STAT_ROBUST_STDEV) || 2761 2802 (stats->options & PS_STAT_ROBUST_QUARTILE)) { 2762 if (0 != p_psVectorRobustStats New(inF32, errorsF32, mask, maskVal, stats)) {2803 if (0 != p_psVectorRobustStats(inF32, errorsF32, mask, maskVal, stats)) { 2763 2804 psError(PS_ERR_UNKNOWN, false, 2764 2805 PS_ERRORTEXT_psStats_STATS_FAILED); … … 2767 2808 // XXX: If so, do it for other funcs? 2768 2809 psFree(stats); 2810 psTrace(__func__, 3,"---- %s(NULL) end ----\n", __func__); 2769 2811 return(NULL); 2770 2812 } … … 2808 2850 psFree(errorsF32); 2809 2851 } 2852 psTrace(__func__, 3,"---- %s(psStats) end ----\n", __func__); 2810 2853 return (stats); 2811 2854 }
Note:
See TracChangeset
for help on using the changeset viewer.
