|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72888 - sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_
From: erwann.rogard_at_[hidden]
Date: 2011-07-04 12:25:08
Author: e_r
Date: 2011-07-04 12:25:07 EDT (Mon, 04 Jul 2011)
New Revision: 72888
URL: http://svn.boost.org/trac/boost/changeset/72888
Log:
upd acc_ecdf
Added:
sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/kolmogorov_smirnov_generator.hpp (contents, props changed)
sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/simulator.hpp (contents, props changed)
Removed:
sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/geometric_series_range.hpp
sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/incremental_simulator.hpp
sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/kolmogorov_smirnov_output.hpp
Deleted: sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/geometric_series_range.hpp
==============================================================================
--- sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/geometric_series_range.hpp 2011-07-04 12:25:07 EDT (Mon, 04 Jul 2011)
+++ (empty file)
@@ -1 +0,0 @@
-// TODO remove file
Deleted: sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/incremental_simulator.hpp
==============================================================================
--- sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/incremental_simulator.hpp 2011-07-04 12:25:07 EDT (Mon, 04 Jul 2011)
+++ (empty file)
@@ -1 +0,0 @@
-// TODO remove file
\ No newline at end of file
Added: sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/kolmogorov_smirnov_generator.hpp
==============================================================================
--- (empty file)
+++ sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/kolmogorov_smirnov_generator.hpp 2011-07-04 12:25:07 EDT (Mon, 04 Jul 2011)
@@ -0,0 +1,187 @@
+//////////////////////////////////////////////////////////////////////////////
+// accumulator_ecdf //
+// //
+// Copyright (C) 2005 Eric Niebler //
+// Copyright (C) 2011 Erwann Rogard //
+// Use, modification and distribution are subject to 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_ACCUMULATORS_STATISTICS_ECDF_AUX_KOLMOGOROV_SMIRNOV_GENERATOR_ER_2011_HPP
+#define BOOST_ACCUMULATORS_STATISTICS_ECDF_AUX_KOLMOGOROV_SMIRNOV_GENERATOR_ER_2011_HPP
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics_fwd.hpp>
+#include <boost/accumulators/statistics/ecdf/aux_/ignore.hpp>
+#include <boost/accumulators/statistics/ecdf/aux_/simulator.hpp>
+#include <boost/accumulators/statistics/ecdf/kolmogorov_smirnov_statistic.hpp>
+#include <boost/format.hpp>
+#include <boost/numeric/conversion/bounds.hpp>
+
+namespace boost{
+//[syntax_ecdf_aux_kolmogorov_smirnov_generator
+namespace accumulators{
+namespace ecdf{
+namespace aux_{
+
+ template<
+ typename Distribution,
+ typename T = typename Distribution::value_type
+ >
+ class kolmogorov_smirnov_output
+ {
+//<-
+ typedef boost::numeric::bounds<T> bounds_;
+//->
+ public:
+
+ typedef boost::format result_type;
+ typedef T value_type;
+
+ kolmogorov_smirnov_output(
+ Distribution dist
+ , result_type custom_format = result_type( "(%1%, %2%)" )
+ )/*<-*/
+ : d_( dist ),
+ f_( custom_format )
+ {}BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ result_type heading()const/*<-*/
+ {
+ return result_type( "(count, statistic)" );
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ template<typename AccumulatorSet>
+ result_type operator()( const AccumulatorSet& acc )const/*<-*/
+ {
+ value_type stat = ecdf::kolmogorov_smirnov_statistic<T>
+ (
+ acc,
+ this->distribution()
+ );
+
+ result_type result = this->f_;
+ return result % accumulators::extract::count( acc ) % stat;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ Distribution const& distribution()const/*<-*/
+ {
+ return this->d_;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+//<-
+ private:
+
+ Distribution d_;
+ result_type f_;
+//->
+ };
+
+ template<
+ typename Generator
+ , typename Distribution
+ , typename SizeGenerator = delta_geometric_sequence<>
+ >
+ class kolmogorov_smirnov_generator
+ {
+//<-
+ typedef typename Generator::distribution_type random_;
+ typedef typename random_::result_type sample_type;
+
+ typedef ecdf::tag::kolmogorov_smirnov_statistic ks_tag_;
+ typedef boost::accumulators::stats<ks_tag_> features_;
+
+ typedef accumulators::accumulator_set<
+ sample_type,
+ features_
+ > accumulator_set_;
+
+ typedef simulator<
+ Generator, accumulator_set_, SizeGenerator
+ > simulator_;
+ typedef kolmogorov_smirnov_output<Distribution> output_;
+
+//->
+ public:
+ typedef /*<-*/
+ BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/unspecified/*<-*/)
+ typename output_::result_type/*->*/ result_type;
+
+ kolmogorov_smirnov_generator(
+ Generator gen
+ , Distribution dist
+ )/*<-*/
+ :
+ s_( gen, accumulator_set_( ) )
+ , o_( dist )
+ {}BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ result_type operator()()const/*<-*/
+ {
+ return this->o_( this->s_() );
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+
+ simulator_ const& simulator()const/*<-*/
+ {
+ return this->s_;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ output_ const& output()const/*<-*/
+ {
+ return this->o_;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ template<typename String>
+ kolmogorov_smirnov_generator set_format(String str)/*<-*/
+ {
+ this->o_ = output_( this->o_.distribution(), str );
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ template<typename SizeGenerator1>
+ kolmogorov_smirnov_generator<
+ Generator, accumulator_set_, SizeGenerator1
+ >
+ set_size_generator(SizeGenerator1 sg)/*<-*/
+ {
+ typedef kolmogorov_smirnov_generator<
+ Generator, accumulator_set_, SizeGenerator1
+ > result_;
+ typedef aux_::simulator<
+ Generator,
+ accumulator_set_,
+ SizeGenerator1
+ > simulator1_;
+ return result_
+ (
+ simulator1_(
+ this->s_.distribution(),
+ this->s_.accumulator(),
+ sg
+ ),
+ this->output()
+ );
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+//<-
+ private:
+ simulator_ s_;
+ output_ o_;
+//->
+ };
+
+ template<typename Generator, typename Distribution>
+ kolmogorov_smirnov_generator<Generator, Distribution>
+ make_kolmogorov_smirnov_generator( Generator g, Distribution d )/*<-*/
+ {
+ typedef kolmogorov_smirnov_generator<Generator, Distribution> result_;
+ return result_( g, d );
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+}// aux_
+}// ecdf
+}// accumulators
+//]
+}// boost
+
+#endif // BOOST_ACCUMULATORS_STATISTICS_ECDF_AUX_KOLMOGOROV_SMIRNOV_GENERATOR_ER_2011_HPP
+
Deleted: sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/kolmogorov_smirnov_output.hpp
==============================================================================
--- sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/kolmogorov_smirnov_output.hpp 2011-07-04 12:25:07 EDT (Mon, 04 Jul 2011)
+++ (empty file)
@@ -1 +0,0 @@
-// TODO remove file
\ No newline at end of file
Added: sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/simulator.hpp
==============================================================================
--- (empty file)
+++ sandbox/acc_ecdf/boost/accumulators/statistics/ecdf/aux_/simulator.hpp 2011-07-04 12:25:07 EDT (Mon, 04 Jul 2011)
@@ -0,0 +1,147 @@
+//////////////////////////////////////////////////////////////////////////////
+// accumulator_ecdf //
+// //
+// Copyright (C) 2005 Eric Niebler //
+// Copyright (C) 2011 Erwann Rogard //
+// Use, modification and distribution are subject to 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_ACCUMULATORS_STATISTICS_ECDF_AUX_SIMULATOR_ER_2011_HPP
+#define BOOST_ACCUMULATORS_STATISTICS_ECDF_AUX_SIMULATOR_ER_2011_HPP
+#include <cstddef>
+#include <boost/accumulators/statistics/ecdf/aux_/ignore.hpp>
+
+namespace boost{
+//[syntax_ecdf_aux_simulator
+namespace accumulators{
+namespace ecdf{
+namespace aux_{
+
+ template<typename N = std::size_t>
+ struct delta_geometric_sequence
+ {
+
+ delta_geometric_sequence()/*<-*/
+ :n_( 1 )
+ , factor_( 2 )
+ , start( true )
+ {}BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ delta_geometric_sequence(N n, N factor)/*<-*/
+ :n_( n )
+ , factor_( factor )
+ , start( true )
+ {}BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ typedef N result_type;
+
+ N operator()()const/*<-*/
+ {
+ if( start )
+ {
+ start = false;
+ return this->n();
+ }else
+ {
+ N m = this->n();
+ this->n_ *= this->factor();
+ return ( this->n() - m );
+ }
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ N const& n()const/*<-*/
+ {
+ return this->n_;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+ N const& factor()const/*<-*/
+ {
+ return this->factor_;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+//<-
+ private:
+ mutable N n_;
+ N factor_;
+ mutable bool start;
+//->
+ };
+
+ template<
+ typename Generator,
+ typename AccumulatorSet,
+ typename SizeGenerator = delta_geometric_sequence<>
+ >
+ class simulator
+ {
+//<-
+ typedef typename Generator::distribution_type dist_;
+ typedef typename dist_::result_type sample_type;
+//->
+ public:
+
+ simulator(
+ Generator gen,
+ AccumulatorSet acc,
+ SizeGenerator size_gen
+ )/*<-*/
+ : gen_( gen ),
+ acc_( acc ),
+ size_gen_( size_gen )
+ {}BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ simulator(Generator gen, AccumulatorSet acc)/*<-*/
+ : gen_( gen ),
+ acc_( acc )
+ {}BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ typedef AccumulatorSet const& result_type;
+
+ // User specified sample size
+ template<typename N>
+ result_type operator()(N const& n)const/*<-*/
+ {
+ for( N i = 0; i < n; i++ )
+ {
+ sample_type x = this->gen_();
+ this->acc_( x );
+ }
+ return this->accumulator();
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ // Internally generated sample size
+ result_type operator()()const/*<-*/
+ {
+ typedef typename SizeGenerator::result_type n_;
+ return (*this)( this-> size_gen_() );
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+ Generator const& generator()const/*<-*/
+ {
+ return this->gen_;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+ AccumulatorSet const& accumulator()const/*<-*/
+ {
+ return this->acc_;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+ SizeGenerator const& size_generator()const/*<-*/
+ {
+ return this->size_gen_;
+ }BOOST_ACCUMULATORS_ECDF_IGNORE(/*->*/;/*<-*/)/*->*/
+
+//<-
+ private:
+ mutable Generator gen_;
+ mutable AccumulatorSet acc_;
+ mutable SizeGenerator size_gen_;
+//->
+ };
+
+}// aux_
+}// ecdf
+}// accumulators
+//]
+}// boost
+
+#endif // BOOST_ACCUMULATORS_STATISTICS_ECDF_AUX_SIMULATOR_ER_2011_HPP
+
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