$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r56498 - in sandbox/statistics/adaptive_rejection_sampling: boost/ars boost/ars/detail boost/ars/functional boost/ars/test libs/ars libs/ars/doc libs/ars/example
From: erwann.rogard_at_[hidden]
Date: 2009-09-30 23:39:26
Author: e_r
Date: 2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
New Revision: 56498
URL: http://svn.boost.org/trac/boost/changeset/56498
Log:
m
Text files modified: 
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/constant.hpp                         |    13 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/area.hpp                      |    12 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/data.hpp                      |    13 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/tangent_intersection.hpp      |    13 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/error.hpp                            |    15 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/function_signature.hpp               |    13 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/functional/standard_distribution.hpp |    49 +++++--------                           
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/include.hpp                          |     4                                         
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/parameter.hpp                        |    12 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/point.hpp                            |    14 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/proposal_sampler.hpp                 |    12 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/sampler.hpp                          |    12 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/search_reflection.hpp                |    12 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/gamma_distribution.hpp          |    29 +++++--                                 
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/normal_distribution.hpp         |    26 ++++--                                  
   sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/standard_distribution.hpp       |   137 +++++++++++++++++++++------------------ 
   sandbox/statistics/adaptive_rejection_sampling/libs/ars/doc/readme.txt                        |   130 +++++++++++++++----------------------   
   sandbox/statistics/adaptive_rejection_sampling/libs/ars/example/search_reflection.cpp         |    13 ++-                                     
   sandbox/statistics/adaptive_rejection_sampling/libs/ars/example/standard_distribution.cpp     |    88 ++++++++++++++++---------               
   sandbox/statistics/adaptive_rejection_sampling/libs/ars/main.cpp                              |     2                                         
   20 files changed, 344 insertions(+), 275 deletions(-)
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/constant.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/constant.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/constant.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,8 +5,8 @@
 //  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_ARS_CONSTANT_HPP_ER_2009
-#define BOOST_ARS_CONSTANT_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_CONSTANT_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_CONSTANT_HPP_ER_2009
 #include <limits>
 #include <iostream>
 #include <boost/numeric/conversion/converter.hpp>
@@ -14,6 +14,8 @@
 #include <boost/type_traits.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
     template<typename T>
@@ -48,6 +50,9 @@
     template<typename T>
     T constant<T>::sig_nan_ = std::numeric_limits<T>::signaling_NaN();
 
-}
-}
+}// ars
+}// detail
+}// statistics
+}// boost
+
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/area.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/area.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/area.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,12 +5,14 @@
 //  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_ARS_DETAIL_AREA_HPP_ER_2009
-#define BOOST_ARS_DETAIL_AREA_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_DETAIL_AREA_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_DETAIL_AREA_HPP_ER_2009
 #include <stdexcept>
 #include <boost/ars/detail/data.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
 // Area of the exponential tangent between two
@@ -81,7 +83,9 @@
 }
 
 
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/data.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/data.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/data.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,15 +5,18 @@
 //  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_ARS_DETAIL_DATA_HPP_ER_2009
-#define BOOST_ARS_DETAIL_DATA_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_DETAIL_DATA_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_DETAIL_DATA_HPP_ER_2009
 #include <boost/function.hpp>
 #include <boost/math/tools/precision.hpp>
 #include <boost/ars/constant.hpp>
 #include <boost/ars/point.hpp>
 #include <boost/ars/detail/tangent_intersection.hpp>
 #include <boost/ars/error.hpp>
+
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
 template<typename T>
@@ -79,7 +82,9 @@
 };
 
 
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/tangent_intersection.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/tangent_intersection.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/detail/tangent_intersection.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,11 +5,14 @@
 //  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_ARS_DETAIL_TANGENT_INTERSECTION_HPP_ER_2009
-#define BOOST_ARS_DETAIL_TANGENT_INTERSECTION_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_DETAIL_TANGENT_INTERSECTION_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_DETAIL_TANGENT_INTERSECTION_HPP_ER_2009
 #include <boost/ars/constant.hpp>
 #include <boost/ars/point.hpp>
+
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
         //    x1  x2  x3            point abscissae
@@ -78,7 +81,9 @@
     return (a.cum_sum_ < b.cum_sum_);
 }
 
-}
-}
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/error.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/error.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/error.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,12 +5,15 @@
 //  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_ARS_ERROR_HPP_ER_2009
-#define BOOST_ARS_ERROR_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_ERROR_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_ERROR_HPP_ER_2009
 #include <stdexcept>
 #include <sstream>
 #include <boost/format.hpp>
+
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
         class exception : public std::runtime_error{
@@ -73,8 +76,10 @@
 
         };
 
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 
-#endif // BOOST_ARS_ERROR_HPP_ER_2009
+#endif // BOOST_STATISTICS_DETAIL_ARS_ERROR_HPP_ER_2009
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/function_signature.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/function_signature.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/function_signature.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,11 +5,13 @@
 //  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_ARS_FUNCTION_SIGNATURE_HPP_ER_2009
