Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59016 - in sandbox/statistics/non_parametric: boost/statistics/detail/non_parametric/empirical_distribution boost/statistics/detail/non_parametric/empirical_distribution/keyword boost/statistics/detail/non_parametric/empirical_distribution/tag boost/statistics/detail/non_parametric/kolmogorov_smirnov libs/statistics/detail/non_parametric/doc libs/statistics/detail/non_parametric/example libs/statistics/detail/non_parametric/src
From: erwann.rogard_at_[hidden]
Date: 2010-01-14 21:41:15


Author: e_r
Date: 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
New Revision: 59016
URL: http://svn.boost.org/trac/boost/changeset/59016

Log:
add/modif
Added:
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/count.hpp
      - copied, changed from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_int.hpp
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp
      - copied, changed from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/frequency_int.hpp
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/keyword/
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/keyword/key.hpp
      - copied, changed from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/keyword/key.hpp
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp
      - copied, changed from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/empirical_distribution_int.hpp
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/tag/
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/tag/key.hpp
      - copied, changed from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/tag/key.hpp
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/
      - copied from r57329, /sandbox/statistics/detail/accumulator/libs/statistics/detail/example/
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.cpp
      - copied, changed from r58994, /sandbox/statistics/detail/accumulator/libs/statistics/detail/example/frequency_int.cpp
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.h
      - copied, changed from r58994, /sandbox/statistics/detail/accumulator/libs/statistics/detail/example/frequency_int.h
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/src/
      - copied from r57329, /sandbox/statistics/detail/accumulator/libs/statistics/detail/src/
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/src/main.cpp
      - copied, changed from r58993, /sandbox/statistics/detail/accumulator/libs/statistics/detail/src/main.cpp
Text files modified:
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/count.hpp | 48 +++++++++++++++-------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp | 48 ++++++++++++++--------------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/keyword/key.hpp | 12 +++---
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp | 33 +++++++++----------
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/tag/key.hpp | 10 +++---
   sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp | 66 +++++++++++++++++++++++++++++----------
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/doc/readme.txt | 29 +++++------------
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.cpp | 30 +++++++++--------
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.h | 8 ++--
   sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/src/main.cpp | 6 ++-
   10 files changed, 158 insertions(+), 132 deletions(-)

Copied: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/count.hpp (from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_int.hpp)
==============================================================================
--- /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_int.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/count.hpp 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -1,12 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
-// accumulator::statistics::count_int.hpp //
+// accumulator::statistics::empirical_distribution::count.hpp //
 // //
 // Copyright 2010 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_INT_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_COUNT_INT_HPP_ER_2010
+#ifndef BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_COUNT_HPP_ER_2010
+#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_COUNT_HPP_ER_2010
 #include <map>
 #include <functional>
 
@@ -23,18 +23,17 @@
 #include <boost/accumulators/framework/depends_on.hpp>
 #include <boost/accumulators/statistics_fwd.hpp>
 
