histo/0040777000104000010010000000000007543240634012664 5ustar AdministratorsNonehisto/include/0040777000104000010010000000000007661067763014322 5ustar AdministratorsNonehisto/include/dbl_sort.h0100666000104000010010000000053007540001771016255 0ustar AdministratorsNone #ifndef _DBL_SORT_H_ #define _DBL_SORT_H_ #include "generic_sort.h" class dbl_sort : public generic_sort { protected: int compare( double a, double b) { int rslt = 0; if (a < b) rslt = -1; else if (a > b) rslt = 1; return rslt; } // compare }; // dbl_sort #endif histo/include/generic_sort.h0100666000104000010010000000755407540004350017141 0ustar AdministratorsNone #ifndef _GENERIC_SORT_H_ #define _GENERIC_SORT_H_ /** An abstract generic sort class This is an abstract class. The class that is derived from this class must define the compare function. The compare function returns an integer value that is less than, equal or greater than zero depending on the result of the comparision (the function is modeled after UNIX strcmp). This class is based on the Java quicksort algorithm by James Gosling at at Sun Microsystems (see below).

QSortAlgorithm.java 1.3 29 Feb 1996 James Gosling

Copyright (c) 1994-1996 Sun Microsystems, Inc. All Rights Reserved.

Permission to use, copy, modify, and distribute this software and its documentation for NON-COMMERCIAL or COMMERCIAL purposes and without fee is hereby granted.

Please refer to the file http://www.javasoft.com/copy_trademarks.html for further important copyright and trademark information and to http://www.javasoft.com/licensing.html for further important licensing information for the Java (tm) Technology.