-#define BOOST_ARS_FUNCTION_SIGNATURE_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_FUNCTION_SIGNATURE_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_FUNCTION_SIGNATURE_HPP_ER_2009
 #include <boost/mpl/identity.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
     // This is the function signature required by the ars sampler.
@@ -20,7 +22,10 @@
     struct function_signature : mpl::identity<
         void(const T&,T&,T&)
     >{};
-}
-}
+
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/functional/standard_distribution.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/functional/standard_distribution.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/functional/standard_distribution.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,31 +5,16 @@
 //  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_ARS_FUNCTIONAL_STANDARD_DISTRIBUTION_HPP_ER_2009
-#define BOOST_ARS_FUNCTIONAL_STANDARD_DISTRIBUTION_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_FUNCTIONAL_STANDARD_DISTRIBUTION_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_FUNCTIONAL_STANDARD_DISTRIBUTION_HPP_ER_2009
 #include <boost/type_traits.hpp>
 #include <boost/call_traits.hpp>
+#include <boost/statistics/detail/distribution_toolkit/unscope/log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/unscope/derivative_log_unnormalized_pdf.hpp>
 
 namespace boost{
-
-namespace math{
-
-    template<typename D>
-    typename D::value_type  
-    log_unnormalized_pdf( //Fwd Declare
-        const D& d,
-        const typename D::value_type& x
-    );
-
-    template<typename D>
-    typename D::value_type  
-    derivative_log_unnormalized_pdf( //Fwd Declare
-        const D& d,
-        const typename D::value_type& x
-    );
-
-}
-
+namespace statistics{
+namespace detail{
 namespace ars{
 namespace functional{
 
@@ -72,13 +57,16 @@
         const value_type& x,
         value_type& log_pdf,
         value_type& dlog_pdf
-    ){
-        //math::log_unnormalized_pdf
-        log_pdf = log_unnormalized_pdf(
-            this->distribution(),x);
+    )const{
+        log_pdf = boost::log_unnormalized_pdf(
+            this->distribution(),
+            x
+        );
             
-        dlog_pdf = derivative_log_unnormalized_pdf(
-            this->distribution(),x);
+        dlog_pdf = boost::derivative_log_unnormalized_pdf(
+            this->distribution(),
+            x
+        );
     }
 
     typename call_traits<D>::const_reference distribution()const{
@@ -91,7 +79,10 @@
 };
 
 }
-}
-}
+}// ars
+}// detail
+}// statistics
+}// boost
+
 #endif
 
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/include.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/include.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/include.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,8 +5,8 @@
 //  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_ARS_INCLUDE_HPP_ER_2009
-#define BOOST_ARS_INCLUDE_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_INCLUDE_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_INCLUDE_HPP_ER_2009
 
 #include <boost/ars/constant.hpp>
 #include <boost/ars/proposal_sampler.hpp>
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/parameter.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/parameter.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/parameter.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,12 +5,14 @@
 //  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_ARS_PARAMETER_HPP_ER_2009
-#define BOOST_ARS_PARAMETER_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_PARAMETER_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_PARAMETER_HPP_ER_2009
 #include <boost/math/tools/precision.hpp>
 #include <boost/ars/constant.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
 // These parameters are used as defaults, but they can be changed at
@@ -38,7 +40,9 @@
 template<typename T> std::size_t parameter<T>::reserve = 5;
 template<typename T> unsigned parameter<T>::n_max_reject = 1e2;
 
-}
-}
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/point.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/point.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/point.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,12 +5,14 @@
 //  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_ARS_POINT_HPP_ER_2009
-#define BOOST_ARS_POINT_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_POINT_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_POINT_HPP_ER_2009
 #include <ostream>
 #include <boost/ars/constant.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
 // Given an unnormalized density f, this class is a representation for (x,y,dy), 
@@ -95,7 +97,9 @@
     return a.y() + (x-a.x()) * slope;
 }
 
-}
-}
+}// ars
+}// detail
+}// statistics
+}// boost
 
-#endif // BOOST_ARS_POINT_HPP_ER_2009
+#endif // BOOST_STATISTICS_DETAIL_ARS_POINT_HPP_ER_2009
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/proposal_sampler.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/proposal_sampler.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/proposal_sampler.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,8 +5,8 @@
 //  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_ARS_PROPOSAL_SAMPLER_HPP_ER_2009
-#define BOOST_ARS_PROPOSAL_SAMPLER_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_PROPOSAL_SAMPLER_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_PROPOSAL_SAMPLER_HPP_ER_2009
 #include <cmath>
 #include <vector>
 #include <iostream> //TODO needed?
@@ -45,6 +45,8 @@
 #include <boost/ars/detail/area.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
 // The job of this class is to maintain an approximation to the cumulative 
