statistics.hh (6977:039202aafc0d) statistics.hh (7444:669c1d2df752)
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;

--- 1684 unchanged lines hidden (view full) ---

1693 if (!storage)
1694 return ;
1695
1696 for (off_type i = 0; i < _size; ++i)
1697 data(i)->~Storage();
1698 delete [] reinterpret_cast<char *>(storage);
1699 }
1700
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;

--- 1684 unchanged lines hidden (view full) ---

1693 if (!storage)
1694 return ;
1695
1696 for (off_type i = 0; i < _size; ++i)
1697 data(i)->~Storage();
1698 delete [] reinterpret_cast<char *>(storage);
1699 }
1700
1701 Proxy operator[](off_type index);
1701 Proxy operator[](off_type index)
1702 {
1703 assert(index >= 0 && index < size());
1704 return Proxy(this->self(), index);
1705 }
1702
1703 size_type
1704 size() const
1705 {
1706 return _size;
1707 }
1708
1709 bool

--- 24 unchanged lines hidden (view full) ---

1734 return storage != NULL;
1735 }
1736};
1737
1738template <class Stat>
1739class DistProxy
1740{
1741 private:
1706
1707 size_type
1708 size() const
1709 {
1710 return _size;
1711 }
1712
1713 bool

--- 24 unchanged lines hidden (view full) ---

1738 return storage != NULL;
1739 }
1740};
1741
1742template <class Stat>
1743class DistProxy
1744{
1745 private:
1742 Stat *stat;
1746 Stat &stat;
1743 off_type index;
1744
1745 protected:
1747 off_type index;
1748
1749 protected:
1746 typename Stat::Storage *data() { return stat->data(index); }
1747 const typename Stat::Storage *data() const { return stat->data(index); }
1750 typename Stat::Storage *data() { return stat.data(index); }
1751 const typename Stat::Storage *data() const { return stat.data(index); }
1748
1749 public:
1752
1753 public:
1750 DistProxy(Stat *s, off_type i)
1754 DistProxy(Stat &s, off_type i)
1751 : stat(s), index(i)
1752 {}
1753
1754 DistProxy(const DistProxy &sp)
1755 : stat(sp.stat), index(sp.index)
1756 {}
1757
1758 const DistProxy &

--- 24 unchanged lines hidden (view full) ---

1783 return data()->zero();
1784 }
1785
1786 /**
1787 * Proxy has no state. Nothing to reset.
1788 */
1789 void reset() { }
1790};
1755 : stat(s), index(i)
1756 {}
1757
1758 DistProxy(const DistProxy &sp)
1759 : stat(sp.stat), index(sp.index)
1760 {}
1761
1762 const DistProxy &

--- 24 unchanged lines hidden (view full) ---

1787 return data()->zero();
1788 }
1789
1790 /**
1791 * Proxy has no state. Nothing to reset.
1792 */
1793 void reset() { }
1794};
1791
1795/*
1792template <class Derived, class Stor>
1793inline typename VectorDistBase<Derived, Stor>::Proxy
1794VectorDistBase<Derived, Stor>::operator[](off_type index)
1795{
1796 assert (index >= 0 && index < size());
1797 typedef typename VectorDistBase<Derived, Stor>::Proxy Proxy;
1796template <class Derived, class Stor>
1797inline typename VectorDistBase<Derived, Stor>::Proxy
1798VectorDistBase<Derived, Stor>::operator[](off_type index)
1799{
1800 assert (index >= 0 && index < size());
1801 typedef typename VectorDistBase<Derived, Stor>::Proxy Proxy;
1798 return Proxy(this, index);
1802 return Proxy(this->self(), index);
1799}
1803}
1804*/
1800
1801#if 0
1802template <class Storage>
1803Result
1804VectorDistBase<Storage>::total(off_type index) const
1805{
1806 Result total = 0.0;
1807 for (off_type i = 0; i < x_size(); ++i)

--- 454 unchanged lines hidden (view full) ---

2262 */
2263 Distribution &
2264 init(Counter min, Counter max, Counter bkt)
2265 {
2266 DistStor::Params *params = new DistStor::Params;
2267 params->min = min;
2268 params->max = max;
2269 params->bucket_size = bkt;
1805
1806#if 0
1807template <class Storage>
1808Result
1809VectorDistBase<Storage>::total(off_type index) const
1810{
1811 Result total = 0.0;
1812 for (off_type i = 0; i < x_size(); ++i)

--- 454 unchanged lines hidden (view full) ---

2267 */
2268 Distribution &
2269 init(Counter min, Counter max, Counter bkt)
2270 {
2271 DistStor::Params *params = new DistStor::Params;
2272 params->min = min;
2273 params->max = max;
2274 params->bucket_size = bkt;
2270 params->buckets = (size_type)rint((max - min) / bkt + 1.0);
2275 params->buckets = (size_type)rint((max - min + 1.0) / bkt );
2271 this->setParams(params);
2272 this->doInit();
2273 return this->self();
2274 }
2275};
2276
2277/**
2278 * Calculates the mean and variance of all the samples.

--- 44 unchanged lines hidden (view full) ---

2323 */
2324 VectorDistribution &
2325 init(size_type size, Counter min, Counter max, Counter bkt)
2326 {
2327 DistStor::Params *params = new DistStor::Params;
2328 params->min = min;
2329 params->max = max;
2330 params->bucket_size = bkt;
2276 this->setParams(params);
2277 this->doInit();
2278 return this->self();
2279 }
2280};
2281
2282/**
2283 * Calculates the mean and variance of all the samples.

--- 44 unchanged lines hidden (view full) ---

2328 */
2329 VectorDistribution &
2330 init(size_type size, Counter min, Counter max, Counter bkt)
2331 {
2332 DistStor::Params *params = new DistStor::Params;
2333 params->min = min;
2334 params->max = max;
2335 params->bucket_size = bkt;
2331 params->buckets = (size_type)rint((max - min) / bkt + 1.0);
2336 params->buckets = (size_type)rint((max - min + 1.0) / bkt);
2332 this->setParams(params);
2333 this->doInit(size);
2334 return this->self();
2335 }
2336};
2337
2338/**
2339 * This is a vector of StandardDeviation stats.

--- 422 unchanged lines hidden ---
2337 this->setParams(params);
2338 this->doInit(size);
2339 return this->self();
2340 }
2341};
2342
2343/**
2344 * This is a vector of StandardDeviation stats.

--- 422 unchanged lines hidden ---