Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Statistic.cxx

Go to the documentation of this file.
00001 // Statistic.cxx
00002 // $Id: Statistic.cxx,v 1.1.1.1 1999/12/20 22:29:13 burnett Exp $
00003 #include "Statistic.h"
00004 
00005 #include <iomanip>
00006 
00007 using namespace std;
00008 
00009 Statistic::Statistic(const Tuple&t, std::string::const_iterator& it, std::string::iterator end)
00010 {
00011     std::string::const_iterator begin = it; // save first
00012     // parse the expression: expect name,
00013     std::string name;
00014     for(;   it != end && *it!=','; ++it) name += *it;
00015     set_tuple_item(t,name);
00016     set_name(std::string(begin,it-begin));
00017     if( *it==',')++it;
00018 }
00019 
00020 
00021 void    Statistic::report(ostream& out)
00022 {
00023     Analyze::separator(out);
00024     double mean, rms;
00025     out << "\n" << Analyze::make_label(name()+"--mean")
00026                 << std::setw(6) <<  (mean=m_stat.mean());
00027     out << "\n" << Analyze::make_label("rms")
00028                 << std::setw(6) <<  (rms=m_stat.stdDev());
00029     out << "\n" << Analyze::make_label("min")
00030                 << std::setw(6) <<  m_stat.min();
00031     if( rms>1e-6*mean) {
00032         out << " (=" << std::setprecision(3) 
00033         << (m_stat.min()-mean)/rms << " std)";
00034          out << std::setprecision(6);
00035     }
00036 
00037     out << "\n" << Analyze::make_label("max")
00038                 << std::setw(6) <<  m_stat.max() ;
00039     if( rms>1e-6*mean){
00040         out <<  " (=" << std::setprecision(3) 
00041         << (m_stat.max()-mean)/rms << " std)";
00042         out << std::setprecision(6);
00043     }
00044 }

Generated at Wed Nov 21 12:20:39 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000