Changeset 13494
- Timestamp:
- May 23, 2007, 4:06:51 PM (19 years ago)
- Location:
- trunk/psLib/src/math
- Files:
-
- 2 edited
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 -
trunk/psLib/src/math/psStats.h
r11248 r13494 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 1-23 22:47:23$10 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-05-24 02:06:51 $ 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 13 13 */ … … 99 99 * value given. 100 100 */ 101 #ifdef DOXYGEN 101 102 psStats* psStatsAlloc( 102 psStatsOptions options ///< Statistics to calculate103 psStatsOptions options ///< Statistics to calculate 103 104 ); 104 105 #else // ifdef DOXYGEN 106 psStats* p_psStatsAlloc( 107 const char *file, ///< File of caller 108 unsigned int lineno, ///< Line number of caller 109 const char *func, ///< Function name of caller 110 psStatsOptions options ///< Statistics to calculate 111 ); 112 #define psStatsAlloc(options) \ 113 p_psStatsAlloc(__FILE__, __LINE__, __func__, options) 114 #endif // ifdef DOXYGEN 105 115 106 116 /** Checks the type of a particular pointer. … … 138 148 (none) 139 149 * vectorSampleMedian (also yields SAMPLE_QUARTILE) 140 (none) 150 (none) 141 151 * vectorSampleStdev 142 152 (vectorSampleMean) … … 149 159 * vectorFittedStats 150 160 (vectorRobustStats) 151 161 152 162 * private stats functions called by other private stats functions are automatically called by 153 163 * those functions. since they set the stats->results flags, they are not called multiple 154 164 * times. 155 165 156 166 * the private stats functions do not test for their corresponding stats flags: it is not 157 167 * necessary to request them if they are called within this function. 158 168 159 169 */
Note:
See TracChangeset
for help on using the changeset viewer.
