Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56811 - in sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit: doc example
From: erwann.rogard_at_[hidden]
Date: 2009-10-13 21:59:06


Author: e_r
Date: 2009-10-13 21:59:05 EDT (Tue, 13 Oct 2009)
New Revision: 56811
URL: http://svn.boost.org/trac/boost/changeset/56811

Log:
m
Text files modified:
   sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/doc/readme.txt | 11 ++
   sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/example/random.cpp | 180 ++++++++++++++-------------------------
   2 files changed, 76 insertions(+), 115 deletions(-)

Modified: sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/doc/readme.txt
==============================================================================
--- sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/doc/readme.txt (original)
+++ sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/doc/readme.txt 2009-10-13 21:59:05 EDT (Tue, 13 Oct 2009)
@@ -35,6 +35,7 @@
 
 boost_1_40_0
 /sandbox/statistics/random/
+/sandbox/statistics/distribution_common/
 
 To use distributions/wrapper,
 libboost_serialization-xgcc42-mt-1_39.a
@@ -87,10 +88,16 @@
 
 [ History ]
 
-Oct 2 Transfered parts of /meta and /concept to newly created library
- /distribution_common. Split the namepsace distribution_toolkit into
+Oct 11 2009 :
+ removed /data. use instead sandbox/non_parametric/statistic
+ added /test
+
+Oct 2 2009
+ Removed /concept, replaced by /distribution_common.
+ Split the namepsace distribution_toolkit into
         distribution::toolkit. Brought some function uder this namespace into
         statistics::detail. Concept checks in libs/.../test
+
 Sep 23 2009 : Merged
         sandbox/statistics/scalar_dist
         sandbox/statistics/standard_distribution

Modified: sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/example/random.cpp
==============================================================================
--- sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/example/random.cpp (original)
+++ sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/example/random.cpp 2009-10-13 21:59:05 EDT (Tue, 13 Oct 2009)
@@ -1,38 +1,25 @@
 //////////////////////////////////////////////////////////////////////////////
-// distribution::toolkit::example::random.cpp //
+// distribution::toolkit::example::random.cpp //
 // //
 // (C) Copyright 2009 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) //
 //////////////////////////////////////////////////////////////////////////////
-#include <iterator>
-#include <ext/algorithm>
-#include <boost/range.hpp>
-#include <boost/static_assert.hpp>
-#include <boost/random/mersenne_twister.hpp>
-
 #include <boost/statistics/detail/distribution_toolkit/distributions/chi_squared/include.hpp>
 #include <boost/statistics/detail/distribution_toolkit/distributions/exponential/include.hpp>
 #include <boost/statistics/detail/distribution_toolkit/distributions/gamma/include.hpp>
 #include <boost/statistics/detail/distribution_toolkit/distributions/normal/include.hpp>
 #include <boost/statistics/detail/distribution_toolkit/distributions/students_t/include.hpp>
-
-// fwd_math must precede location_scale<Z> if Z is from boost::math
-#include <boost/statistics/detail/distribution_toolkit/fwd_math/include.hpp>
 #include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/include.hpp>
 #include <boost/statistics/detail/distribution_toolkit/distributions/wrapper/include.hpp>
 
-#include <boost/statistics/detail/distribution_toolkit/random/include.hpp>
-#include <boost/statistics/detail/distribution_toolkit/data/include.hpp>
-#include <boost/statistics/detail/distribution_toolkit/unscope/os.hpp>
+#include <boost/statistics/detail/distribution_toolkit/test/random.hpp>
 
 #include <libs/statistics/detail/distribution_toolkit/example/random.h>
 
