Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57329 - in sandbox/statistics/detail/accumulator: . boost boost/statistics boost/statistics/detail boost/statistics/detail/accumulator boost/statistics/detail/accumulator/statistics boost/statistics/detail/accumulator/statistics/keyword libs libs/statistics libs/statistics/detail libs/statistics/detail/example libs/statistics/detail/src
From: erwann.rogard_at_[hidden]
Date: 2009-11-03 11:57:09


Author: e_r
Date: 2009-11-03 11:57:08 EST (Tue, 03 Nov 2009)
New Revision: 57329
URL: http://svn.boost.org/trac/boost/changeset/57329

Log:
a
Added:
   sandbox/statistics/detail/accumulator/
   sandbox/statistics/detail/accumulator/boost/
   sandbox/statistics/detail/accumulator/boost/statistics/
   sandbox/statistics/detail/accumulator/boost/statistics/detail/
   sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/
   sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/
   sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_less_than.hpp (contents, props changed)
   sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/keyword/
   sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/keyword/threshold.hpp (contents, props changed)
   sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/mean_var_accumulator.hpp (contents, props changed)
   sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/proportion_less_than.hpp (contents, props changed)
   sandbox/statistics/detail/accumulator/libs/
   sandbox/statistics/detail/accumulator/libs/statistics/
   sandbox/statistics/detail/accumulator/libs/statistics/detail/
   sandbox/statistics/detail/accumulator/libs/statistics/detail/example/
   sandbox/statistics/detail/accumulator/libs/statistics/detail/src/
   sandbox/statistics/detail/accumulator/libs/statistics/detail/src/main.cpp (contents, props changed)