*/ template class generic_sort { private: /** Exchange element a[i] and a[j] */ void swap(T *a, int i, int j) { T t; t = a[i]; a[i] = a[j]; a[j] = t; } // swap /** This is a generic version of C.A.R Hoare's Quick Sort * algorithm. This will handle arrays that are already * sorted, and arrays with duplicate keys.
* * If you think of a one dimensional array as going from * the lowest index on the left to the highest index on the right * then the parameters to this function are lowest index or * left and highest index or right. The first time you call * this function it will be with the parameters 0, a.length - 1. * * @param a an integer array * @param lo0 left boundary of array partition * @param hi0 right boundary of array partition */ void QuickSort(T *a, int lo0, int hi0) { int lo = lo0; int hi = hi0; T mid; if ( hi0 > lo0) { /* Arbitrarily establishing partition element as the midpoint of * the array. */ mid = a[ ( lo0 + hi0 ) / 2 ]; // loop through the array until indices cross while( lo <= hi ) { /* find the first element that is greater than or equal to * the partition element starting from the left Index. */ while( ( lo < hi0 ) && ( compare(a[lo], mid) < 0 ) ) ++lo; /* find an element that is smaller than or equal to * the partition element starting from the right Index. */ while( ( hi > lo0 ) && ( compare(a[hi], mid) > 0) ) --hi; // if the indexes have not crossed, swap if( lo <= hi ) { swap(a, lo, hi); ++lo; --hi; } } // while /* If the right index has not reached the left side of array * must now sort the left partition. */ if( lo0 < hi ) QuickSort( a, lo0, hi ); /* If the left index has not reached the right side of array * must now sort the right partition. */ if( lo < hi0 ) QuickSort( a, lo, hi0 ); } } // QuickSort protected: /** This is an abstract function that should be defined by the class derived from generic_sort. This function is passed two objects, a and b. It compares them and should return the following values:
    If (a == b) return 0
    if (a < b) return -1
    if (a > b) return 1
*/ virtual int compare( T a, T b) = 0; private: generic_sort( const generic_sort &rhs ); public: generic_sort() {} ~generic_sort() {} void sort(T *a, size_t N) { QuickSort(a, 0, N-1); } // sort }; // generic_sort #endif histo/include/histogram.h0100777000076400010010000001135107661067763016322 0ustar AdministratorNone #ifndef _HISTOGRAM_H_ #define _HISTOGRAM_H_ #include /** Support for calculating histograms. The histogram class constructor is initialized with the number of bins to be used in the histogram. Each bin is a histo_bin object which contains information on the start and end value of the bin range and the frequency in the bin. The frequency is the number of values in the data set which are greater than or equal to start and less than end. Example: Given an array of 20 double values, calculate the histogram. The data does not need to be in sorted order. The histogram calculation will sort it. A vector of histo_bin objects is allocated by the histogram::bin_vec class constructor. The data, number of elements in the data set and the vector of histogram bins is passed to the histogram calculate function. This will initialize each of the histogram bins with a start, end and frequency.
    const size_t num_bins = 20;
    histogram::bin_vec binz( num_bins );
    histogram histo;

    histo.calculate( data, N, binz );

    for (size_t i = 0; i < num_bins; i++) {
      size_t freq = static_cast( binz[i] );
      printf("%7.4f %2d\\n", binz.start(i), freq );
    }
Note that binz[i] returns the frequency as a double, which is cast to a size_t value. */ class histogram { private: // copy constructor histogram( const histogram &rhs ); class bin_vec; void init_bins( bin_vec &bins, const double min, const double max ); /** Get values from a double array. */ class value_pool { private: size_t ix_; const double *vec_; const size_t N_; public: value_pool( const double *vec, size_t N ) : vec_( vec ), N_( N ) { ix_ = 0; } bool get_val( double &val ) { bool rslt = false; val = 0.0; if (ix_ < N_) { rslt = true; val = vec_[ ix_ ]; ix_++; } return rslt; } // get_val }; // value_pool public: /** A histogram bin In a standard histogram a bin always contains a positive integer frequency (a.k.a. count of elements). This histogram bin object is designed to be operated on a floating point wavelet transform. So the frequency element is a double. */ class histo_bin { private: /** number of values, v, such that start <= v < end */ double frequency_; /** start of bin value range */ double start_; /** end of bin value range */ double end_; public: histo_bin() {} ~histo_bin() {} double frequency() { return frequency_; } void frequency( const double f ) { frequency_ = f; } double &freqPtr() { return frequency_; } double start() { return start_; } void start( const double s ) { start_ = s; } double end() { return end_; } void end( const double e ) { end_ = e; } }; // class histo_bin /** An array of histogram bins. This class overloads the array index operator []. For an instance of bin_vec named binz, binz[i] will return the frequency value at index i. The class constructor is passed a value for the number of bin_vec elements. It dynamically allocates an internal array. The class destructor deallocates the internal array. The start and end values for a given bin are referenced via the start and end functions. */ class bin_vec { private: bin_vec( const bin_vec &rhs ); const size_t num_bins; histo_bin *bins; public: bin_vec( size_t N ) : num_bins( N ) { bins = new histo_bin[ num_bins ]; } ~bin_vec() { delete [] bins; } size_t length() { return num_bins; } double start( const size_t i ) { assert( i < num_bins ); return bins[i].start(); } void start( const size_t i, const double val ) { assert( i < num_bins ); bins[i].start( val ); } double end( const size_t i ) { assert( i < num_bins ); return bins[i].end(); } void end( const size_t i, const double val ) { assert( i < num_bins ); bins[i].end( val ); } /** LHS [] operator */ double &operator[]( const size_t i ) { assert( i < num_bins ); return bins[i].freqPtr(); } /** RHS [] operator */ double operator[]( const size_t i ) const { assert( i < num_bins ); return bins[i].frequency(); } }; // class bin_vec public: histogram() {} ~histogram() {} void calculate( const double *raw_data, const size_t N, bin_vec &binz ); }; // histogram #endif histo/include/histogram.h~0100777000076400010010000001135007635211611016477 0ustar AdministratorNone #ifndef _HISTOGRAM_H_ #define _HISTOGRAM_H_ #include /** Support for calculating histograms. The histogram class constructor is initialized with the number of bins to be used in the histogram. Each bin is a histo_bin object which contains information on the start and end value of the bin range and the frequency in the bin. The frequency is the number of values in the data set which are greater than or equal to start and less than end. Example: Given an array of 20 double values, calculate the histogram. The data does not need to be in sorted order. The histogram calculation will sort it. A vector of histo_bin objects is allocated by the histogram::bin_vec class constructor. The data, number of elements in the data set and the vector of histogram bins is passed to the histogram calculate function. This will initialize each of the histogram bins with a start, end and frequency.
    const size_t num_bins = 20;
    histogram::bin_vec binz( num_bins );
    histogram histo;

    histo.calculate( data, N, binz );

    for (size_t i = 0; i < num_bins; i++) {
      size_t freq = static_cast( binz[i] );
      printf("%7.4f %2d\n", binz.start(i), freq );
    }
Note that binz[i] returns the frequency as a double, which is cast to a size_t value. */ class histogram { private: // copy constructor histogram( const histogram &rhs ); class bin_vec; void init_bins( bin_vec &bins, const double min, const double max ); /** Get values from a double array. */ class value_pool { private: size_t ix_; const double *vec_; const size_t N_; public: value_pool( const double *vec, size_t N ) : vec_( vec ), N_( N ) { ix_ = 0; } bool get_val( double &val ) { bool rslt = false; val = 0.0; if (ix_ < N_) { rslt = true; val = vec_[ ix_ ]; ix_++; } return rslt; } // get_val }; // value_pool public: /** A histogram bin In a standard histogram a bin always contains a positive integer frequency (a.k.a. count of elements). This histogram bin object is designed to be operated on a floating point wavelet transform. So the frequency element is a double. */ class histo_bin { private: /** number of values, v, such that start <= v < end */ double frequency_; /** start of bin value range */ double start_; /** end of bin value range */ double end_; public: histo_bin() {} ~histo_bin() {} double frequency() { return frequency_; } void frequency( const double f ) { frequency_ = f; } double &freqPtr() { return frequency_; } double start() { return start_; } void start( const double s ) { start_ = s; } double end() { return end_; } void end( const double e ) { end_ = e; } }; // class histo_bin /** An array of histogram bins. This class overloads the array index operator []. For an instance of bin_vec named binz, binz[i] will return the frequency value at index i. The class constructor is passed a value for the number of bin_vec elements. It dynamically allocates an internal array. The class destructor deallocates the internal array. The start and end values for a given bin are referenced via the start and end functions. */ class bin_vec { private: bin_vec( const bin_vec &rhs ); const size_t num_bins; histo_bin *bins; public: bin_vec( size_t N ) : num_bins( N ) { bins = new histo_bin[ num_bins ]; } ~bin_vec() { delete [] bins; } size_t length() { return num_bins; } double start( const size_t i ) { assert( i < num_bins ); return bins[i].start(); } void start( const size_t i, const double val ) { assert( i < num_bins ); bins[i].start( val ); } double end( const size_t i ) { assert( i < num_bins ); return bins[i].end(); } void end( const size_t i, const double val ) { assert( i < num_bins ); bins[i].end( val ); } /** LHS [] operator */ double &operator[]( const size_t i ) { assert( i < num_bins ); return bins[i].freqPtr(); } /** RHS [] operator */ double operator[]( const size_t i ) const { assert( i < num_bins ); return bins[i].frequency(); } }; // class bin_vec public: histogram() {} ~histogram() {} void calculate( const double *raw_data, const size_t N, bin_vec &binz ); }; // histogram #endif histo/include/wavethresh.h0100666000104000010010000001116607543240616016642 0ustar AdministratorsNone #ifndef _WAVETHRESH_H_ #define _WAVETHRESH_H_ #include #include /** Support for wavelet coefficient thresholding. In wavelet coefficient thresholding a selected set of the wavelet coefficients that result from the wavelet transform are modified. The algorithm used here uses the "Universal Threshold" that Donoho and Johnstone have discussed in their papers. Thresholds and the "Universal Threshold" are also discussed in Noise Reduction by Wavelet Thresholding by Jansen, Springer Verlag, 2001. The "Universal Threshold is:
     UnivThresh = sqrt( 2 * log( N ) ) * stdDev
  
Here stdDev is the standard deviation of N wavelet coefficients. Log is the natural log. Thresholding is used to remove noise. Another way to state this is that the signal is smoothed. This code uses "soft thresholding" where a wavelet coefficient that is less than the threshold is set to zero and a coefficient whose absolute value is greater than the threshold is moved toward zero by the threshold amount. This class provides globally accessible static functions. It is not meant to be declared as an object and has no state. */ template class wavethresh { private: wavethresh( const wavethresh &rhs ); wavethresh() {} ~wavethresh() {} public: /** A container for the mean and standard deviation */ class bellInfo { private: double mean_; double stdDev_; public: bellInfo() { mean_ = 0.0; stdDev_ = 0.0; } ~bellInfo() {} bellInfo( const bellInfo &rhs ) { mean_ = rhs.mean_; stdDev_ = rhs.stdDev_; } void mean( const double m ) { mean_ = m; } double mean() { return mean_; } void stdDev( const double s ) { stdDev_ = s; } double stdDev() { return stdDev_; } }; // bellInfo /** Calculate teh mean and standard deviation for the section of vec from start to (start+size)-1. \param vec An object or array where the [] operator returns a double. \param start the index of the first element in the data section \param size the size of the data section \param stats The result (mean and standard deviation) is returned in this argument. */ static void bellStats(const T &vec, const size_t start, const size_t size, bellInfo &stats ) { stats.mean( 0.0 ); stats.stdDev( 0.0 ); int i; // calculate the mean (a.k.a average) double sum = 0.0; for (i = start; i < start + size; i++) { sum = sum + vec[i]; } double mean = sum / static_cast(size); // calculate the standard deviation sum double stdDevSum = 0; double x; for (i = start; i < start + size; i++) { x = vec[i] - mean; stdDevSum = stdDevSum + (x * x); } double variance = stdDevSum / static_cast(size-1); double stdDev = sqrt( variance ); stats.mean( mean ); stats.stdDev( stdDev ); } // bellStats static double soft_thresh( const double val, const double tau ) { double sign = 1.0; double absval = fabs( val ); if (val < 0) sign = -1.0; double new_val; if (absval < tau) { new_val = 0.0; } else { new_val = sign * (absval - tau); } return new_val; } /** Calculate a wavelet threshold and apply it to the wavelet coefficients using soft thresholding. */ static void thresh(T &vec, const size_t start, const size_t size ) { bellInfo info; bellStats( vec, start, size, info ); double stdDev = info.stdDev(); double Tau = sqrt( 2 * log( size ) ) * stdDev; size_t i; for (i = start; i < start + size; i++) { vec[ i ] = soft_thresh( vec[i], Tau ); } } // thresh /** Print the mean and standard deviation for the wavelet coefficient bands whose length is greater than 32. \param vec An object or array where the [] operator returns a double \param N the number of data elements (doubles) in vec */ static void printHarmonicStdDev( const T &vec, const size_t N) { const size_t minSize = 32; size_t band = N / 2; bellInfo stats; while (band >= minSize ) { bellStats( vec, band, band, stats ); printf("coefficient band %3d: mean = %7.6f, stddev = %7.6f\n", band, stats.mean(), stats.stdDev() ); band = band / 2; } // while } // printHarmonicStdDev }; // wavethresh #endif histo/Makefile0100666000104000010010000000157607542502534014331 0ustar AdministratorsNone DEBUG = -Zi BROWSE = CFLAGS = $(BROWSE) $(DEBUG) -DWIN32 -Tp OBJ = obj EXE = .exe DOXYPATH = e:\doxygen\bin SYSINC = "d:\Program Files\Microsoft Visual Studio\Vc98\Include" INCLUDE = -I"include" -I"..\include" -I"..\data\include" -I$(SYSINC) SIGOBJ = yahooTS.$(OBJ) histogram.$(OBJ) ALL: wavehist wavehist: wavehist$(EXE) clean: rm -f *.obj *.pdb *.sbr *.ilk *.exe rm -f include/*~ rm -f src/*~ doxygen: $(DOXYPATH)\doxygen doxygenDocConfig wavehist$(EXE): $(SIGOBJ) wavehist.$(OBJ) $(CC) $(SIGOBJ) wavehist.$(OBJ) $(DEBUG) -GX -o wavehist$(EXE) wavehist.$(OBJ): src\$*.cpp $(CC) -c -GX $(INCLUDE) $(CFLAGS) src\$*.cpp histogram.$(OBJ): src\$*.cpp include\$*.h $(CC) -c -GX $(INCLUDE) $(CFLAGS) src\$*.cpp yahooTS.$(OBJ): ..\data\src\$*.cpp ..\data\include\$*.h $(CC) -c $(INCLUDE) $(CFLAGS) ..\data\src\$*.cpphisto/src/0040777000104000010010000000000007635211703013450 5ustar AdministratorsNonehisto/src/histogram.cpp0100777000076400010010000000437007635212120016000 0ustar AdministratorNone #include #include "dbl_sort.h" #include "histogram.h" /** Initialize the histogram bin array */ void histogram::init_bins( bin_vec &bins, const double min, const double max ) { size_t num_bins = bins.length(); double range = max - min; double bin_size = range / static_cast( num_bins ); double start = min; double end = min + bin_size; for (size_t i = 0; i < num_bins; i++) { bins[i] = 0; // initialize frequency to zero bins.start(i, start ); // initialize the i'th bin start value bins.end(i, end ); // initialize the i'th bin end value start = end; end = end + bin_size; } // The frequency in a bin is incremented if a value v is // in the range start <= v < end. This is fine until // we reach the last bin, which should also get values // which are in the range start <= v <= end. So add a // small amount to the end value to assure that the // end value of the last bin is beyond the value range. bins.end(num_bins-1, bins.end(num_bins-1) + (bin_size / 10.0) ); } // init_bins /** Calculate a histogram \param raw_data The raw data from which to calculate the histogram \param N The number of data values in raw_data \param bins An array of histo_bin objects \param num_bins The number of histogram bins (number of elements in histo_bin) */ void histogram::calculate( const double *raw_data, const size_t N, bin_vec &bins ) { double *sort_data = new double[ N ]; for (size_t i = 0; i < N; i++) { sort_data[i] = raw_data[i]; } dbl_sort s; s.sort( sort_data, N ); double min = sort_data[0]; double max = sort_data[N-1]; size_t num_bins = bins.length(); init_bins( bins, min, max ); value_pool pool( sort_data, N ); size_t bin_ix = 0; double val; bool more_values = pool.get_val( val ); double end = bins.end(bin_ix); while (bin_ix < num_bins && more_values) { if (val < end) { bins[bin_ix] = bins[bin_ix] + 1; // increment the frequency more_values = pool.get_val( val ); } else { bin_ix++; end = bins.end(bin_ix); } } // while delete [] sort_data; } // calculate histo/src/histogram.cpp~0100666000076400010010000000413407604701205016174 0ustar AdministratorNone #include #include "dbl_sort.h" #include "histogram.h" /** Initialize the histogram bin array */ void histogram::init_bins( bin_vec &bins, const double min, const double max ) { size_t num_bins = bins.length(); double range = max - min; double bin_size = range / static_cast( num_bins ); double start = min; double end = min + bin_size; for (size_t i = 0; i < num_bins; i++) { bins[i] = 0; // initialize frequency to zero bins.start(i, start ); // initialize the i'th bin start value bins.end(i, end ); // initialize the i'th bin end value start = end; end = end + bin_size; } // The frequency in a bin is incremented if a value v is // in the range start <= v < end. This is fine until // we reach the last bin, which should also get values // which are in the range start <= v <= end. So add a // small amount to the end value to assure that the // end value of the last bin is beyond the value range. bins.end(num_bins-1, bins.end(num_bins-1) + (bin_size / 10.0) ); } // init_bins /** Calculate a histogram \param raw_data The raw data from which to calculate the histogram \param N The number of data values in raw_data \param bins An array of histo_bin objects \param num_bins The number of histogram bins (number of elements in histo_bin) */ void histogram::calculate( double *raw_data, const size_t N, bin_vec &bins ) { dbl_sort s; s.sort( raw_data, N ); double min = raw_data[0]; double max = raw_data[N-1]; size_t num_bins = bins.length(); init_bins( bins, min, max ); value_pool pool( raw_data, N ); size_t bin_ix = 0; double val; bool more_values = pool.get_val( val ); double end = bins.end(bin_ix); while (bin_ix < num_bins && more_values) { if (val < end) { bins[bin_ix] = bins[bin_ix] + 1; // increment the frequency more_values = pool.get_val( val ); } else { bin_ix++; end = bins.end(bin_ix); } } // while } // calculate histo/src/histotest.cpp0100666000104000010010000000221207541221062016167 0ustar AdministratorsNone /** \file Test the histogram code */ #include #include "histogram.h" double data[] = {68.23, 69.40, 69.47, 69.75, 70.00, 70.00, 70.00, 70.59, 70.70, 70.71, 70.99, 71.00, 71.25, 71.39, 71.40, 71.45, 71.49, 71.60, 71.60, 71.74, 72.15, 72.19, 72.25, 72.41, 72.70, 72.70, 73.48, 73.62, 73.90, 74.09, 74.20, 75.20, 75.95, 76.77, 76.90, 77.40, 77.50, 77.75, 78.25, 78.80, 78.85, 79.65, 80.50, 80.71, 80.91, 80.95, 81.87, 82.00, 82.05, 82.25, 82.29, 82.80, 83.00, 83.11, 83.50, 83.75, 84.39, 84.65, 84.80, 85.00, 85.05, 85.46, 85.48, 86.00, 86.40, 86.49 }; int main() { const size_t N = sizeof( data ) / sizeof( double ); const size_t num_bins = 20; histogram::bin_vec binz( num_bins ); histogram histo; histo.calculate( data, N, binz ); for (size_t i = 0; i < num_bins; i++) { printf("%7.4f %2d\n", binz.start(i), binz[i] ); } return 0; } histo/src/sort_test.cpp0100666000104000010010000000112607540004434016173 0ustar AdministratorsNone #include #include "dbl_sort.h" double data[] = { 32.0, 10.0, 20.0, 38.0, 37.0, 28.0, 38.0, 34.0, 18.0, 24.0, 18.0, 9.0, 23.0, 24.0, 28.0, 34.0 }; /** Print out a vector of doubles, one per line */ void pr_vec( const double *v, const size_t N ) { for (size_t i = 0; i < N; i++) { printf("%7.4f\n", v[i] ); } } int main() { const size_t N = sizeof( data ) / sizeof( double ); dbl_sort s; printf("Before:\n"); pr_vec( data, N ); s.sort( data, N ); printf("After:\n"); pr_vec( data, N ); return 0; } histo/src/wavehist.cpp0100666000104000010010000000655007543236263016017 0ustar AdministratorsNone #include #include #include "haar.h" #include "line.h" #include "daub.h" #include "yahooTS.h" #include "dbl_sort.h" #include "histogram.h" #include "wavethresh.h" /** \file Test wavelet histogramming The documentation in this file is formatted for doxygen (see www.doxygen.org).

Copyright and Use

You may use this source code without limitation and without fee as long as you include:
This software was written and is copyrighted by Ian Kaplan, Bear Products International, www.bearcave.com, 2002.
This software is provided "as is", without any warranty or claim as to its usefulness. Anyone who uses this source code uses it at their own risk. Nor is any support provided by Ian Kaplan and Bear Products International. Please send any bug fixes or suggested source changes to:
     iank@bearcave.com
@author Ian Kaplan */ /** Print out a vector of doubles, one per line */ void pr_vec( const double *v, const size_t N ) { for (size_t i = 0; i < N; i++) { // printf("%7.4f, %3d\n", v[i], i ); printf("%7.6f\n", v[i] ); } } /** Get a 1-day return time series calculated from a stock price (for example, the open or close price). Here return is rett = (pt - pt-1) / pt Where p is the stock price and t is in trading days. This formula gives the fractional return on a daily basis. To calculate N return values, there must be N+1 stock price values. The function will return true if the return time series is calculated without problem, false otherwise. */ bool get1DayRetTimeSeries(const char *ticker, double *ret, const size_t N ) { bool rslt = true; yahooTS ts( "..\\data\\equities\\" ); size_t n = N+1; double *price = new double[ N+1 ]; // fetch N+1 close price values ts.getTS( ticker, price, n, yahooTS::Close ); if (n == N+1) { for (size_t i = 1; i < N+1; i++) { ret[i-1] = (price[i] - price[i-1])/price[i-1]; } } else { rslt = false; } delete [] price; return rslt; } // get1DayRetTimeSeries /** Return the absolute value of "val" */ double abs( const double val ) { double new_val = val; if (val < 0) new_val = -val; return val; } // abs int main() { const size_t N = 512; double ret[ N ]; if (get1DayRetTimeSeries( "ibm", ret, N )) { const size_t num_binz = N; histogram::bin_vec binz( num_binz ); histogram histo; size_t i; histo.calculate( ret, N, binz ); // Normalized haar wavelet // haar w; // Daubechies D4 wavelet // Daubechies w; // Unnormalized Linear interpolation wavelet line w; w.forwardTrans( binz, N ); const size_t start = 16; const size_t size = N - start; wavethresh::thresh( binz, start, size ); w.inverseTrans( binz, N ); // convert frequency to probability for (i = 0; i < num_binz; i++) { binz[i] = binz[i] / static_cast( N ); } for (i = 0; i < num_binz; i++) { printf("%7.4f %7.4f\n", binz.start(i), binz[i] ); } } return 0; } stat/0040777000104000010010000000000007663050207012507 5ustar AdministratorsNonestat/doxygenDocConfig0100666000076400010010000010002407663046230015507 0ustar AdministratorNone# Doxyfile 1.2.8.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "Basic Statistics Functions" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, # German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, # Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish. OUTPUT_LANGUAGE = English # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these class will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = YES # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. It is allowed to use relative paths in the argument list. STRIP_FROM_PATH = # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a class diagram (in Html and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. CLASS_DIAGRAMS = YES # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = YES # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower case letters. If set to YES upper case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # users are adviced to set this option to NO. CASE_SENSE_NAMES = YES # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explict @brief command for a brief description. JAVADOC_AUTOBRIEF = YES # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # reimplements. INHERIT_DOCS = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consist of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. # For instance some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = MainPage src include . ../histo/include/generic_sort.h ../histo/include/dbl_sort.h ../histo/include/histogram.h ../histo/src/histogram.cpp # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. FILE_PATTERNS = *.h *.cpp # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. INPUT_FILTER = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse. FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = doc # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the Html help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript and frames is required (for instance Netscape 4.0+ # or Internet explorer 4.0+). GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimised for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assigments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = #--------------------------------------------------------------------------- # Configuration::addtions related to external references #--------------------------------------------------------------------------- # The TAGFILES tag can be used to specify one or more tagfiles. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermedate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::addtions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO # The CGI_NAME tag should be the name of the CGI script that # starts the search engine (doxysearch) with the correct parameters. # A script with this name will be generated by doxygen. CGI_NAME = # The CGI_URL tag should be the absolute URL to the directory where the # cgi binaries are located. See the documentation of your http daemon for # details. CGI_URL = # The DOC_URL tag should be the absolute URL to the directory where the # documentation is located. If left blank the absolute path to the # documentation, with file:// prepended to it, will be used. DOC_URL = # The DOC_ABSPATH tag should be the absolute path to the directory where the # documentation is located. If left blank the directory on the local machine # will be used. DOC_ABSPATH = # The BIN_ABSPATH tag must point to the directory where the doxysearch binary # is installed. BIN_ABSPATH = # The EXT_DOC_PATHS tag can be used to specify one or more paths to # documentation generated for other projects. This allows doxysearch to search # the documentation for these projects as well. EXT_DOC_PATHS = stat/include/0040777000104000010010000000000007663047326014142 5ustar AdministratorsNonestat/include/autocorr.h0100666000076400010010000000362507663045364016005 0ustar AdministratorNone #ifndef AUTOCORR_H #define AUTOCORR_H #include /** Calculate the autocorrelation function for a vector

Copyright and Use

You may use this source code without limitation and without fee as long as you include:

This software was written and is copyrighted by Ian Kaplan, Bear Products International, www.bearcave.com, 2001.

This software is provided "as is", without any warranty or claim as to its usefulness. Anyone who uses this source code uses it at their own risk. Nor is any support provided by Ian Kaplan and Bear Products International. Please send any bug fixes or suggested source changes to:
     iank@bearcave.com
*/ class autocorr { private: autocorr( const autocorr &rhs ); // Minimum correlation value const double limit_; // Total number of points to calculate const size_t numPoints_; public: /** A container for the autocorrelation function result. */ class acorrInfo { private: acorrInfo(const acorrInfo &rhs ); std::vector points_; /** slope of the autocorrelation line on a log/log plot */ double slope_; double slopeErr_; public: acorrInfo() { slope_ = 0; } ~acorrInfo() {} double slope() { return slope_; } void slope( double s ) { slope_ = s; } double slopeErr() { return slopeErr_; } void slopeErr( double sE ) { slopeErr_ = sE; } std::vector &points() { return points_; } }; // class acorrInfo private: void acorrSlope( acorrInfo &info ); public: autocorr( double lim = 0.01, size_t numPts = 32 ) : limit_(lim), numPoints_(numPts) {} ~autocorr() {} // Autocorrelation function void ACF( const double *v, const size_t N, acorrInfo &info ); }; // autocorr #endif stat/include/lregress.h0100666000076400010010000000653707663045377016006 0ustar AdministratorNone #ifndef LREGRESS_H_ #define LREGRESS_H_ #include /** Linear regression and related functions The lregress class packages the lr function, which calculates a linear regression line given paired vectors of X and Y points.

Copyright and Use

You may use this source code without limitation and without fee as long as you include:

This software was written and is copyrighted by Ian Kaplan, Bear Products International, www.bearcave.com, 2001.

This software is provided "as is", without any warranty or claim as to its usefulness. Anyone who uses this source code uses it at their own risk. Nor is any support provided by Ian Kaplan and Bear Products International. Please send any bug fixes or suggested source changes to:
     iank@bearcave.com
*/ class lregress { private: lregress( const lregress &rhs ); public: lregress() {} ~lregress() {} /** A container for an {x,y} point of type double. */ class point { private: double x_, y_; public: /** constructor */ point( double xVal, double yVal ) { x_ = xVal; y_ = yVal; } /** copy constructor */ point( const point &rhs ) { x_ = rhs.x_; y_ = rhs.y_; } /** destructor does nothing */ ~point() {}; double x() { return x_; } void x(const double v) { x_ = v; } double y() { return y_; } void y(const double v) { y_ = v; } }; // class point /** Line information. A container for linear regression information. A regression line, defined by the equation y' = a + bx, where a and b are constants. The constant a is the y intercept when x == 0. The constant b is the slope of the line. */ class lineInfo { private: /** the slope of the line (e.g., b in y' = a + bx) */ double slope_; /** the y-intercept (e.g., a, when x == 0 in y' = a + bx) */ double intercept_; /** standard deviation of the points around the line */ double stddev_; /** Regression error */ double slopeError_; /** correlation between the x points and the y points */ double cor_; public: /** constructor */ lineInfo() { slope_ = 0; intercept_ = 0; cor_ = 0; stddev_; slopeError_ = 0; } ~lineInfo() {} /** copy constructor */ lineInfo( const lineInfo &rhs ) { slope_ = rhs.slope_; intercept_ = rhs.intercept_; cor_ = rhs.cor_; stddev_ = rhs.stddev_; slopeError_ = rhs.slopeError_; } double slope() { return slope_; } void slope( double s ) { slope_ = s; } double intercept() { return intercept_; } void intercept( double a ) { intercept_ = a; } double stddev() { return stddev_; } void stddev( double s ) { stddev_ = s; } double corr() { return cor_; } void corr( double c ) { cor_ = c; } double slopeErr() { return slopeError_; } void slopeErr(double e) { slopeError_ = e; } }; // class lineInfo double meanX( std::vector &data ) const; double meanY( std::vector &data ) const; /** Calculate the linear regression on a set of N points, {Xi, Yi}. */ void lr( std::vector &data, lineInfo &info ) const; }; // lregress #endif stat/include/pdf.h0100666000076400010010000000173007663045755014717 0ustar AdministratorNone #ifndef PDF_H #define PDF_H #include "stddev.h" #include "histogram.h" /** Calculate the probability denisty function from a set of data. This is a discrete version of the Probability Density Function (PDF), which for continuous functions can be expressed in non-discrete form. Of course many of the things that we measure cannot be expressed as continuous functions. The PDF is a histogram, where each histogram bin represents the probability of the data being in the range over which the bin is calculated. The sum of all the bins will be 1. The PDF is constructed so that it has a zero mean. 64 bins are used in calculating he histogram, so there should be sufficiently more than 64 items. */ class pdf { private: pdf( const pdf &rhs ); void normalize( double *norm, const double *v, const size_t N ); public: pdf() {}; ~pdf() {} double pdf_stddev( const double *v, const size_t N ); }; #endif stat/include/stddev.h0100666000076400010010000000231707663045407015433 0ustar AdministratorNone #ifndef STDDEV_H_ #define STDDEV_H_ /** Calculate the unbiased standard deviation.

Copyright and Use

You may use this source code without limitation and without fee as long as you include:

This software was written and is copyrighted by Ian Kaplan, Bear Products International, www.bearcave.com, 2001.

This software is provided "as is", without any warranty or claim as to its usefulness. Anyone who uses this source code uses it at their own risk. Nor is any support provided by Ian Kaplan and Bear Products International. Please send any bug fixes or suggested source changes to:
     iank@bearcave.com
*/ class stddev { private: stddev( const stddev &rhs ); double mean_; double calc_mean_( const double *v, const size_t N); public: stddev() { mean_ = 0;} ~stddev() {} double mean() { return mean_; } /** calculate the standard deviation of N values in v */ double sd( const double *v, const size_t N ); /** calculate the standard deviation, given the mean */ double sd( const double *v, const size_t N, const double mean ); }; #endif stat/lrtest.cpp0100666000076400010010000000376307630232517014367 0ustar AdministratorNone #include #include #include using namespace std; /** \file The data values are from Table 6.1 in "Statistics Manual" by Crow, Davis, Maxfield, Dover Press. According to "Statistics Manual"
         b = 7.35476

         a = -337.983
for the equation y' = a + bx */ /** Initialize the data vector container with data from the X and Y vectors. */ void init_data( vector &data ) { static double X[] = { 55.77, 55.05, 54.27, 50.63, 49.86, 53.04, 51.33, 56.70, 55.07, 55.76, 54.40, 55.39, 57.49, 57.56, 58.76, 59.32, 57.21, 68.55, 65.04, 66.98, 63.69, 58.34 }; static double Y[] = { 83.9, 66.4, 73.1, 66.7, 30.1, 36.2, 22.8, 66.5, 37.0, 58.0, 71.9, 83.1, 66.2, 72.3, 65.8, 123.5, 116.8, 160.1, 158.2, 152.2, 134.8, 87.3 }; const size_t N = sizeof( X ) / sizeof( double ); assert( N == (sizeof( Y ) / sizeof(double)) ); size_t i; for (i = 0; i < N; i++) { lregress::point p( X[i], Y[i] ); data.push_back( lregress::point( p ) ); } } // init_data main() { lregress lr; lregress::lineInfo info; vector data; init_data( data ); const size_t N = data.size(); size_t i; // print out the points for (i = 0; i < N; i++) { // printf("%7.4f %7.4f\n", data[i].x(), data[i].y() ); } lr.lr( data, info ); printf("b (slope) = %7.4f, a (intercept) = %7.4f\n", info.slope(), info.intercept() ); printf(" slopeErr = %7.4f, stddev = %7.4f, corr = %7.4f\n", info.slopeErr(), info.stddev(), info.corr() ); double yPrime; for (i = 0; i < N; i++) { yPrime = info.intercept() + (info.slope() * data[i].x()); // printf("%7.4f %7.4f\n", data[i].x(), yPrime ); } } // main stat/MainPage0100666000076400010010000000244607663047203013751 0ustar AdministratorNone /*! \mainpage

Basic Statistics Functions

This Doxygen generated C++ documentation was created for a set of basic statistics functions. These basic statistics functions have been described in many books and web pages. My objective was not to restate this material yet again, but to summarize some of the basic equations and provide C++ software that implements these functions. My Basic Statistics web page provides the equations and some references.

Copyright and Use

You may use this source code without limitation and without fee as long as you include:

This software was written and is copyrighted by Ian Kaplan, Bear Products International, www.bearcave.com, 2003.

This software is provided "as is", without any warranty or claim as to its usefulness. Anyone who uses this source code uses it at their own risk. Nor is any support provided by Ian Kaplan and Bear Products International.

Please send any bug fixes or suggested source changes to:

     iank@bearcave.com
*/ stat/Makefile0100666000076400010010000000241707663047712014010 0ustar AdministratorNone # # Build a test for linear regression and standard # deviation. # # This is a Microsoft nmake Makefile. To execute enter "nmake". # This Makefile will also remove object and debug files built # by the Microsoft tools ("nmake clean"). Doxygen generated # Documentation can be created by entering "nmake doxygen". # DEBUG = -Zi BROWSE = CFLAGS = $(BROWSE) $(DEBUG) -DWIN32 -Tp OBJ = obj EXE = .exe DOXYPATH = g:\doxygen\bin SYSINC = "c:\Program Files\Microsoft Visual Studio\Vc98\Include" INCLUDE = -I"include" -I$(SYSINC) ALL: tests tests: lrtest$(EXE) sdtest$(EXE) clean: rm -f *.obj *.pdb *.sbr *.ilk *.exe rm -f include/*~ rm -f src/*~ doxygen: $(DOXYPATH)\doxygen doxygenDocConfig lrtest$(EXE): lrtest.$(OBJ) lregress.$(OBJ) $(CC) lrtest.$(OBJ) lregress.$(OBJ) $(DEBUG) -GX -o lrtest$(EXE) sdtest$(EXE): sdtest.$(OBJ) stddev.$(OBJ) $(CC) sdtest.$(OBJ) stddev.$(OBJ) $(DEBUG) -GX -o sdtest$(EXE) lregress.$(OBJ): src\$*.cpp include\$*.h $(CC) -c $(INCLUDE) -GX $(CFLAGS) src\$*.cpp stddev.$(OBJ): src\$*.cpp include\$*.h $(CC) -c $(INCLUDE) $(CFLAGS) src\$*.cpp lrtest.$(OBJ): $*.cpp $(CC) -c $(INCLUDE) -GX $(CFLAGS) $*.cpp sdtest.$(OBJ): $*.cpp $(CC) -c $(INCLUDE) $(CFLAGS) $*.cpp stat/sdtest.cpp0100666000076400010010000000143407575020141014345 0ustar AdministratorNone #include #include "stddev.h" /** Table 1 from "Statistics Manual" by Crow et al stddev = 220.6 (calculated here as 220.6428) mean = 1589.8 */ double data[] = {1472, 1315, 1984, 1900, 1646, 1709, 1780, 1571, 1681, 1453, 1799, 1372, 1420, 1612, 1546, 1255, 1818, 1357, 1412, 1775, 1850, 1417, 2057, 1468, 1694, 1776, 1456, 1489, 1618, 1544, 1251, 1422, 1506, 1651, 1687, 1080, 1866, 1713, 1624, 1370, 2107, 1668, 1411, 1654, 1503, 1934, 1451, 1240, 1500, 1606 }; main() { size_t N = sizeof( data ) / sizeof(double); stddev sd; double mu, sigma; sigma = sd.sd( data, N ); mu = sd.mean(); printf("stddev = %7.4f, mean = %7.4f\n", sigma, mu ); } stat/src/0040777000104000010010000000000007663047326013306 5ustar AdministratorsNonestat/src/autocorr.cpp0100666000076400010010000000527707663044657015515 0ustar AdministratorNone #include #include "lregress.h" #include "autocorr.h" using namespace std; /** Calculate the slope the the log of the autocorrelation curve. Autocorrelation is one measure for long memory (long range dependence) in a data set. The idea behind implementing this function was that the slope of the log/log plot of the autocorrelation curve could be compared for various data sets. The Hurst exponent provides another measure for long memory processes. My original idea was to use the slope of the log/log ACF as a comparision for the various Hurst values. As it turned out, the slope of the ACF was not a very useful metric since the slopes did not differ much for various Hurst exponents */ void autocorr::acorrSlope( acorrInfo &info ) { const size_t len = info.points().size(); if (len > 0) { lregress::lineInfo regressInfo; lregress lr; vector regressPoints; for (size_t i = 0; i < len; i++) { double x = log(i+1); double y = log((info.points())[i]); regressPoints.push_back( lregress::point(x,y) ); } lr.lr( regressPoints, regressInfo ); info.slope( regressInfo.slope() ); info.slopeErr( regressInfo.slopeErr() ); } } // acorrSlope /** Calculate the autocorrelation function */ void autocorr::ACF( const double *v, const size_t N, acorrInfo &info ) { if (! info.points().empty() ) { info.points().clear(); } // The devMean array will contain the deviation from the mean. // That is, v[i] - mean(v). double *devMean = new double[ N ]; double sum; size_t i; // Calculate the mean and copy the vector v, into devMean sum = 0; for (i = 0; i < N; i++) { sum = sum + v[i]; devMean[i] = v[i]; } double mean = sum / static_cast(N); // Compute the values for the devMean array. Also calculate the // denominator for the autocorrelation function. sum = 0; for (i = 0; i < N; i++) { devMean[i] = devMean[i] - mean; sum = sum + (devMean[i]*devMean[i]); } double denom = sum / static_cast(N); // Calculate a std::vector of values which will make up // the autocorrelation function. double cor = 1.0; for (size_t shift = 1; shift <= numPoints_ && cor > limit_; shift++) { info.points().push_back( cor ); size_t n = N - shift; sum = 0.0; for (i = 0; i < n; i++) { sum = sum + (devMean[i] * devMean[i+shift]); } double numerator = sum / static_cast(n) cor = numerator / denom; } // calculate the log/log slope of the autocorrelation acorrSlope( info ); delete [] m; } // ACF stat/src/lregress.cpp0100666000076400010010000000633607663043604015471 0ustar AdministratorNone #include #include "lregress.h" using namespace std; /** Calculate the mean of the x values in a vector of point objects. */ double lregress::meanX( vector &data ) const { double mean = 0.0; double sum = 0.0; const size_t N = data.size(); size_t i; for (i = 0; i < N; i++) { sum = sum + data[i].x(); } mean = sum / N; return mean; } // meanX /** Calculate the mean of the y values in a vector of point objects. */ double lregress::meanY( vector &data ) const { double mean = 0.0; double sum = 0.0; const size_t N = data.size(); size_t i; for (i = 0; i < N; i++) { sum = sum + data[i].y(); } mean = sum / N; return mean; } // meanY /** Calculate the linear regression coefficients, a and b, along with the standard regression error (e.g., the error of b), the standard deviation of the points and the correlation. A regression line is described by the equation y' = a + bx. The coefficients a and b are returned in a lineInfo object, along with the other values. Formally, linear regression of a set of {x,y} points is described in terms of independent and dependent variables. The array x contains the independent variable, which is exactly known. The array y contains the dependent variable, which is "measured". The y values are assumed to be random values, dependent on the x values. */ void lregress::lr( vector &data, lregress::lineInfo &info ) const { const size_t N = data.size(); if (N > 0) { double muX = meanX( data ); double muY = meanY( data ); // N-1 // --- // \ (Xi - meanX)(Yi - meanY) // /__ // i=0 // b = ----------------------------- // N-1 // --- 2 // \ (Xi - meanX) // /__ // i=0 // double SSxy = 0; double SSxx = 0; double SSyy = 0; double Sx = 0; double Sy = 0; double Sxy = 0; double SSy = 0; double SSx = 0; for (size_t i = 0; i < N; i++) { Sx = Sx + data[i].x(); Sy = Sy + data[i].y(); Sxy = Sxy + (data[i].x() * data[i].y()); SSx = SSx + (data[i].x() * data[i].x()); SSy = SSy + (data[i].y() * data[i].y()); double subX = (data[i].x() - muX); double subY = (data[i].y() - muY); SSyy = SSyy + subY * subY; SSxy = SSxy + subX * subY; SSxx = SSxx + subX * subX; } // slope double b = SSxy / SSxx; // intercept double a = muY - b * muX; // standard deviation of the points double stddevPoints = sqrt( (SSyy - b * SSxy)/(N-2) ); // Error of the slope double bError = stddevPoints / sqrt( SSxx ); double r2Numerator = (N * Sxy) - (Sx * Sy); double r2Denominator = ((N*SSx) - (Sx * Sx))*((N*SSy) - (Sy * Sy)); double r2 = (r2Numerator * r2Numerator) / r2Denominator; double signB = (b < 0) ? -1.0 : 1.0; double r = signB * sqrt( r2 ); info.corr( r ); info.stddev( stddevPoints ); info.slopeErr( bError ); info.slope( b ); info.intercept( a ); } // if N > 0 } // lineInfo stat/src/pdf.cpp0100666000076400010010000000250507635213150014400 0ustar AdministratorNone #include #include "pdf.h" void pdf::normalize( double *norm, const double *v, const size_t N ) { double sum = 0; size_t i; for (i = 0; i < N; i++) { sum = sum + v[i]; } double mean = 0; if (sum != 0) { double mean = sum / N; } for (i = 0; i < N; i++) norm[i] = v[i] - mean; } // normalize double pdf::pdf_stddev( const double *v, const size_t N ) { double pdf_sigma = 0.0; if (v != 0 && N != 0) { // On average, 4 elements per bin // const size_t num_bins = N >> 2; const size_t num_bins = 64; histogram::bin_vec binz( num_bins ); histogram histo; histo.calculate( v, N, binz ); double *freq = new double[ num_bins ]; // calculate the PDF from the integer frequency counts for (size_t i = 0; i < num_bins; i++) { freq[i] = 0.0; size_t count = static_cast( binz[i] ); double val = 0.0; if (count > 0) { freq[i] = static_cast(count)/static_cast(N); val = freq[i]; } // printf("%2d %9.6f\n", i, val ); } // printf("\n\n"); double *norm = new double[ num_bins ]; normalize(norm, freq, num_bins); stddev sd; pdf_sigma = sd.sd( norm, num_bins ); delete [] norm; delete [] freq; } return pdf_sigma; } // pdf stat/src/stddev.cpp0100666000076400010010000000231207616657315015132 0ustar AdministratorNone #include #include "stddev.h" /** Calculate the arithmetic mean (a.k.a. average) */ double stddev::calc_mean_( const double *v, const size_t N ) { double mean = 0.0; double sum = 0.0; for (size_t i = 0; i < N; i++) { sum = sum + v[i]; } mean = sum / static_cast(N); return mean; } // calc_mean_ /** Calculate the standard deviation, given the mean of the numbers */ double stddev::sd( const double *v, const size_t N, const double mean ) { double stdDev = 0.0; mean_ = mean; // calculate the standard deviation sum double stdDevSum = 0; double x; for (size_t i = 0; i < N; i++) { x = v[i] - mean_; stdDevSum = stdDevSum + (x * x); } double variance = stdDevSum / static_cast(N-1); stdDev = sqrt( variance ); return stdDev; } // sd /** Calculate the standard deviation of N values pointed to by v. This is a so called "unbiased" estimate of the standard deviation. */ double stddev::sd( const double *v, const size_t N ) { double stdDev = 0.0; if (v != 0) { double mean = calc_mean_(v, N); stdDev = sd( v, N, mean ); } return stdDev; } // sd