-void example_random(std::ostream& os){
-
- os << "example_random -> " << std::endl;
-
+void example_random(std::ostream& os)
+{
     // For each distribution, dist, and the corresponding random engine returned
     // by make_random(dist), this example outputs a series of kolmogorov-
     // smirnov statistics. Convergence to zero is evidence that
@@ -40,58 +27,44 @@
 
     using namespace boost;
     using namespace boost::statistics;
- namespace tk = statistics::detail::distribution::toolkit;
+ namespace stat = statistics::detail;
+ namespace tk = stat::distribution::toolkit;
+ namespace dc = stat::distribution::common;
+
+ const unsigned n_loops = 6;
+ const unsigned n1 = 1e1;
+ const unsigned n2 = 1e1;
     
     // Types
- typedef double val_;
- typedef mt19937 urng_;
-
- typedef tk::sample_cdf<val_> sample_cdf_;
- typedef sample_cdf_::size_type size_;
-
- // Constants
- const unsigned n_loops = 6;
- const unsigned n1 = 1e1;
- const unsigned n2 = 1e1;
-
- urng_ urng;
+ typedef double val_;
 
- sample_cdf_ sc;
- os << "kolmogorov statistic for : " << std::endl;
     {
- typedef math::chi_squared_distribution<val_> dist_;
- const val_ df = 10;
+ typedef math::chi_squared_distribution<val_> dist_;
+ const val_ df = 10;
         dist_ dist( df );
 
-
- os << dist << std::endl;
- unsigned i = 0;
- unsigned n_draws = n1;
- sc.clear();
- while(i<n_loops){
- sc.reserve(sc.size()+n_draws);
- generate2_n(sc,n_draws,urng,dist);
- os << sc << std::endl;
- ++i;
- n_draws *= n2;
- }
+ tk::test::random(
+ dist,
+ n_loops,
+ n1,
+ n2,
+ os
+ );
+
     }
     {
         typedef math::exponential_distribution<val_> dist_;
         const val_ lambda = 1.0;
         dist_ dist( lambda );
-
- os << dist << std::endl;
- unsigned i = 0;
- unsigned n_draws = n1;
- sc.clear();
- while(i<n_loops){
- sc.reserve(sc.size()+n_draws);
- generate2_n(sc,n_draws,urng,dist);
- os << sc << std::endl;
- ++i;
- n_draws *= n2;
- }
+
+ tk::test::random(
+ dist,
+ n_loops,
+ n1,
+ n2,
+ os
+ );
+
     }
     {
         typedef math::gamma_distribution<val_> dist_;
@@ -99,17 +72,13 @@
         const val_ scale = 3.0;
         dist_ dist( shape, scale );
             
- os << dist << std::endl;
- unsigned i = 0;
- unsigned n_draws = n1;
- sc.clear();
- while(i<n_loops){
- sc.reserve(sc.size()+n_draws);
- generate2_n(sc,n_draws,urng,dist);
- os << sc << std::endl;
- ++i;
- n_draws *= n2;
- }
+ tk::test::random(
+ dist,
+ n_loops,
+ n1,
+ n2,
+ os
+ );
     }
     {
         typedef math::normal_distribution<val_> dist_;
@@ -117,34 +86,27 @@
         const val_ s = 2.0;
         dist_ dist( m, s );
             
- os << dist << std::endl;
- unsigned i = 0;
- unsigned n_draws = n1;
- sc.clear();
- while(i<n_loops){
- sc.reserve(sc.size()+n_draws);
- generate2_n(sc,n_draws,urng,dist);
- os << sc << std::endl;
- ++i;
- n_draws *= n2;
- }
+ tk::test::random(
+ dist,
+ n_loops,
+ n1,
+ n2,
+ os
+ );
+
     }
     {
         typedef math::students_t_distribution<val_> dist_;
         const val_ df = 4.0;
         dist_ dist( df );
             
- os << dist << std::endl;
- unsigned i = 0;
- unsigned n_draws = n1;
- sc.clear();
- while(i<n_loops){
- sc.reserve(sc.size()+n_draws);
- generate2_n(sc,n_draws,urng,dist);
- os << sc << std::endl;
- ++i;
- n_draws *= n2;
- }
+ tk::test::random(
+ dist,
+ n_loops,
+ n1,
+ n2,
+ os
+ );
     }
     {
         typedef math::students_t_distribution<val_> dist_z_;
@@ -155,17 +117,13 @@
         dist_z_ dist_z( df );
         dist_ dist(m, s, dist_z);
             
- os << dist << std::endl;
- unsigned i = 0;
- unsigned n_draws = n1;
- sc.clear();
- while(i<n_loops){
- sc.reserve(sc.size()+n_draws);
- generate2_n(sc,n_draws,urng,dist);
- os << sc << std::endl;
- ++i;
- n_draws *= n2;
- }
+ tk::test::random(
+ dist,
+ n_loops,
+ n1,
+ n2,
+ os
+ );
     }
     {
         typedef math::students_t_distribution<val_> d0_;
@@ -174,17 +132,13 @@
         d0_ d0( df );
         dist_ dist(d0);
             
- os << dist << std::endl;
- unsigned i = 0;
- unsigned n_draws = n1;
- sc.clear();
- while(i<n_loops){
- sc.reserve(sc.size()+n_draws);
- generate2_n(sc,n_draws,urng,dist);
- os << sc << std::endl;
- ++i;
- n_draws *= n2;
- }
+ tk::test::random(
+ dist,
+ n_loops,
+ n1,
+ n2,
+ os
+ );
     }
 
     os << "<-" << std::endl;


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