Added: sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_less_than.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_less_than.hpp 2009-11-03 11:57:08 EST (Tue, 03 Nov 2009)
@@ -0,0 +1,96 @@
+///////////////////////////////////////////////////////////////////////////////
+// accumulator::statistics::count_less_than.hpp // //
+// //
+// Copyright 2008 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_COUNT_LESS_THAN_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_COUNT_LESS_THAN_HPP_ER_2009
+
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/parameters/accumulator.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+
+#include <boost/statistics/detail/accumulator/statistics/keyword/threshold.hpp>
+
+namespace boost {
+namespace statistics{
+namespace detail{
+namespace accumulator{
+
+namespace impl
+{
+
+ template<typename T>
+ struct count_less_than : public boost::accumulators::accumulator_base
+ {
+ typedef boost::accumulators::dont_care dont_care_;
+
+ typedef std::size_t result_type;
+
+ template<typename Args>
+ count_less_than(const Args& args)
+ : cnt(0), t(args[keyword::threshold|static_cast<T>(0)]){}
+
+ count_less_than(const count_less_than& that)
+ : cnt(that.cnt), t(that.t){}
+
+ template<typename Args>
+ void operator ()(const Args& args)
+ {
+ if(args[boost::accumulators::sample]<this->t)
+ {
+ ++this->cnt;
+ }
+ }
+
+ result_type result(dont_care_) const
+ {
+ return this->cnt;
+ }
+
+ private:
+ result_type cnt;
+ T t;
+ };
+
+}//impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::count_less_than
+namespace tag
+{
+ struct count_less_than
+ : boost::accumulators::depends_on<>
+ {
+ typedef impl::count_less_than<mpl::_1> impl;
+
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::count_less_than
+namespace extract
+{
+
+ template<typename AccumulatorSet>
+ typename mpl::apply<AccumulatorSet,tag::count_less_than>::type::result_type
+ count_less_than(AccumulatorSet const& acc){
+ typedef tag::count_less_than the_tag;
+ return boost::accumulators::extract_result<the_tag>(acc);
+ }
+
+}
+
+using extract::count_less_than;
+
+}// accumulator
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/keyword/threshold.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/keyword/threshold.hpp 2009-11-03 11:57:08 EST (Tue, 03 Nov 2009)
@@ -0,0 +1,32 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::accumulator::threshold.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_KEYWORD_THRESHOLD_HPP_2009
+#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_KEYWORD_THRESHOLD_HPP_2009
+#include <boost/parameter/name.hpp>
+#include <boost/parameter/keyword.hpp>
+
+namespace boost {
+namespace statistics{
+namespace detail{
+namespace accumulator{
+namespace tag{
+ struct threshold{};
+}// tag
+namespace keyword{
+ namespace
+ {
+ boost::parameter::keyword<tag::threshold>& threshold
+ = boost::parameter::keyword<tag::threshold>::get();
+ }
+}// keyword
+}// accumulator
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/mean_var_accumulator.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/mean_var_accumulator.hpp 2009-11-03 11:57:08 EST (Tue, 03 Nov 2009)
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::accumulator::statistics::mean_var_accumulator.hpp //
+// //
+// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_MEAN_VAR_ACCUMULATOR_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_MEAN_VAR_ACCUMULATOR_HPP_ER_2009
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/statistics/mean.hpp>
+#include <boost/accumulators/statistics/variance.hpp>
+#include <boost/accumulators/statistics/stats.hpp>
+
+namespace boost{
+namespace functional{
+
+ // This comes up often, so this saves a bit of time
+ template<typename T>
+ struct mean_var_accumulator{
+ typedef accumulators::stats<
+ accumulators::tag::mean,
+ accumulators::tag::variance
+ > stat_;
+ typedef accumulators::accumulator_set<T,stat_> type;
+ };
+
+}// meta
+}// boost
+
+#endif

Added: sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/proportion_less_than.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/proportion_less_than.hpp 2009-11-03 11:57:08 EST (Tue, 03 Nov 2009)
@@ -0,0 +1,97 @@
+///////////////////////////////////////////////////////////////////////////////
+// accumulator::statistics::proportion_less_than.hpp //
+// //
+// Copyright 2008 Erwann Rogard. Distributed under the Boost //
+// Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+///////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_PROPORTION_LESS_THAN_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_PROPORTION_LESS_THAN_HPP_ER_2009
+#include <boost/parameter/binding.hpp>
+#include <boost/accumulators/framework/extractor.hpp>
+#include <boost/accumulators/framework/accumulator_base.hpp>
+#include <boost/accumulators/framework/parameters/sample.hpp>
+#include <boost/accumulators/framework/parameters/accumulator.hpp>
+#include <boost/accumulators/framework/depends_on.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+
+#include <boost/statistics/detail/accumulator/statistics/count_less_than.hpp>
+
+namespace boost {
+namespace statistics{
+namespace detail{
+namespace accumulator{
+
+namespace impl
+{
+
+ template<typename T>
+ class proportion_less_than : public boost::accumulators::accumulator_base
+ {
+ typedef boost::accumulators::dont_care dont_care_;
+ typedef tag::count_less_than tag_m_;
+ typedef boost::accumulators::tag::count tag_n_;
+ typedef boost::accumulators::tag::accumulator tag_acc_;
+
+ public:
+
+ typedef T result_type;
+
+ proportion_less_than(dont_care_){}
+
+ void operator()(dont_care_)const{}
+
+ template<typename Args>
+ result_type result(const Args& args) const
+ {
+ typedef boost::parameter::binding<Args,tag_acc_> bind_;
+ typedef typename bind_::type cref_;
+ cref_ acc = args[boost::accumulators::accumulator];
+ T res = boost::accumulators::extract_result<tag_m_>( acc );
+ res /= static_cast<T>(
+ boost::accumulators::extract_result<tag_n_>( acc )
+ );
+ return res;
+ }
+ };
+
+}//impl
+
+///////////////////////////////////////////////////////////////////////////////
+// tag::proportion_less_than
+namespace tag
+{
+ struct proportion_less_than
+ : boost::accumulators::depends_on<
+ boost::accumulators::tag::count,
+ tag::count_less_than
+ >
+ {
+ typedef impl::proportion_less_than<mpl::_1> impl;
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// extract::proportion_less_than
+namespace extract
+{
+
+ template<typename AccSet>
+ typename
+ boost::mpl::apply<AccSet,tag::proportion_less_than>::type::result_type
+ proportion_less_than(AccSet const& acc){
+ typedef tag::proportion_less_than the_tag;
+ return boost::accumulators::extract_result<the_tag>(acc);
+ }
+
+}
+
+using extract::proportion_less_than;
+
+}// accumulator
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/accumulator/libs/statistics/detail/src/main.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/accumulator/libs/statistics/detail/src/main.cpp 2009-11-03 11:57:08 EST (Tue, 03 Nov 2009)
@@ -0,0 +1,7 @@
+
+// No examples at present
+int main()
+{
+
+ return 0;
+}
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk