Changeset 24884
- Timestamp:
- Jul 21, 2009, 2:52:17 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r24790 r24884 1734 1734 1735 1735 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1736 if (isnan(stats->robustMedian)) { 1737 stats->fittedStdev = NAN; 1738 stats->fittedStdev = NAN; 1739 return true; 1740 } 1736 if (isnan(stats->robustMedian)) goto escape; 1741 1737 1742 1738 float guessStdev = stats->robustStdev; // pass the guess sigma … … 1770 1766 COUNT_WARNING(10, 100, "Failed to calculate the min/max of the input vector.\n"); 1771 1767 psFree(statsMinMax); 1772 stats->fittedStdev = NAN; 1773 stats->fittedStdev = NAN; 1768 goto escape; 1769 } 1770 1771 // If all data points have the same value, then we set the appropriate members of stats and return. 1772 if (fabs(max - min) <= FLT_EPSILON) { 1773 COUNT_WARNING(10, 100, "All data points have the same value: %f.\n", min); 1774 stats->fittedMean = min; 1775 stats->fittedStdev = 0.0; 1776 stats->results |= PS_STAT_FITTED_MEAN_V4; 1777 stats->results |= PS_STAT_FITTED_STDEV_V4; 1774 1778 return true; 1775 1779 } … … 1789 1793 psFree(histogram); 1790 1794 psFree(statsMinMax); 1791 stats->fittedStdev = NAN; 1792 stats->fittedStdev = NAN; 1793 return true; 1795 goto escape; 1794 1796 } 1795 1797 if (psTraceGetLevel("psLib.math") >= 8) { … … 1823 1825 COUNT_WARNING(10, 100, "Failed to calculate the min/max of the input vector.\n"); 1824 1826 psFree(statsMinMax); 1825 stats->fittedStdev = NAN; 1826 stats->fittedStdev = NAN; 1827 return true; 1827 goto escape; 1828 1828 } 1829 1829 … … 1898 1898 psFree(histogram); 1899 1899 psFree(statsMinMax); 1900 stats->fittedStdev = NAN; 1901 stats->fittedStdev = NAN; 1902 return true; 1900 goto escape; 1903 1901 } 1904 1902 … … 1919 1917 1920 1918 COUNT_WARNING(10, 100, "fit did not converge\n"); 1921 stats->fittedStdev = NAN; 1922 stats->fittedStdev = NAN; 1923 return true; 1919 goto escape; 1924 1920 } 1925 1921 … … 1991 1987 psFree(histogram); 1992 1988 psFree(statsMinMax); 1993 stats->fittedStdev = NAN; 1994 stats->fittedStdev = NAN; 1995 return true; 1989 goto escape; 1996 1990 } 1997 1991 … … 2038 2032 psTrace(TRACE, 6, "The fitted stdev is %f.\n", stats->fittedStdev); 2039 2033 2034 stats->results |= PS_STAT_FITTED_MEAN_V4; 2035 stats->results |= PS_STAT_FITTED_STDEV_V4; 2036 2037 return true; 2038 2039 escape: 2040 stats->fittedMean = NAN; 2041 stats->fittedStdev = NAN; 2040 2042 stats->results |= PS_STAT_FITTED_MEAN_V4; 2041 2043 stats->results |= PS_STAT_FITTED_STDEV_V4;
Note:
See TracChangeset
for help on using the changeset viewer.