@@ -884,8 +886,10 @@
 }
 
 
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
 
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/sampler.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/sampler.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/sampler.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,12 +5,14 @@
 //  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_ARS_SAMPLER_HPP_ER_2009
-#define BOOST_ARS_SAMPLER_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_SAMPLER_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_SAMPLER_HPP_ER_2009
 #include <boost/ars/error.hpp>
 #include <boost/ars/proposal_sampler.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
 // This class adds a rejection steop to proposal_sampler 
@@ -62,7 +64,9 @@
 };
 
 
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif 
\ No newline at end of file
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/search_reflection.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/search_reflection.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/search_reflection.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,8 +5,8 @@
 //  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_ARS_SEARCH_REFLECTION_HPP_ER_2009
-#define BOOST_ARS_SEARCH_REFLECTION_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_SEARCH_REFLECTION_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_SEARCH_REFLECTION_HPP_ER_2009
 #include <string>
 #include <boost/format.hpp>
 #include <boost/function.hpp>
@@ -17,6 +17,8 @@
 #include <boost/ars/functional/standard_distribution.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 
 // This function searches by reflection for initial starting points 
@@ -154,7 +156,9 @@
 }
 
 
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/gamma_distribution.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/gamma_distribution.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/gamma_distribution.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,15 +5,18 @@
 //  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_ARS_TEST_GAMMA_DISTRIBUTION_HPP_ER_2009
-#define BOOST_ARS_TEST_GAMMA_DISTRIBUTION_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_TEST_GAMMA_DISTRIBUTION_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_TEST_GAMMA_DISTRIBUTION_HPP_ER_2009
 #include <iostream>
 #include <string>
 #include <boost/random/mersenne_twister.hpp>
-#include <boost/standard_distribution/distributions/gamma.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/gamma/include.hpp>
+#include <boost/statistics/detail/distribution_toolkit/data/generate_n_sample_cdf.hpp>
 #include <boost/ars/test/standard_distribution.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 namespace test{
 
@@ -24,8 +27,10 @@
     T scale,
     T init_0, // must be >0 and < init_1
     T init_1, // must be > mode = (m-1) * theta
-    unsigned draw_n,
-    unsigned repeat_n,
+    unsigned n1,    // 1e2
+    unsigned n2,    // 10
+    unsigned n3,    // 1
+    unsigned n4,    // 10
     unsigned n_max_reject,
     std::ostream& out
 )
@@ -46,23 +51,27 @@
 
     const val_ inf_ = const_::inf_;
 
-    boost::ars::test::standard_distribution(
+    ars::test::standard_distribution(
         mdist,
         static_cast<val_>(0),   // x_min
         inf_,                   // x_max
         init_0,                 
         init_1, 
         urng,   
+        n1,    // 1e2
+        n2,    // 10
+        n3,    // 1
+        n4,    // 10
         n_max_reject,
-        draw_n,
-        repeat_n,
         out
     );
 }
 
 }//test
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/normal_distribution.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/normal_distribution.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/normal_distribution.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,15 +5,17 @@
 //  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_ARS_TEST_NORMAL_DISTRIBUTION_HPP_ER_2009
-#define BOOST_ARS_TEST_NORMAL_DISTRIBUTION_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_TEST_NORMAL_DISTRIBUTION_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_TEST_NORMAL_DISTRIBUTION_HPP_ER_2009
 #include <iostream>
 #include <string>
 #include <boost/random/mersenne_twister.hpp>
-#include <boost/standard_distribution/distributions/normal.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/normal/include.hpp>
 #include <boost/ars/test/standard_distribution.hpp>
 
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 namespace test{
 
@@ -24,8 +26,10 @@
     T sigma,
     T init_0, //must be < mu
     T init_1, //must be > mu
-    unsigned draw_n,
-    unsigned repeat_n,
+    unsigned n1,    // 1e2
+    unsigned n2,    // 10
+    unsigned n3,    // 1
+    unsigned n4,    // 10
     unsigned n_max_reject,
     std::ostream& out
 )
@@ -53,15 +57,19 @@
         init_0,
         init_1,
         urng,
+        n1,    
+        n2,    
+        n3,    
+        n4,   
         n_max_reject,
-        draw_n,
-        repeat_n,
         out
     );
 }
 
 }//test
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/standard_distribution.hpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/standard_distribution.hpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/boost/ars/test/standard_distribution.hpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -5,8 +5,8 @@
 //  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_ARS_TEST_STANDARD_DISTRIBUTION_HPP_ER_2009
-#define BOOST_ARS_TEST_STANDARD_DISTRIBUTION_HPP_ER_2009
+#ifndef BOOST_STATISTICS_DETAIL_ARS_TEST_STANDARD_DISTRIBUTION_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_ARS_TEST_STANDARD_DISTRIBUTION_HPP_ER_2009
 
 #include <iostream>
 #include <list>