-#include <boost/statistics/detail/accumulator/statistics/keyword/key.hpp>
-#include <boost/statistics/detail/accumulator/statistics/empirical_distribution_int.hpp>
+#include <boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp>
 
 namespace boost {
 namespace statistics{
 namespace detail{
-namespace accumulator{
+namespace empirical_distribution{
 
 namespace impl{
 
         template<typename Int,bool Cum>
- class count_int : public boost::accumulators::accumulator_base{
+ class count : public boost::accumulators::accumulator_base{
                 typedef std::less<Int> comp_;
                 typedef std::size_t size_;
         typedef boost::accumulators::dont_care dont_care_;
@@ -43,16 +42,17 @@
 
                 typedef size_ result_type;
 
- count_int(dont_care_){}
+ count(dont_care_){}
 
                 void operator()(dont_care_){}
                 
         template<typename Args>
         result_type result(const Args& args)const{
- Int key = args[statistics::detail::accumulator::keyword::key];
+ Int key
+ = args[boost::accumulators::sample];
                 typedef typename boost::mpl::bool_<Cum> is_cum_;
- typedef statistics::detail::accumulator
- ::tag::empirical_distribution_int tag_;
+ typedef statistics::detail::empirical_distribution
+ ::tag::ordered_sample tag_;
                 return this->result_impl(
                     boost::accumulators::extract_result<tag_>(
                         args[boost::accumulators::accumulator]
@@ -106,22 +106,23 @@
 namespace tag
 {
         template<bool Cum>
- struct count_int
+ struct count
       : boost::accumulators::depends_on<
- statistics::detail::accumulator::tag::empirical_distribution_int
+ statistics::detail
+ ::empirical_distribution::tag::ordered_sample
>
     {
 
 // TODO compile error
-// typedef statistics::detail::accumulator::
-// impl::count_int<boost::mpl::_1,Cum> impl;
+// typedef statistics::detail::accumulator::empirical_distribution
+// impl::count<boost::mpl::_1,Cum> impl;
 // must explicitly have:
         
         struct impl{
                 template<typename Int,typename W>
             struct apply{
- typedef statistics::detail::accumulator::
- impl::count_int<Int,Cum> type;
+ typedef statistics::detail::empirical_distribution
+ ::impl::count<Int,Cum> type;
             };
         };
     };
@@ -133,23 +134,24 @@
           template<bool Cum,typename AccumulatorSet,typename Int>
         typename boost::mpl::apply<
                 AccumulatorSet,
- boost::statistics::detail::accumulator::tag::count_int<Cum>
+ boost::statistics::detail
+ ::empirical_distribution::tag::count<Cum>
>::type::result_type
- count_int(AccumulatorSet const& acc,const Int& i)
+ count(AccumulatorSet const& acc,const Int& i)
     {
             typedef boost::statistics::detail
- ::accumulator::tag::count_int<Cum> the_tag;
+ ::empirical_distribution::tag::count<Cum> the_tag;
         return boost::accumulators::extract_result<the_tag>(
             acc,
- (boost::statistics::detail::accumulator::keyword::key = i)
+ (boost::accumulators::sample = i)
         );
           }
 
 }
 
-using extract::count_int;
+using extract::count;
 
-}// accumulator
+}// empirical_distribution
 }// detail
 }// statistics
 }// boost

Copied: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp (from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/frequency_int.hpp)
==============================================================================
--- /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/frequency_int.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -1,12 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
-// accumulator::statistics::frequency_int.hpp //
+// accumulator::statistics::empirical_distribution::frequency.hpp //
 // //
 // Copyright 2010 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_FREQUENCY_INT_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_FREQUENCY_INT_HPP_ER_2010
+#ifndef BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_FREQUENCY_HPP_ER_2010
+#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_FREQUENCY_HPP_ER_2010
 #include <iostream> // tmp
 
 #include <boost/mpl/placeholders.hpp>
@@ -23,26 +23,25 @@
 #include <boost/accumulators/statistics_fwd.hpp>
 #include <boost/accumulators/statistics/count.hpp>
 
-#include <boost/statistics/detail/accumulator/statistics/keyword/key.hpp>
-#include <boost/statistics/detail/accumulator/statistics/count_int.hpp>
+#include <boost/statistics/detail/non_parametric/empirical_distribution/count.hpp>
 
 namespace boost {
 namespace statistics{
 namespace detail{
-namespace accumulator{
+namespace empirical_distribution{
 
 namespace impl{
 
- // Same as count_int but expressed as a percentage of the sample size
+ // Same as count but expressed as a percentage of the sample size
         template<typename T,typename Int,bool Cum>
- class frequency_int : public boost::accumulators::accumulator_base{
+ class frequency : public boost::accumulators::accumulator_base{
             
                 typedef std::size_t size_;
         typedef boost::accumulators::dont_care dont_care_;
 
         public:
 
- frequency_int(dont_care_){}
+ frequency(dont_care_){}
 
                 typedef size_ size_type;
                 typedef T result_type;
@@ -57,10 +56,10 @@
             typedef typename bind_::type cref_;
                 typedef boost::accumulators::tag::count tag_n_;
             cref_ acc = args[boost::accumulators::accumulator];
- size_ i = boost::statistics::detail::accumulator
- ::extract::count_int<Cum>(
+ size_ i = boost::statistics::detail::empirical_distribution
+ ::extract::count<Cum>(
                             acc,
- args[statistics::detail::accumulator::keyword::key]
+ args[boost::accumulators::sample]
                     );
                         size_ n = boost::accumulators::extract_result<tag_n_>( acc );
             return static_cast<T>(i)/static_cast<T>(n);
@@ -72,20 +71,20 @@
 namespace tag
 {
         template<bool Cum,typename T = double>
- struct frequency_int
+ struct frequency
       : boost::accumulators::depends_on<
- statistics::detail::accumulator::tag::count_int<Cum>,
+ statistics::detail::empirical_distribution::tag::count<Cum>,
         boost::accumulators::tag::count
>
     {
               // typedef statistics::detail::accumulator::
- // impl::frequency_int<T,boost::mpl::_1,Cum> impl;
+ // impl::frequency<T,boost::mpl::_1,Cum> impl;
         
         struct impl{
                 template<typename Int,typename W>
             struct apply{
- typedef statistics::detail::accumulator
- ::impl::frequency_int<T,Int,Cum> type;
+ typedef statistics::detail::empirical_distribution
+ ::impl::frequency<T,Int,Cum> type;
             };
         };
     };
@@ -97,24 +96,25 @@
           template<bool Cum,typename AccumulatorSet,typename Int>
         typename boost::mpl::apply<
                 AccumulatorSet,
- boost::statistics::detail::accumulator::tag::frequency_int<Cum>
+ boost::statistics::detail
+ ::empirical_distribution::tag::frequency<Cum>
>::type::result_type
- frequency_int(AccumulatorSet const& acc,const Int& i)
+ frequency(AccumulatorSet const& acc,const Int& i)
     {
             typedef double T;
- typedef boost::statistics::detail::accumulator::
- tag::frequency_int<Cum,T> the_tag;
+ typedef boost::statistics::detail::empirical_distribution
+ ::tag::frequency<Cum,T> the_tag;
         return boost::accumulators::extract_result<the_tag>(
             acc,
- (boost::statistics::detail::accumulator::keyword::key = i)
+ (boost::accumulators::sample = i)
         );
           }
 
 }
 
-using extract::frequency_int;
+using extract::frequency;
 
-}// accumulator
+}// empirical_distribution
 }// detail
 }// statistics
 }// boost

Copied: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/keyword/key.hpp (from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/keyword/key.hpp)
==============================================================================
--- /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/keyword/key.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/keyword/key.hpp 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -1,20 +1,20 @@
 ///////////////////////////////////////////////////////////////////////////////
-// statistics::detail::accumulator::keyword::key.hpp //
+// statistics::accumulator::empirical_distribution::keyword::key.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_KEY_HPP_2010
-#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_KEYWORD_KEY_HPP_2010
+#ifndef BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_KEYWORD_KEY_HPP_2010
+#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_KEYWORD_KEY_HPP_2010
 #include <boost/parameter/name.hpp>
 #include <boost/parameter/keyword.hpp>
-#include <boost/statistics/detail/accumulator/statistics/tag/key.hpp>
+#include <boost/statistics/detail/non_parametric/empirical_distribution/tag/key.hpp>
 
 namespace boost {
 namespace statistics{
 namespace detail{
-namespace accumulator{
+namespace empirical_distribution{
 namespace keyword{
     namespace
     {
@@ -22,7 +22,7 @@
             = boost::parameter::keyword<tag::key>::get();
     }
 }// keyword
-}// accumulator
+}// empirical_distribution
 }// detail
 }// statistics
 }// boost

Copied: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp (from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/empirical_distribution_int.hpp)
==============================================================================
--- /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/empirical_distribution_int.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/ordered_sample.hpp 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -1,12 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
-// accumulator::statistics::empirical_distribution_int.hpp //
+// accumulator::statistics::empirical_distribution::ordered_sample.hpp //
 // //
 // Copyright 2010 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_EMPIRICAL_DISTRIBUTION_INT_HPP_ER_2010
-#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_EMPIRICAL_DISTRIBUTION_INT_HPP_ER_2010
+#ifndef BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_ORDERED_SAMPLE_HPP_ER_2010
+#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_ORDERED_SAMPLE_HPP_ER_2010
 #include <map>
 #include <functional>
 
@@ -20,17 +20,15 @@
 #include <boost/accumulators/framework/depends_on.hpp>
 #include <boost/accumulators/statistics_fwd.hpp>
 
-#include <boost/statistics/detail/accumulator/statistics/keyword/key.hpp>
-
 namespace boost {
 namespace statistics{
 namespace detail{
-namespace accumulator{
+namespace empirical_distribution{
 
 namespace impl{
 
         template<typename Int>
- class empirical_distribution_int
+ class ordered_sample
                     : public boost::accumulators::accumulator_base{
                 typedef std::less<Int> comp_;
                 typedef std::size_t size_;
@@ -44,7 +42,7 @@
                 // non-const because map::operator[](key) returns a non-const
                 typedef map_& result_type;
 
- empirical_distribution_int(dont_care_){}
+ ordered_sample(dont_care_){}
 
                 template<typename Args>
                 void operator()(const Args& args){
@@ -64,11 +62,11 @@
 
 namespace tag
 {
- struct empirical_distribution_int
+ struct ordered_sample
       : boost::accumulators::depends_on<>
     {
- typedef statistics::detail::accumulator::
- impl::empirical_distribution_int<boost::mpl::_1> impl;
+ typedef statistics::detail::empirical_distribution::
+ impl::ordered_sample<boost::mpl::_1> impl;
     };
 }
 
@@ -78,20 +76,21 @@
           template<typename AccumulatorSet>
         typename boost::mpl::apply<
                 AccumulatorSet,
- boost::statistics::detail::accumulator::tag::empirical_distribution_int
+ boost::statistics::detail::empirical_distribution
+ ::tag::ordered_sample
>::type::result_type
- empirical_distribution_int(AccumulatorSet const& acc)
+ ordered_sample(AccumulatorSet const& acc)
     {
- typedef boost::statistics::detail::accumulator::
- tag::empirical_distribution_int the_tag;
+ typedef boost::statistics::detail::empirical_distribution
+ ::tag::ordered_sample the_tag;
         return boost::accumulators::extract_result<the_tag>(acc);
           }
 
 }
 
-using extract::empirical_distribution_int;
+using extract::ordered_sample;
 
-}// accumulator
+}// empirical_distribution
 }// detail
 }// statistics
 }// boost

Copied: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/tag/key.hpp (from r58994, /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/tag/key.hpp)
==============================================================================
--- /sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/tag/key.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/empirical_distribution/tag/key.hpp 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -1,23 +1,23 @@
 ///////////////////////////////////////////////////////////////////////////////
-// statistics::detail::accumulator::tag::key.hpp //
+// statistics::accumulator::empirical_distribution::tag::key.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_TAG_KEY_HPP_2010
-#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_TAG_KEY_HPP_2010
+#ifndef BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_TAG_KEY_HPP_2010
+#define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_TAG_KEY_HPP_2010
 #include <boost/parameter/name.hpp>
 #include <boost/parameter/keyword.hpp>
 
 namespace boost {
 namespace statistics{
 namespace detail{
-namespace accumulator{
+namespace empirical_distribution{
 namespace tag{
     struct key{};
 }// tag
-}// accumulator
+}// empirical_distribution
 }// detail
 }// statistics
 }// boost

Modified: sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp
==============================================================================
--- sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp (original)
+++ sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/kolmogorov_smirnov/statistic.hpp 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -9,13 +9,20 @@
 #ifndef BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_KOLMOGOROV_SMIRNOV_STATISTIC_HPP_ER_2009
 #define BOOST_STATISTICS_DETAIL_NON_PARAMETRIC_KOLMOGOROV_SMIRNOV_STATISTIC_HPP_ER_2009
 #include <string>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/void.hpp>
+
+#include <boost/type_traits.hpp>
 #include <boost/format.hpp>
+
 #ifdef BOOST_MSVC
  #include <algorithm>
 #endif
 #ifndef BOOST_MSVC
  #include <ext/algorithm>
 #endif
+
 #include <boost/range.hpp>
 #include <boost/iterator/iterator_traits.hpp>
 
@@ -28,49 +35,73 @@
 namespace non_parametric{
 namespace kolmogorov_smirnov{
 
- // This statistics has to be a applied to a range each elements of which is
- // of type fusion::map and whose (x,cdf(x)) components are identified by
- // key Kx and Kcdf, respectively
- //
- // Warning: ignores combos (don't use it for discrete distributions)
- template<typename T,typename Kx,typename Kcdf>
+ // Computes the kolmogorov_statistic of a range {e[i]:i=1,...,n} where,
+ // given i, the sample value, its cdf and optionally (to allow combos) its
+ // number of occurences in the sample are accessible by calling
+ // boost::fusion::at_key<K>(e), for K = Kx, Kcdf and Kn, respectively.
+ template<
+ typename T,
+ typename Kx,
+ typename Kcdf,
+ typename Kn = boost::mpl::void_,
+ bool has_combos = !boost::is_same<Kn,boost::mpl::void_>::value
+ >
     class statistic{
         typedef Kx key1_;
         typedef Kcdf key2_;
+ typedef Kn key3_;
+
         typedef std::string str_;
+
         public:
     
         typedef std::size_t size_type;
-
         typedef T result_type;
 
+ // Returns the kolmogorov_statistic
+ //
         // Side effect: sorts the range by x
         template<typename It>
         result_type
         operator()(It b,It e)const{
             typedef T val_;
             std::sort(
- b,
+ b,
                 e,
                 less_than()
             );
             
             val_ m1 = static_cast<val_>(0);
- size_type i = 1;
- this->n_ = static_cast<size_type>(
- std::distance(b,e)
- );
+ size_type i = 0;
+ size_type n = 0;
+ if(has_combos){
+ It j = b;
+ while(j!=e){
+ n += boost::fusion::at_key<key3_>(*j);
+ ++j;
+ }
+ }else{
+ n = static_cast<size_type>(
+ std::distance(b,e)
+ );
+ }
 
- while(b<e){
+ while(b!=e){
+ if(has_combos)
+ {
+ i += boost::fusion::at_key<key3_>(*b);
+ }else{
+ ++i;
+ }
                 val_ ecdf = static_cast<val_>(i);
- ecdf /= static_cast<val_>(this->count());
+ ecdf /= static_cast<val_>(n);
                 val_ cdf = boost::fusion::at_key<key2_>(*b);
                 val_ m2 = (cdf > ecdf)?(cdf - ecdf) : (ecdf - cdf);
                 if(m2 > m1){ m1 = m2; }
                 ++b;
- ++i;
             }
             this->s_ = m1;
+ this->n_ = n;
             return m1;
         }
 
@@ -101,9 +132,10 @@
         mutable result_type s_;
         mutable size_type n_;
     };
- template<typename T,typename Kx,typename Kcdf>
+
+ template<typename T,typename Kx,typename Kcdf,typename Kn,bool has_combos>
     const std::string
- statistic<T,Kx,Kcdf>::description_header = "kolmogorov_smirnov(n,s)";
+ statistic<T,Kx,Kcdf,Kn,has_combos>::description_header = "kolmogorov_smirnov(n,s)";
 
 }// kolmogorov_smirnov
 }// non_parametric

Modified: sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/doc/readme.txt
==============================================================================
--- sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/doc/readme.txt (original)
+++ sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/doc/readme.txt 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -13,21 +13,11 @@
 
 [ Overview ]
 
- C++ class for non-parametric estimation.
+ C++ classes for non-parametric estimation.
 
-[ Design ]
+[ Also see ]
 
- The argument(s) passed to a statistic has to be a type that is an instance
- of fusion::map i.e. its elements, say x and y are identified by two keys,
- k1 and k2, respectively.
-
- If the data is not of this type, for example, if x and y are stored in
- separate containers, a combination of zip_iterator and transform_iterator
- can achieve the requirement.
-
- This approach is not less general, but somewhat more straightforward
- than leaving the type unspecified but specifying extractor functions for x
- and y.
+ http://boost-sandbox.sourceforge.net/libs/accumulators/doc/html/index.html
 
 [ Compiler ]
 
@@ -37,14 +27,13 @@
 
     /boost_1_40_0
 
+
 [ History]
 
+ January 14th, 2010.
+ - Added non_parametric/empirical_distribution
+ - Modified non_parametric/kolmogorov_smirnov/statistic.hpp to allow
+ combos
+
     October 11th 2009. First version. Implementation of kolmogorov_smirnov
     transfered from distribution_toolkit
-
-
-
-
-
-
-
\ No newline at end of file

Copied: sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.cpp (from r58994, /sandbox/statistics/detail/accumulator/libs/statistics/detail/example/frequency_int.cpp)
==============================================================================
--- /sandbox/statistics/detail/accumulator/libs/statistics/detail/example/frequency_int.cpp (original)
+++ sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.cpp 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -1,20 +1,24 @@
 ///////////////////////////////////////////////////////////////////////////////
-// accumulator::statistics::frequency_int.cpp //
+// empirical_distribution::frequency_int.cpp //
 // //
-// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Copyright 2010 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) //
 ///////////////////////////////////////////////////////////////////////////////
 #include <vector>
 #include <algorithm>
 
+#include <boost/mpl/int.hpp>
+
 #include <boost/assign/std/vector.hpp>
 #include <boost/format.hpp>
 
 #include <boost/accumulators/accumulators.hpp>
 #include <boost/accumulators/statistics/stats.hpp>
 
-#include <boost/statistics/detail/accumulator/statistics/frequency_int.hpp>
+#include <boost/statistics/detail/non_parametric/empirical_distribution/frequency.hpp>
+#include <boost/statistics/detail/non_parametric/kolmogorov_smirnov/frequency_adaptor.hpp>
+#include <libs/statistics/detail/non_parametric/example/frequency_int.h>
 
 void example_frequency_int(std::ostream& os)
 {
@@ -33,12 +37,10 @@
         }
     } // 3, 3, 3, 2, 2, 1
 
- namespace accumulator = boost::statistics::detail::accumulator;
-
- typedef accumulator::tag::count_int<false> tag_count_;
- typedef accumulator::tag::frequency_int<false> tag_freq_;
- typedef accumulator::tag::frequency_int<true> tag_cum_freq_;
- typedef accumulator::tag::empirical_distribution_int tag_emp_;
+ namespace ed = boost::statistics::detail::empirical_distribution;
+
+ typedef ed::tag::frequency<false> tag_freq_;
+ typedef ed::tag::frequency<true> tag_cum_freq_;
     
         typedef boost::accumulators::accumulator_set<
             int_,
@@ -56,18 +58,18 @@
         os << "empirical {(pdf,cdf):i=1,...,n} : " << std::endl;
     int sum = 0;
     for(int i = 0; i<n; i++){
- BOOST_ASSERT( accumulator::extract::count_int<false>(acc,i+1) == i+1);
+ BOOST_ASSERT( ed::extract::count<false>(acc,i+1) == i+1);
         sum += i+1;
- BOOST_ASSERT( accumulator::extract::count_int<true>(acc,i+1) == sum);
+ BOOST_ASSERT( ed::extract::count<true>(acc,i+1) == sum);
 
                 boost::format f("(%1%,%2%)");
- double freq = accumulator::extract::frequency_int<false>(acc,i+1);
- double cum_freq = accumulator::extract::frequency_int<true>(acc,i+1);
+ double freq = ed::extract::frequency<false>(acc,i+1);
+ double cum_freq = ed::extract::frequency<true>(acc,i+1);
         //f % freq % cum_freq;
                 //os << f << std::endl;
         os << '(' << freq << ',' << cum_freq << ')' << std::endl;
- }
 
+ }
 
         os << "<-" << std::endl;
 }
\ No newline at end of file

Copied: sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.h (from r58994, /sandbox/statistics/detail/accumulator/libs/statistics/detail/example/frequency_int.h)
==============================================================================
--- /sandbox/statistics/detail/accumulator/libs/statistics/detail/example/frequency_int.h (original)
+++ sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/example/frequency_int.h 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -1,12 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
-// accumulator::statistics::frequency_int.h //
+// empirical_distribution::frequency_int.h //
 // //
-// Copyright 2009 Erwann Rogard. Distributed under the Boost //
+// Copyright 2010 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 LIBS_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_FREQUENCY_INT_HPP_ER_2009
-#define LIBS_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_FREQUENCY_INT_HPP_ER_2009
+#ifndef LIBS_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_FREQUENCY_INT_HPP_ER_2010
+#define LIBS_STATISTICS_DETAIL_NON_PARAMETRIC_EMPIRICAL_DISTRIBUTION_FREQUENCY_INT_HPP_ER_2010
 
 void example_frequency_int(std::ostream& os);
 

Copied: sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/src/main.cpp (from r58993, /sandbox/statistics/detail/accumulator/libs/statistics/detail/src/main.cpp)
==============================================================================
--- /sandbox/statistics/detail/accumulator/libs/statistics/detail/src/main.cpp (original)
+++ sandbox/statistics/non_parametric/libs/statistics/detail/non_parametric/src/main.cpp 2010-01-14 21:41:14 EST (Thu, 14 Jan 2010)
@@ -1,10 +1,12 @@
 #include <iostream>
-#include <libs/statistics/detail/example/frequency_int.h>
+
+#include <libs/statistics/detail/non_parametric/example/frequency_int.h>
+#include <libs/statistics/detail/non_parametric/example/kolmogorov_smirnov.h>
 
 int main()
 {
         example_frequency_int(std::cout);
-
+ example_kolmogorov_smirnov(std::cout);
 
     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