1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 387 unchanged lines hidden (view full) --- 396 397 info->y_subnames.resize(self.y); 398 for (off_type i = 0; i < self.y; ++i) 399 info->y_subnames[i] = names[i]; 400 return self; 401 } 402 403 Derived & |
404 ysubname(off_type index, const std::string &subname) |
405 { 406 Derived &self = this->self(); 407 Info *info = this->info(); 408 409 assert(index < self.y); 410 info->y_subnames.resize(self.y); 411 info->y_subnames[index] = subname.c_str(); 412 return self; 413 } |
414 415 std::string 416 ysubname(off_type i) const 417 { 418 return this->info()->y_subnames[i]; 419 } 420 |
421}; 422 423////////////////////////////////////////////////////////////////////// 424// 425// Simple Statistics 426// 427////////////////////////////////////////////////////////////////////// 428 --- 770 unchanged lines hidden (view full) --- 1199 for (off_type i = 0; i < _size; ++i) 1200 new (&storage[i]) Storage(info); 1201 1202 this->setInit(); 1203 1204 return self; 1205 } 1206 |
1207 Proxy 1208 operator[](off_type index) 1209 { 1210 off_type offset = index * y; 1211 assert (index >= 0 && offset + index < size()); 1212 return Proxy(this->self(), offset, y); 1213 } 1214 --- 498 unchanged lines hidden (view full) --- 1713 size() const 1714 { 1715 return _size; 1716 } 1717 1718 bool 1719 zero() const 1720 { |
1721 for (off_type i = 0; i < size(); ++i) 1722 if (!data(i)->zero()) 1723 return false; 1724 return true; |
1725 } 1726 1727 void 1728 prepare() 1729 { 1730 Info *info = this->info(); 1731 size_type size = this->size(); 1732 info->data.resize(size); --- 56 unchanged lines hidden (view full) --- 1789 return data()->zero(); 1790 } 1791 1792 /** 1793 * Proxy has no state. Nothing to reset. 1794 */ 1795 void reset() { } 1796}; |
1797 |
1798////////////////////////////////////////////////////////////////////// 1799// 1800// Formula Details 1801// 1802////////////////////////////////////////////////////////////////////// 1803 1804/** 1805 * Base class for formula statistic node. These nodes are used to build a tree --- 461 unchanged lines hidden (view full) --- 2267class StandardDeviation : public DistBase<StandardDeviation, SampleStor> 2268{ 2269 public: 2270 /** 2271 * Construct and initialize this distribution. 2272 */ 2273 StandardDeviation() 2274 { |
2275 SampleStor::Params *params = new SampleStor::Params; |
2276 this->doInit(); |
2277 this->setParams(params); |
2278 } 2279}; 2280 2281/** 2282 * Calculates the per tick mean and variance of the samples. 2283 * @sa DistBase, AvgSampleStor 2284 */ 2285class AverageDeviation : public DistBase<AverageDeviation, AvgSampleStor> 2286{ 2287 public: 2288 /** 2289 * Construct and initialize this distribution. 2290 */ 2291 AverageDeviation() 2292 { |
2293 AvgSampleStor::Params *params = new AvgSampleStor::Params; |
2294 this->doInit(); |
2295 this->setParams(params); |
2296 } 2297}; 2298 2299/** 2300 * A vector of distributions. 2301 * @sa VectorDistBase, DistStor 2302 */ 2303class VectorDistribution : public VectorDistBase<VectorDistribution, DistStor> --- 32 unchanged lines hidden (view full) --- 2336 /** 2337 * Initialize storage for this distribution. 2338 * @param size The size of the vector. 2339 * @return A reference to this distribution. 2340 */ 2341 VectorStandardDeviation & 2342 init(size_type size) 2343 { |
2344 SampleStor::Params *params = new SampleStor::Params; |
2345 this->doInit(size); |
2346 this->setParams(params); |
2347 return this->self(); 2348 } 2349}; 2350 2351/** 2352 * This is a vector of AverageDeviation stats. 2353 * @sa VectorDistBase, AvgSampleStor 2354 */ --- 4 unchanged lines hidden (view full) --- 2359 /** 2360 * Initialize storage for this distribution. 2361 * @param size The size of the vector. 2362 * @return A reference to this distribution. 2363 */ 2364 VectorAverageDeviation & 2365 init(size_type size) 2366 { |
2367 AvgSampleStor::Params *params = new AvgSampleStor::Params; |
2368 this->doInit(size); |
2369 this->setParams(params); |
2370 return this->self(); 2371 } 2372}; 2373 2374template <class Stat> 2375class FormulaInfoProxy : public InfoProxy<Stat, FormulaInfo> 2376{ 2377 protected: --- 378 unchanged lines hidden --- |