@@ -24,11 +24,6 @@
 #include <boost/iterator/counting_iterator.hpp>
 #include <boost/assign/std/vector.hpp>
 
-//#include <boost/math/distributions/unnormalized_pdf/include.hpp>
-//#include <boost/math/distributions/algorithm/transform.hpp>
-
-#include <boost/non_param/algorithm/kolmogorov_smirnov_distance.hpp>
-
 #include <boost/random/mersenne_twister.hpp>
 #include <boost/random/variate_generator.hpp>
 #include <boost/random/normal_distribution.hpp>
@@ -39,14 +34,16 @@
 #include <boost/ars/proposal_sampler.hpp>
 #include <boost/ars/sampler.hpp>
 
+#include <boost/statistics/detail/distribution_toolkit/data/sample_cdf.hpp>
+
 namespace boost{
+namespace statistics{
+namespace detail{
 namespace ars{
 namespace test{
 
-// This function draws repeat_n times by increments of draw_n
-// and ouputs the corresponding kolmogorov_distance for distribution D
-// and the number of rejections. D is a standard distribution
-// such as math::normal_distribution
+// This function draws samples from distribution D, and outputs the 
+// kolmogorov-smirnov statistics and the average number of rejections per draws.
 template<typename D,typename U>
 void standard_distribution(
     const D& mdist, //e.g. D == math::normal_distribution
@@ -55,11 +52,17 @@
     typename D::value_type init_0,
     typename D::value_type init_1,
     U& urng,
+    unsigned n1,   // # loops
+    unsigned n2,   // # subsamples per loop  
+    unsigned n3,   // size of subsample 
+    unsigned n4,   // At each loop, n2 *= n4
     unsigned n_max_reject,
-    unsigned draw_n,
-    unsigned repeat_n,
-    std::ostream& out
+    std::ostream& os
 ){
+
+    // The ars is re-initialized after each n3 sample.
+    // n3 * n4 is the total size of the sample over which a KS is computed
+
     using namespace boost;
     using namespace math;
     using namespace assign;
@@ -67,67 +70,75 @@
     typedef std::runtime_error                              err_;
     typedef typename D::value_type                          val_;
     typedef std::vector<val_>                               vals_;
-    typedef std::vector<unsigned>                           ints_;
 
     typedef ars::functional::standard_distribution<D>       fun_t;
     typedef ars::proposal_sampler<val_,std::vector>         ps_;
-    typedef ars::sampler<ps_>                               s_;
-    typedef random::ref_distribution<s_&>                   ref_s_;
-    typedef variate_generator<U&,ref_s_>                    vg_;
-    //typedef boost::random::kolmogorov_smirnov<D>            check_dist_t;
-
-    s_ s;
-    s.set_function(x_min, x_max, fun_t(mdist));
-
-    vals_ draws; draws.reserve( repeat_n * draw_n );
-    vals_ kss; kss.reserve(repeat_n);
-    ints_ n_rejects; n_rejects.reserve(repeat_n);
+    typedef ars::sampler<ps_>                               ars_;
+    typedef random::ref_distribution<ars_&>                 ref_ars_;
+    typedef variate_generator<U&,ref_ars_>                  vg_ars_;
+
+    typedef statistics::detail::distribution_toolkit::sample_cdf<val_> sc_;
+
+    ars_ ars;
+    ars.set_function(x_min, x_max, fun_t(mdist));
+
+    sc_ sc;
+
+    {
+        format f(
+            "ars initialized every %1% with init_0 = %2% and init_1 = %3%"
+        );
+        f%n3%init_0%init_1;
+        os << f.str() << std::endl;
+        os << "(Kolmogorov-statistic, # rejections per draw): " << std::endl;
+    }
+    long unsigned n_reject;
     try{
-        for(unsigned i = 0; i<repeat_n; i++){
-            try{
-                s.initialize(init_0,init_1);
-                vg_ vg(urng,ref_s_(s)); 
-                std::generate_n(std::back_inserter(draws),draw_n,vg);
-                // Without ref_s_, n would be reset to 0
-                unsigned n = (
-                    (vg.distribution()).distribution()
-                ).n_reject();
-                val_ e = non_param::kolmogorov_smirnov_distance(
-                    mdist,
-                    boost::begin(draws),
-                    boost::end(draws)
-                );
-                kss.push_back(e);
-                n_rejects.push_back(n);
-            }catch(std::exception& e){
-                format f("at i = %1% : %2%"); f % i % e.what();
-                throw std::runtime_error(f.str());
+        for(unsigned i1 = 0; i1<n1; i1++){
+            sc.clear();
+            n_reject = 0;
+            for(unsigned i2 = 0; i2<n2; i2++){
+                try{
+                    ars.initialize(init_0,init_1);
+                    vg_ars_ vg_ars(urng,ref_ars_(ars)); 
+                    boost::generate_n(
+                        sc,
+                        n3,
+                        vg_ars,
+                        mdist
+                    );
+                    // Withos ref_s_, n would be reset to 0
+                    n_reject += (
+                        (vg_ars.distribution()).distribution()
+                    ).n_reject();
+                }catch(std::exception& e){
+                    format f("at i1 = %1%, i2 = %2% : %3%"); 
+                    f % i1 % i2 % e.what();
+                    throw std::runtime_error(f.str());
+                }
             }
+            val_ rate 
+                = static_cast<val_>(n_reject)/static_cast<val_>(n3*n2);
+            os 
+                << '(' 
+                << sc
+                << ','
+                << rate 
+                << ')'
+                << std::endl;
+            n2 *= n4;
         }
     }catch(std::exception& e)
     {
         std::cerr << e.what() << std::endl;
     }
-    format f("init_0 = %1%, init_1 = %2%, by increments of n = %3%, ");
-    f % init_0 % init_1 % draw_n;
-    out << f.str() << std::endl;
-    out << "KS distance : ";
-    copy(
-        begin(kss),
-        end(kss),
-        std::ostream_iterator<val_>(out," ")
-    );
-    out << std::endl << "n_reject : ";
-    copy(
-        begin(n_rejects),
-        end(n_rejects),
-        std::ostream_iterator<val_>(out," ")
-    );
-    out << std::endl;
+    os << std::endl;
 }
 
 }//test
-}//ars
-}//boost
+}// ars
+}// detail
+}// statistics
+}// boost
 
 #endif
