proj home

Files   Classes   Functions   Hierarchy  

histogramtest Class Reference

Test histogram class. More...

#include <histogramtest.h>

List of all members.

Static Public Member Functions

static void test01 (int argc, char **argv)
 Do a histogram of a simple random distribution.


Detailed Description

Test histogram class.

Definition at line 8 of file histogramtest.h.


Member Function Documentation

void histogramtest::test01 ( int  argc,
char **  argv 
) [static]

Do a histogram of a simple random distribution.

Definition at line 11 of file histogramtest.cpp.

References commandline::enablehelp(), histogram< T >::eval(), histogram< T >::frequencydist(), commandline::mapvar(), histogram< T >::printfrequencydistpair(), r, and SHOW.

Referenced by main().

00012 {
00013   commandline c(argc,argv);
00014 
00015   uint N = 5;
00016   double wmax=10.0;
00017 
00018   c.mapvar(N,"N");
00019   c.mapvar(wmax,"wmax");
00020 
00021   random11<double> r;
00022 
00023   histogram<double> hg(0.0,wmax,N);
00024 
00025   uint samples = 200;
00026   c.mapvar(samples,"samples");
00027   //c.enablehelp(cout);
00028   c.enablehelp();
00029 
00030   cout << SHOW(N) << "   -the number of intervals." << endl;
00031   cout << SHOW(wmax) << "   -the random variable is [0,wmax]" << endl;
00032   cout << SHOW(samples) << endl;
00033   cout << endl;
00034 
00035   for (uint i=0; i<samples; ++i)
00036     hg.eval(wmax*r());
00037 
00038   cout << hg << endl;
00039 
00040   vector<double> fd;
00041   hg.frequencydist(fd);
00042 
00043   for (uint i=0; i<fd.size(); ++i)
00044     cout << fd[i] << " ";
00045   cout << endl << endl;
00046 
00047   hg.printfrequencydistpair(cout);
00048 }


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:03 2011 for Chelton Evans Source by  doxygen 1.5.8