Main Page   Compound List   File List   Compound Members  

Statistics Class Reference

The Statistics class computes simple statistical quantities from a double array of samples provided by the user. This rest of this file contains the definition of the class Statistics. It contains the declarations of the member functions and data members of the class. However it does not include initialization of the data. That must be done in the class constructor. More...

#include <Statistics.hh>

List of all members.

Public Methods

 Statistics (int arrayLengthIn, double *arrayIn)
 The class constructor. More...

 ~Statistics ()
 The class destructor. More...

double GetMinimum ()
 Returns the mimimum value of the samples. More...

double GetMaximum ()
double GetMean ()
double GetStdDev ()
double GetVariance ()
double GetMedian ()

Private Methods

double Minimum (void)
 Computes the mimimum value of the samples. More...

double Maximum (void)
double Mean (void)
double MeanSquares (void)
double Variance (void)
double Median (double *SortedArray, int Length)
void SelectionSort (double *Array, double *SortedArray, int Length)
 Used in calculation of median. More...

int MaximumIndex (double *Array, int Length)
 Used in calculation of maximum. More...


Private Attributes

int arrayLength
 The number of samples. More...

double * array
 Array to store values of samples. Must be initialized by user in application code. More...

double * sortedArray
 Used in calculation of median. More...

double minimum
 Variable which holds the minimum value of the samples. More...

double maximum
double mean
double standardDeviation
double variance
double median


Detailed Description

The Statistics class computes simple statistical quantities from a double array of samples provided by the user. This rest of this file contains the definition of the class Statistics. It contains the declarations of the member functions and data members of the class. However it does not include initialization of the data. That must be done in the class constructor.


Constructor & Destructor Documentation

Statistics::Statistics int    arrayLengthIn,
double *    arrayIn
 

The class constructor.

General facts about constructors:

  1. The constructor initializes (all) the data members of the class.
  2. It must have the same name as the class.
  3. A class can have more than one constructor, but the input parameters of two different constructors must be different
  4. A constructor does not have a return type
  5. The constructor must always be a public method!
  6. The constructor can (and often does) call other member functions
  7. In an application program you create a new instance of a class by calling one of the class's constructors.
  8. Each separate instance of the class is called an object.
The input parameters to the Statistics class are
Parameters:
arrayLengthIn:  The length of the array which stores the samples
arrayIn:  The array in which the samples are stored
The constructor uses the input parameters to initialize

the private data members Statistics::arrayLength and Statistics::array

Then it calls other member functions to compute the values of the private data members

  1. Statistics::minimum
  2. Statistics::maximum
  3. Statistics::mean
  4. Statistics::variance
  5. Statistics::standardDeviation
  6. Statistics::median

Statistics::~Statistics  
 

The class destructor.

General facts about destructors:

  1. The destructor is called when an object is destroyed
  2. The destructor is always named ~ClassName().
  3. It has no parameter list or return type
  4. The destructor of an object is called automatically when the program that is executing leaves the scope in which the object was created
  5. The most common use of a destructor is to delete memory that was dynamically allocated by the constructor.
  6. In OCS the destructor ~RanNumGen() saves the current state of the RNG to a file.
The Statistics destructor deletes the array Statistics::sortedArray


Member Function Documentation

double Statistics::GetMaximum   [inline]
 

double Statistics::GetMean   [inline]
 

double Statistics::GetMedian   [inline]
 

double Statistics::GetMinimum   [inline]
 

Returns the mimimum value of the samples.

double Statistics::GetStdDev   [inline]
 

double Statistics::GetVariance   [inline]
 

double Statistics::Maximum void    [private]
 

int Statistics::MaximumIndex double *    Array,
int    Length
[private]
 

Used in calculation of maximum.

double Statistics::Mean void    [private]
 

double Statistics::MeanSquares void    [private]
 

double Statistics::Median double *    SortedArray,
int    Length
[private]
 

double Statistics::Minimum void    [private]
 

Computes the mimimum value of the samples.

void Statistics::SelectionSort double *    Array,
double *    SortedArray,
int    Length
[private]
 

Used in calculation of median.

double Statistics::Variance void    [private]
 


Member Data Documentation

double* Statistics::array [private]
 

Array to store values of samples. Must be initialized by user in application code.

int Statistics::arrayLength [private]
 

The number of samples.

double Statistics::maximum [private]
 

double Statistics::mean [private]
 

double Statistics::median [private]
 

double Statistics::minimum [private]
 

Variable which holds the minimum value of the samples.

double* Statistics::sortedArray [private]
 

Used in calculation of median.

double Statistics::standardDeviation [private]
 

double Statistics::variance [private]
 


The documentation for this class was generated from the following file:
Generated on Fri Feb 7 19:54:01 2003 for hello by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002