Modified: sandbox/statistics/adaptive_rejection_sampling/libs/ars/doc/readme.txt
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/libs/ars/doc/readme.txt	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/libs/ars/doc/readme.txt	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -1,5 +1,5 @@
 //////////////////////////////////////////////////////////////////////////////
-// ars::doc::readme                                       		    //
+// ars::doc::readme                                                         //
 //                                                                          //
 //  (C) Copyright 2009 Erwann Rogard                                        //
 //  Use, modification and distribution are subject to the                   //
@@ -27,12 +27,13 @@
 
 boost_1_39_0
 
+
 [ History ]
 
-July 2009 : Current version
-March 2009 : 
-sandbox/conditionally_specified_distribution/adaptive_rejection_sampling is 
-now deprecated.
+Sept    2009 : standard_distribution.hpp modified due to changes described in
+ sandbox/distribution_toolkit's history.
+July    2009 : Previous package superseded by adaptive_rejection_sampling
+March   2009 : Conditionally_specified_distribution/adaptive_rejection_sampling 
 
 [Artiles]
 
@@ -86,76 +87,53 @@
 Here's the output from main.cpp :
 
 [Session started at 2009-07-24 20:48:28 -0400.]
--> example_standard_distribution 
-Gamma(3,1) : init_0 = 102, init_1 = 102.01, by increments of n = 1, 
-KS distance : 0.899296 0.399296 0.565963 0.649296 0.499296 0.399296 0.327868 
-0.29257 0.232629 0.26757 0.303933 0.250903 0.282954 0.26833 0.225473 0.187973 
-0.20242 0.225296 0.245764 0.214185  
-n_reject : 3 2 2 2 2 2 1 3 2 2 5 3 2 3 2 2 4 3 2 2 
-
-Gamma(3,1) : init_0 = 2.01, init_1 = 2.02, by increments of n = 1, 
-KS distance : 0.905859 0.405859 0.572525 0.655859 0.505859 0.572525 0.620144 
-0.530859 0.546644 0.479978 0.492329 0.439299 0.394427 0.427394 0.389299 0.355966
-0.326554 0.30041 0.277018 0.255966  
-n_reject : 3 1 3 2 2 3 3 2 1 3 0 2 3 1 1 1 3 3 2 1 
-
-N(0,2) : init_0 = -100, init_1 = 0.01, by increments of n = 1, 
-KS distance : 0.329606 0.170394 0.21905 0.170394 0.270394 0.170394 0.171431
-0.190783 0.260179 0.215734 0.27028 0.312011 0.273549 0.28062 0.247287 0.21812 
-0.192385 0.169509 0.149041 0.13062 0.161573 0.144257 0.171925 0.15562 0.18062 
-0.165236 0.188028 0.173477 0.159931 0.147287 0.135459 0.128283 0.145329 0.133561
-0.123477 0.113954 0.123216 0.138152 0.126681 0.115783 0.105417 0.0955451 
-0.086132 0.0929632 0.104579 0.115691 0.126329 0.115691 0.125895 0.115691 
-0.125494 0.115691 0.106257 0.097172 0.0884178 0.0799762 0.0893747 0.0812077 
-0.0902668 0.0990238 0.0911003 0.0995615 0.091881 0.100066 0.0926136 0.0853875 
-0.0933024 0.0862787 0.0794586 0.0871191 0.0804792 0.0740238 0.0677453 0.0616365 
-0.0690238 0.0630589 0.0572489 0.0644085 0.0587285 0.0656905 0.060135 0.06691 
-0.0614736 0.0561667 0.0627493 0.057551 0.0524721 0.0588723 0.0538928 0.0490238 
-0.0442619 0.0470498 0.0531274 0.0488212 0.0519567 0.0550269 0.0580337 0.0507752 
-0.0473638 0.0478689  
-n_reject : 6 8 6 5 4 6 2 2 4 5 5 8 6 6 4 4 6 2 5 7 8 3 2 4 1 2 0 6 4 3 4 3 5 5 3
- 6 2 7 4 3 4 7 3 3 4 7 6 7 6 3 2 4 5 4 3 6 7 5 3 3 7 7 6 2 5 6 3 4 5 5 7 4 5 3 4
-  1 4 4 6 3 3 5 3 3 5 2 1 3 4 4 5 4 4 1 8 2 4 2 3 8 
-  
-N(0,2) : init_0 = -0.01, init_1 = 100, by increments of n = 1, 
-KS distance : 0.224171 0.424326 0.590992 0.424326 0.324326 0.257659 0.21004 
-0.275829 0.220273 0.175829 0.230374 0.275829 0.237367 0.2044 0.242495 0.217415 
-0.246417 0.245193 0.204257 0.175829 0.176324 0.187147 0.194709 0.203767 0.172101
- 0.181331 0.189878 0.197815 0.170721 0.178767 0.186294 0.193351 0.169676 
- 0.147395 0.154958 0.162101 0.14183 0.148943 0.15569 0.137101 0.143808 0.150196 
- 0.133031 0.139373 0.145434 0.129492 0.135505 0.120434 0.126386 0.112101 
- 0.117983 0.104408 0.110214 0.115804 0.121191 0.126386 0.113855 0.101756 
- 0.107016 0.112101 0.117019 0.121778 0.117197 0.121661 0.125988 0.115032 
- 0.119329 0.108794 0.113056 0.102911 0.0930521 0.0973557 0.101541 0.105614 
- 0.109578 0.10028 0.0912229 0.0952189 0.0864555 0.0779112 0.0819236 0.0736429 
- 0.07761 0.069869 0.0736505 0.0773441 0.0809527 0.0731157 0.0766908 0.0690753 
- 0.0718321 0.0699209 0.0687169 0.0662206 0.0644289 0.0626745 0.0609563 0.0592732
-  0.057624 0.0560079  n_reject : 6 5 6 4 6 4 7 5 4 7 2 9 5 5 7 3 3 5 6 7 7 4 5 4
-   6 4 8 5 5 6 3 6 5 1 2 5 7 4 6 6 4 5 6 3 5 3 5 4 3 0 6 8 6 5 5 6 6 5 5 6 5 4 4
-    5 6 2 5 6 6 4 5 4 0 6 7 5 6 4 2 5 6 4 4 5 3 3 7 1 6 2 2 1 5 3 4 7 4 4 5 1 
-    
-N(0,2) : init_0 = -0.01, init_1 = 0.01, by increments of n = 1, KS distance : 
-0.94637 0.44637 0.349201 0.19637 0.282535 0.349201 0.387313 0.423027 0.339693 
-0.273027 0.30939 0.25636 0.211488 0.173027 0.150519 0.148475 0.13224 0.0995606 
-0.122952 0.144005 0.115434 0.134914 0.152701 0.148219 0.163219 0.177065 0.172077
- 0.183982 0.195066 0.205411 0.215088 0.192911 0.20238 0.211293 0.191125 0.199855
-  0.181086 0.163305 0.146436 0.155411 0.163947 0.172077 0.17993 0.166188 
-  0.153057 0.162236 0.171024 0.158613 0.146708 0.135279 0.143907 0.152202 
-  0.160185 0.167872 0.175279 0.182422 0.189314 0.195969 0.202398 0.191946 
-  0.19823 0.204311 0.194327 0.184654 0.190664 0.18134 0.172294 0.17822 0.183975 
-  0.175279 0.166828 0.158613 0.150622 0.15636 0.161946 0.167384 0.159695 
-  0.152202 0.157558 0.162779 0.155526 0.14845 0.141544 0.146708 0.139985 
-  0.133419 0.127003 0.123551 0.128275 0.121783 0.126423 0.130962 0.135403 
-  0.13975 0.133479 0.137755 0.141943 0.146046 0.139965 0.134005  
-  n_reject : 9 6 8 5 4 4 5 3 7 6 7 3 4 7 5 3 7 6 7 4 5 7 3 7 7 8 8 8 5 3 6 3 4 8
-   3 6 4 5 6 7 6 6 7 3 9 2 8 1 3 6 5 8 8 6 7 4 8 5 8 6 6 7 8 4 7 8 7 5 8 6 5 6 6
-    3 4 7 6 4 8 4 6 4 7 8 10 7 7 7 5 8 8 6 3 4 8 6 8 7 6 7 
-    
 -> example_search_reflection
