COOPY » Guide
version 0.6.5
|
00001 #ifndef COOPY_STAT 00002 #define COOPY_STAT 00003 00004 namespace coopy { 00005 namespace store { 00006 class Stat; 00007 } 00008 } 00009 00010 class coopy::store::Stat { 00011 public: 00012 double mean; 00013 double stddev; 00014 bool valid; 00015 00016 Stat() { 00017 mean = stddev = 0; 00018 valid = false; 00019 } 00020 00021 bool isValid() { 00022 return valid; 00023 } 00024 00025 double evaluate(double x) { 00026 if (stddev<0.001) { 00027 return 1; 00028 } 00029 return (x-mean)/stddev; 00030 } 00031 00032 double rescale(double factor) { 00033 mean *= factor; 00034 stddev *= factor; 00035 return mean; 00036 } 00037 00038 }; 00039 00040 00041 #endif 00042