Changeset 1407 for trunk/psLib/src/math/psStats.h
- Timestamp:
- Aug 6, 2004, 2:06:06 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.h
r1406 r1407 1 1 2 /** @file psStats.h 2 3 * \brief basic statistical operations … … 9 10 * @author George Gusciora, MHPCC 10 11 * 11 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-08-0 6 22:34:05$12 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-07 00:06:06 $ 13 14 * 14 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 16 */ 16 17 #if !defined(PS_STATS_H) 17 # define PS_STATS_H18 # define PS_STATS_H 18 19 19 # include "psVector.h"20 # include "psVector.h" 20 21 21 22 /// @addtogroup Stats … … 26 27 *****************************************************************************/ 27 28 typedef enum { 28 PS_STAT_SAMPLE_MEAN = 0x000001,29 PS_STAT_SAMPLE_MEDIAN = 0x000002,30 PS_STAT_SAMPLE_STDEV = 0x000004,31 PS_STAT_SAMPLE_QUARTILE = 0x000008,32 PS_STAT_ROBUST_MEAN = 0x000010,33 PS_STAT_ROBUST_MEDIAN = 0x000020,34 PS_STAT_ROBUST_MODE = 0x000040,35 PS_STAT_ROBUST_STDEV = 0x000080,36 PS_STAT_ROBUST_QUARTILE = 0x000100,37 PS_STAT_CLIPPED_MEAN = 0x000200,38 PS_STAT_CLIPPED_STDEV = 0x000400,39 PS_STAT_MAX = 0x000800,40 PS_STAT_MIN = 0x001000,41 PS_STAT_USE_RANGE = 0x002000,42 PS_STAT_USE_BINSIZE = 0x004000,43 PS_STAT_ROBUST_FOR_SAMPLE = 0x00800029 PS_STAT_SAMPLE_MEAN = 0x000001, 30 PS_STAT_SAMPLE_MEDIAN = 0x000002, 31 PS_STAT_SAMPLE_STDEV = 0x000004, 32 PS_STAT_SAMPLE_QUARTILE = 0x000008, 33 PS_STAT_ROBUST_MEAN = 0x000010, 34 PS_STAT_ROBUST_MEDIAN = 0x000020, 35 PS_STAT_ROBUST_MODE = 0x000040, 36 PS_STAT_ROBUST_STDEV = 0x000080, 37 PS_STAT_ROBUST_QUARTILE = 0x000100, 38 PS_STAT_CLIPPED_MEAN = 0x000200, 39 PS_STAT_CLIPPED_STDEV = 0x000400, 40 PS_STAT_MAX = 0x000800, 41 PS_STAT_MIN = 0x001000, 42 PS_STAT_USE_RANGE = 0x002000, 43 PS_STAT_USE_BINSIZE = 0x004000, 44 PS_STAT_ROBUST_FOR_SAMPLE = 0x008000 44 45 } psStatsOptions; 45 46 46 47 47 /** This is the generic statistics structure. It contails the data members … … 50 50 typedef struct 51 51 { 52 double sampleMean; // /< formal mean of sample53 double sampleMedian; // /< formal median of sample54 double sampleStdev; // /< standard deviation of sample55 double sampleUQ; // /< upper quartile of sample56 double sampleLQ; // /< lower quartile of sample57 double sampleLimit; // /<58 double robustMean; // /< robust mean of array59 double robustMedian; // /< robust median of array60 double robustMode; // /< Robust mode of array61 double robustStdev; // /< robust standard deviation of array62 double robustUQ; // /< robust upper quartile63 double robustLQ; // /< robust lower quartile52 double sampleMean; // /< formal mean of sample 53 double sampleMedian; // /< formal median of sample 54 double sampleStdev; // /< standard deviation of sample 55 double sampleUQ; // /< upper quartile of sample 56 double sampleLQ; // /< lower quartile of sample 57 double sampleLimit; // /< 58 double robustMean; // /< robust mean of array 59 double robustMedian; // /< robust median of array 60 double robustMode; // /< Robust mode of array 61 double robustStdev; // /< robust standard deviation of array 62 double robustUQ; // /< robust upper quartile 63 double robustLQ; // /< robust lower quartile 64 64 double XXX; 65 double robustN50; // /<66 double robustNfit; // /<67 double clippedMean; // /< Nsigma clipped mean68 double clippedStdev; // /< standard deviation after clipping69 double clipSigma; // /< Nsigma used for clipping; user input70 int clipIter; ///< Number of clipping iterations; user input71 double min; // /< minimum data value in array72 double max; // /< maximum data value in array73 double binsize; // /<74 psStatsOptions options; // /< bitmask of calculated values65 double robustN50; // /< 66 double robustNfit; // /< 67 double clippedMean; // /< Nsigma clipped mean 68 double clippedStdev; // /< standard deviation after clipping 69 double clipSigma; // /< Nsigma used for clipping; user input 70 int clipIter; // /< Number of clipping iterations; user input 71 double min; // /< minimum data value in array 72 double max; // /< maximum data value in array 73 double binsize; // /< 74 psStatsOptions options; // /< bitmask of calculated values 75 75 } 76 76 psStats; 77 77 78 79 78 /** Do Statistics on an array. Returns a status value. \ingroup MathGroup */ 80 psStats * 81 psVectorStats(psStats *stats, ///< stats structure defines stats to be calculated and how 82 psVector *in, ///< Vector to be analysed: must be F32 83 psVector *mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL 84 unsigned int maskVal ///< Only mask elements with one of these bits set in maskVector 85 ); 79 psStats *psVectorStats(psStats * stats, // /< stats structure defines stats to be calculated and how 80 psVector * in, // /< Vector to be analysed: must be F32 81 psVector * mask, // /< Ignore elements where (maskVector & maskVal) != 0: must be INT 82 // or NULL 83 unsigned int maskVal // /< Only mask elements with one of these bits set in 84 // maskVector 85 ); 86 86 87 87 /** A constructor for the stats structure.*/ 88 psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure88 psStats *psStatsAlloc(psStatsOptions options); // /< Statistics to measure 89 89 90 90 /****************************************************************************** 91 91 Histogram functions and data structures. 92 92 *****************************************************************************/ 93 93 94 /** The basic histogram structure which contains bounds and bins. */ 94 95 typedef struct 95 96 { 96 psVector *bounds; ///< Bounds for the bins (type F32)97 psVector *nums; ///< Number in each of the bins (INT)98 int minNum; ///< Number below the minimum99 int maxNum; ///< Number above the maximum100 bool uniform; ///< Is it a uniform distribution?97 psVector *bounds; // /< Bounds for the bins (type F32) 98 psVector *nums; // /< Number in each of the bins (INT) 99 int minNum; // /< Number below the minimum 100 int maxNum; // /< Number above the maximum 101 bool uniform; // /< Is it a uniform distribution? 101 102 } 102 103 psHistogram; 103 104 104 105 105 /** Constructor \ingroup MathGroup */ 106 psHistogram * 107 psHistogramAlloc(float lower, ///< Lower limit for the bins 108 float upper, ///< Upper limit for the bins 109 int n); ///< Number of bins 110 106 psHistogram *psHistogramAlloc(float lower, // /< Lower limit for the bins 107 float upper, // /< Upper limit for the bins 108 int n); // /< Number of bins 111 109 112 110 /** Generic constructor \ingroup MathGroup */ 113 psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins111 psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds); // /< Bounds for the bins 114 112 115 113 /** Calculate a histogram \ingroup MathGroup **/ 116 psHistogram *psVectorHistogram (psHistogram *out, ///< Histogram data117 const psVector *restrict in, ///< Vector to analyse118 const psVector *restrict mask, ///< Mask dat for input vector119 unsigned int maskVal); ///< Mask value114 psHistogram *psVectorHistogram(psHistogram * out, // /< Histogram data 115 const psVector * restrict in, // /< Vector to analyse 116 const psVector * restrict mask, // /< Mask dat for input vector 117 unsigned int maskVal); // /< Mask value 120 118 121 bool p_psGetStatValue( 122 const psStats* stats, 123 double* value 124 ); 119 bool p_psGetStatValue(const psStats * stats, double *value); 125 120 126 121 /// @} 127 122 128 123 #endif 129
Note:
See TracChangeset
for help on using the changeset viewer.