-N(0,2)x_0 = 100, x_1 = 100.01, , n = 14, p_0 : (-63.83,-509.284,15.9575), 
-p_1 : (100.01,-1250.25,-25.0025)
-x_0 = -100.01, x_1 = -100, , n = 14, p_0 : (-100.01,-1250.25,25.0025), 
-p_1 : (63.83,-509.284,-15.9575)
-x_0 = -0.02, x_1 = -0.01, , n = 2, p_0 : (-0.02,-5e-05,0.005), 
-p_1 : (0.02,-5e-05,-0.005)
+N(0,2)x_0 = 100, x_1 = 100.01, , n = 14, p_0 : (-63.83,-509.284,15.9575), p_1 : (100.01,-1250.25,-25.0025)
+x_0 = -100.01, x_1 = -100, , n = 14, p_0 : (-100.01,-1250.25,25.0025), p_1 : (63.83,-509.284,-15.9575)
+x_0 = -0.02, x_1 = -0.01, , n = 2, p_0 : (-0.02,-5e-05,0.005), p_1 : (0.02,-5e-05,-0.005)
 <-
+-> example_standard_distribution 
+Gamma(3,1) : ars initialized every 1 with init_0 = 102 and init_1 = 102.01
+(Kolmogorov-statistic, # rejections per draw): 
+((10,0.16757),2.1)
+((100,0.0580157),2.46)
+((1000,0.0309302),2.318)
+((10000,0.00768814),2.3112)
+((100000,0.0021249),2.32135)
+((1000000,0.000751711),2.32073)
+
+Gamma(3,1) : ars initialized every 1 with init_0 = 2.01 and init_1 = 2.02
+(Kolmogorov-statistic, # rejections per draw): 
+((10,0.379978),2.3)
+((100,0.0560606),1.71)
+((1000,0.018001),1.683)
+((10000,0.00552136),1.6643)
+((100000,0.00235738),1.65932)
+((1000000,0.000615244),1.65827)
+
+N(0,2) : ars initialized every 1 with init_0 = -100 and init_1 = 0.01
+(Kolmogorov-statistic, # rejections per draw): 
+((10,0.153306),4.8)
+((100,0.0478689),4.29)
+((1000,0.0237086),4.679)
+((10000,0.00603333),4.6361)
+((100000,0.00306973),4.65347)
+((1000000,0.000669519),4.65573)
+
+N(0,2) : ars initialized every 1 with init_0 = -0.01 and init_1 = 100
+(Kolmogorov-statistic, # rejections per draw): 
+((10,0.275829),5.4)
+((100,0.0408603),4.57)
+((1000,0.0170958),4.683)
+((10000,0.00669968),4.6581)
+((100000,0.0023244),4.65068)
+((1000000,0.000614343),4.65194)
+
+N(0,2) : ars initialized every 1 with init_0 = -0.01 and init_1 = 0.01
+(Kolmogorov-statistic, # rejections per draw): 
+((10,0.173027),5.7)
+((100,0.104005),5.99)
+((1000,0.0356427),5.933)
+((10000,0.00754988),6.0014)
+((100000,0.00280912),5.98497)
+((1000000,0.0013802),5.99028)
Modified: sandbox/statistics/adaptive_rejection_sampling/libs/ars/example/search_reflection.cpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/libs/ars/example/search_reflection.cpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/libs/ars/example/search_reflection.cpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -6,17 +6,18 @@
 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)         //
 ///////////////////////////////////////////////////////////////////////////////
 #include <boost/format.hpp>
-#include <boost/standard_distribution/distributions/normal.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/normal/include.hpp>
 #include <boost/ars/search_reflection.hpp>
 #include <boost/ars/constant.hpp>
 
 void example_search_reflection(std::ostream& out){
     std::cout << "-> example_search_reflection" << std::endl;
     using namespace boost;
+    namespace st = boost::statistics::detail;
 
     typedef double value_t;
-    typedef ars::point<value_t> point_t;
-    typedef ars::constant<value_t> const_;
+    typedef st::ars::point<value_t> point_t;
+    typedef st::ars::constant<value_t> const_;
 
     struct local{
         static std::ostream& write(
@@ -53,7 +54,7 @@
         {
             x_0 = 100.0;
             x_1 = 100.01;
-            n = ars::search_reflection_dist(
+            n = st::ars::search_reflection_dist(
                 x_min,
                 x_max,
                 mdist,
@@ -70,7 +71,7 @@
         {
             x_0 = -100.01;
             x_1 = -100.00;
-            n = ars::search_reflection_dist(
+            n = st::ars::search_reflection_dist(
                 x_min,
                 x_max,
                 mdist,
@@ -87,7 +88,7 @@
         {
             x_0 = -0.02;
             x_1 = -0.01;
-            n = ars::search_reflection_dist(
+            n = st::ars::search_reflection_dist(
                 x_min,
                 x_max,
                 mdist,
Modified: sandbox/statistics/adaptive_rejection_sampling/libs/ars/example/standard_distribution.cpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/libs/ars/example/standard_distribution.cpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/libs/ars/example/standard_distribution.cpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -6,8 +6,8 @@
 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)         //
 ///////////////////////////////////////////////////////////////////////////////
 #include <iostream>
-#include <boost/standard_distribution/distributions/gamma.hpp>
-#include <boost/standard_distribution/distributions/normal.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/gamma/include.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/normal/include.hpp>
 #include <boost/ars/test/gamma_distribution.hpp>
 #include <boost/ars/test/normal_distribution.hpp>
 #include <libs/ars/example/standard_distribution.h>
@@ -18,71 +18,93 @@
 void example_standard_distribution(std::ostream& out){
     out << "-> example_standard_distribution " << std::endl;
 
+    using namespace boost;
+    using namespace statistics::detail;
+
+    // This example checks the convergence of ars for standard distributions
+    // by verifying that the kolmogorov-smirnov statistic converges to zero
+
     typedef double value_;
 
+    const unsigned n1 = 6e0;    // # loops
+    const unsigned n2 = 1e1;   // # subsamples on first loop  
+    const unsigned n3 = 1e0;   // size of subsample 
+    const unsigned n4 = 1e1;   // At each loop, n2 *= n4
+    const unsigned max_n_reject = 10;
+
     // The initial values are chosen to test the robustness of the
     // implementation, within the range allowed by the algorithm.
     {   // Domain = [0,inf)
         value_ shape = 3.0;
         value_ scale = 1.0;
         value_ mode = (shape - 1.0) * scale; //2
-        boost::ars::test::gamma_distribution<value_>(
-            shape,      //shape
-            scale,      //scale
-            mode + 100.0,//init0
-            mode + 100.01, //init1
-            1,          //draw_n = 1,
-            2e1,        //repeat_n = 1e2,
-            1e1,        //n_max_reject = 1e1
+        ars::test::gamma_distribution<value_>(
+            shape,          
+            scale,          
+            mode + 100.0,   //init0
+            mode + 100.01,  //init1
+            n1,
+            n2,          
+            n3,        
+            n4,
+            max_n_reject,        
             out
-        ); out << std::endl;
-        boost::ars::test::gamma_distribution<value_>(
+        ); 
+        ars::test::gamma_distribution<value_>(
             shape,      //shape
             scale,      //scale
             mode + 0.01,//init0
             mode + 0.02, //init1
-            1,          //draw_n = 1,
-            2e1,        //repeat_n = 1e2,
-            1e1,        //n_max_reject = 1e1
+            n1,
+            n2,          
+            n3,        
+            n4,
+            max_n_reject,        
             out
         );
-        out << std::endl;
+        
     }
     {   // Domain = (-inf,inf)
         value_ mu = 0.0;
         value_ sigma = 2.0;
-        boost::ars::test::normal_distribution<value_>(
+        ars::test::normal_distribution<value_>(
             mu,
             sigma,
             mu -100.0, //-100.0, //init0
             mu + 0.01, //+ 0.01,    //init1
-            1,      //draw_n,
-            1e2,    //repeat_n,
-            1e1,    //n_max_reject
+            n1,
+            n2,          
+            n3,        
+            n4,
+            max_n_reject,        
             out
         );
-        out << std::endl;
-        boost::ars::test::normal_distribution<value_>(
+        
+        ars::test::normal_distribution<value_>(
             mu,
             sigma,
             mu - 0.01,   //init0
             mu + 100.0,  //init1
-            1,      //draw_n,
-            1e2,    //repeat_n,
-            1e1,    //n_max_reject
+            n1,
+            n2,          
+            n3,        
+            n4,
+            max_n_reject,        
             out
         );
-        out << std::endl;
-        boost::ars::test::normal_distribution<value_>(
+        
+        ars::test::normal_distribution<value_>(
             mu,
             sigma,
-            -0.01, //init0
-            0.01,    //init1
-            1,      //draw_n,
-            1e2,    //repeat_n,
-            1e1,    //n_max_reject
+            -0.01,      //init0
+            0.01,       //init1
+            n1,
+            n2,          
+            n3,        
+            n4,
+            max_n_reject,        
             out
         );
-        out << std::endl;
+        
     }
 }
Modified: sandbox/statistics/adaptive_rejection_sampling/libs/ars/main.cpp
==============================================================================
--- sandbox/statistics/adaptive_rejection_sampling/libs/ars/main.cpp	(original)
+++ sandbox/statistics/adaptive_rejection_sampling/libs/ars/main.cpp	2009-09-30 23:39:23 EDT (Wed, 30 Sep 2009)
@@ -11,8 +11,8 @@
 
 int main(){
 
-    example_standard_distribution(std::cout);
     example_search_reflection(std::cout);
+    example_standard_distribution(std::cout);
 
     return 0;