Changeset 13494 for trunk/psLib/src/math/psStats.c
- Timestamp:
- May 23, 2007, 4:06:51 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r13418 r13494 13 13 * use ->min and ->max (PS_STAT_USE_RANGE) 14 14 * 15 * @version $Revision: 1.21 0$ $Name: not supported by cvs2svn $16 * @date $Date: 2007-05- 18 13:19:55$15 * @version $Revision: 1.211 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2007-05-24 02:06:51 $ 17 17 * 18 18 * Copyright 2006 IfA, University of Hawaii … … 259 259 for (long i = 0; i < num; i++) { 260 260 // Check if the data is with the specified range 261 if (!isfinite(vector[i])) {262 stats->max = stats->min = NAN;263 psError(PS_ERR_IEEE, true, "Element %ld of vector is Inf/NaN", i);264 return 0;265 }266 261 if (!isfinite(vector[i])) { 262 stats->max = stats->min = NAN; 263 psError(PS_ERR_IEEE, true, "Element %ld of vector is Inf/NaN", i); 264 return 0; 265 } 266 267 267 if (useRange && (vector[i] < stats->min)) 268 268 continue; … … 688 688 } 689 689 psTrace(TRACE, 6, "Data min/max is (%.2f, %.2f)\n", min, max); 690 assert (iterate < 20);690 assert (iterate < 20); 691 691 // fprintf (stderr, "%d @ %d : %f - %f\n", iterate, numValid, min, max); 692 692 … … 1661 1661 1662 1662 // We keep statsFree so that we can identify statistics pointers from the memblock 1663 static void statsFree(psStats * newStruct)1663 static void statsFree(psStats *stats) 1664 1664 { 1665 1665 // There are non dynamic allocated items 1666 return; 1666 1667 } 1667 1668 … … 1669 1670 psStatsAlloc(): This routine must create a new psStats data structure. 1670 1671 *****************************************************************************/ 1671 psStats* p sStatsAlloc(psStatsOptions options)1672 psStats* p_psStatsAlloc(const char *file, unsigned int lineno, const char *func, psStatsOptions options) 1672 1673 { 1673 1674 psTrace(TRACE, 3,"---- %s() begin ----\n", __func__); 1674 psStats* newStruct = NULL; 1675 1676 newStruct = (psStats* ) psAlloc(sizeof(psStats)); 1677 psMemSetDeallocator(newStruct, (psFreeFunc)statsFree); 1678 newStruct->sampleMean = NAN; 1679 newStruct->sampleMedian = NAN; 1680 newStruct->sampleStdev = NAN; 1681 newStruct->sampleUQ = NAN; 1682 newStruct->sampleLQ = NAN; 1683 newStruct->robustMedian = NAN; 1684 newStruct->robustStdev = NAN; 1685 newStruct->robustUQ = NAN; 1686 newStruct->robustLQ = NAN; 1687 newStruct->robustN50 = -1; 1688 newStruct->fittedMean = NAN; 1689 newStruct->fittedStdev = NAN; 1690 newStruct->fittedNfit = -1; 1691 newStruct->clippedMean = NAN; 1692 newStruct->clippedStdev = NAN; 1693 newStruct->clippedNvalues = -1; // XXX: This is never used 1694 newStruct->clipSigma = 3.0; 1695 newStruct->clipIter = 3; 1696 newStruct->min = NAN; 1697 newStruct->max = NAN; 1698 newStruct->binsize = NAN; 1699 newStruct->nSubsample = 100000; 1700 newStruct->options = options; 1675 1676 psStats *stats = p_psAlloc(file, lineno, func, sizeof(psStats)); 1677 psMemSetDeallocator(stats, (psFreeFunc)statsFree); 1678 stats->sampleMean = NAN; 1679 stats->sampleMedian = NAN; 1680 stats->sampleStdev = NAN; 1681 stats->sampleUQ = NAN; 1682 stats->sampleLQ = NAN; 1683 stats->robustMedian = NAN; 1684 stats->robustStdev = NAN; 1685 stats->robustUQ = NAN; 1686 stats->robustLQ = NAN; 1687 stats->robustN50 = -1; 1688 stats->fittedMean = NAN; 1689 stats->fittedStdev = NAN; 1690 stats->fittedNfit = -1; 1691 stats->clippedMean = NAN; 1692 stats->clippedStdev = NAN; 1693 stats->clippedNvalues = -1; // XXX: This is never used 1694 stats->clipSigma = 3.0; 1695 stats->clipIter = 3; 1696 stats->min = NAN; 1697 stats->max = NAN; 1698 stats->binsize = NAN; 1699 stats->nSubsample = 100000; 1700 stats->options = options; 1701 1701 1702 1702 psTrace(TRACE, 3, "---- %s() end ----\n", __func__); 1703 return (newStruct);1703 return stats; 1704 1704 } 1705 1705
Note:
See TracChangeset
for help on using the changeset viewer.
