00001
00002
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;
00012
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 }