|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56429 - sandbox/statistics/distribution_toolkit/boost/statistics/detail/distribution_toolkit/data
From: erwann.rogard_at_[hidden]
Date: 2009-09-26 22:03:06
Author: e_r
Date: 2009-09-26 22:03:06 EDT (Sat, 26 Sep 2009)
New Revision: 56429
URL: http://svn.boost.org/trac/boost/changeset/56429
Log:
a
Added:
sandbox/statistics/distribution_toolkit/boost/statistics/detail/distribution_toolkit/data/generate_n_sample_cdf.hpp (contents, props changed)
Added: sandbox/statistics/distribution_toolkit/boost/statistics/detail/distribution_toolkit/data/generate_n_sample_cdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_toolkit/boost/statistics/detail/distribution_toolkit/data/generate_n_sample_cdf.hpp 2009-09-26 22:03:06 EDT (Sat, 26 Sep 2009)
@@ -0,0 +1,48 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution_toolkit::data::generate_n_sample_cdf.hpp //
+// //
+// (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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_DETAIL_DISTRIBUTION_TOOLKIT_DATA_GENERATE_N_SAMPLE_CDF_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_TOOLKIT_DATA_GENERATE_N_SAMPLE_CDF_HPP_ER_2009
+#include <boost/utility/enable_if.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/statistics/detail/distribution_toolkit/meta/is_scalar_distribution.hpp>
+#include <boost/statistics/detail/distribution_toolkit/data/sample_cdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/fwd_math/cdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/random/generator.hpp>
+
+namespace boost{
+
+ template<typename T,typename N,typename D,typename U>
+ typename enable_if<
+ statistics::detail::distribution_toolkit
+ ::meta::is_scalar_distribution<D>,
+ void
+ >::type
+ generate_n(
+ statistics::detail::distribution_toolkit::sample_cdf<T>& sc,
+ N n,
+ U& urng,
+ const D& dist
+ ){
+ typedef statistics::detail::distribution_toolkit::sample_cdf<T> sc_;
+ typedef typename sc_::size_type size_type;
+ BOOST_AUTO(vg,boost::make_random_generator(urng,dist));
+ size_type i = 0;
+ T x, cdf;
+ while(i<n){
+ x = vg();
+ cdf = statistics::detail::distribution_toolkit::cdf(dist,x);
+ sc(x,cdf);
+ ++i;
+ };
+
+ }
+
+}
+
+#endif
\ 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