|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58821 - in sandbox/statistics/adaptive_rejection_sampling: boost/ars libs/ars/doc
From: erwann.rogard_at_[hidden]
Date: 2010-01-08 22:15:52
Author: e_r
Date: 2010-01-08 22:15:51 EST (Fri, 08 Jan 2010)
New Revision: 58821
URL: http://svn.boost.org/trac/boost/changeset/58821
Log:
m
Text files modified:
sandbox/statistics/adaptive_rejection_sampling/boost/ars/proposal_sampler.hpp | 31 +++++++++++++++++++++++--------
sandbox/statistics/adaptive_rejection_sampling/libs/ars/doc/readme.txt | 12 ++++++++++--
2 files changed, 33 insertions(+), 10 deletions(-)
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 2010-01-08 22:15:51 EST (Fri, 08 Jan 2010)
@@ -18,18 +18,21 @@
#include <iterator>
#include <numeric>
#include <limits>
-#include <boost/lambda/lambda.hpp> //what for?
+
#include <boost/static_assert.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/empty.hpp>
#include <boost/type_traits/is_base_of.hpp>
+
+#include <boost/bind.hpp>
+//#include <boost/lambda/lambda.hpp> //what for?
#include <boost/random.hpp>
#include <boost/range.hpp>
-#include <boost/bind.hpp>
+#include <boost/iterator/transform_iterator.hpp>
#include <boost/function.hpp>
-#include <boost/static_assert.hpp>
-#include <boost/variant.hpp>
+//#include <boost/variant.hpp> // what for?
#include <boost/format.hpp>
+
//#include <boost/numeric/conversion/converter.hpp>
//#include <boost/math/tools/precision.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
@@ -401,10 +404,22 @@
iter_t back_iter = prior(end(datas_));
{
- T t = max_element(
- begin(datas_),back_iter,
- bind<const T&>( &tang_t::t, _1 )
- )->t();
+
+ // Bug prior to 01/08/2010 :
+ //T t = max_element(
+ // begin(datas_),back_iter,
+ // bind<const T&>( &tang_t::t, _1 )
+ //)->t();
+
+ typedef const T& cref_;
+ typedef cref_(tang_t::*fp)() const;
+ typedef boost::function<cref_(const data_t&)> fun_;
+ fun_ fun = &tang_t::t;
+
+ T t = *std::max_element(
+ boost::make_transform_iterator(boost::begin(datas_),fun),
+ boost::make_transform_iterator(back_iter,fun)
+ );
max_tangent_ = (max_tangent()<t)? t : max_tangent();
}
const point_t& back_p = static_cast<const point_t&>(*back_iter);
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 2010-01-08 22:15:51 EST (Fri, 08 Jan 2010)
@@ -25,19 +25,27 @@
[ Dependencies ]
-boost_1_39_0
+boost_1_40_0
+/sandbox/statistics/non_parametric
/sandbox/statistics/distribution_common
/sandbox/statistics/distribution_toolkit
+/sandbox/statistics/distribution_random
[ History ]
+Jan 8 2010 : in proposal_sampler, found and fixed bug
+ //T t = max_element(
+ // begin(datas_),back_iter,
+ // bind<const T&>( &tang_t::t, _1 ) // not a comparison predicate
+ //)->t();
+
Dec 4 2009 : misc changes due to updated dependencies
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]
+[Articles]
@article{citeulike:3015268,
abstract = {We propose a method for rejection sampling from any
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