|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58160 - in sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common: distributions/reference functor
From: erwann.rogard_at_[hidden]
Date: 2009-12-05 20:02:23
Author: e_r
Date: 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
New Revision: 58160
URL: http://svn.boost.org/trac/boost/changeset/58160
Log:
a
Added:
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/cdf.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/derivative_log_unnormalized_pdf.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/description.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/mean.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/normalizing_constant.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/os.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/pdf.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/random.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/variance.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/cdf.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/derivative_log_unnormalized_pdf.hpp (contents, props changed)
sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/normalizing_constant.hpp (contents, props changed)
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/cdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/cdf.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,33 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::common::reference::wrapper::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_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_CDF_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_CDF_HPP_ER_2009
+#include <boost/mpl/empty_base.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+#include <boost/statistics/detail/distribution_common/distributions/reference/wrapper.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+
+ template<typename D,typename X>
+ typename reference_wrapper<D>::value_type
+ cdf(const reference_wrapper<D>& rw, const X& x)
+ {
+ return cdf(rw.distribution(),x);
+ }
+
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/derivative_log_unnormalized_pdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/derivative_log_unnormalized_pdf.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////////////////////////
+// distribution::common::reference::wrapper::derivative_log_unnormalized_pdf.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_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_DERIVATIVE_LOG_UNNORMALIZED_PDF_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_DERIVATIVE_LOG_UNNORMALIZED_PDF_HPP_ER_2009
+#include <boost/mpl/empty_base.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+#include <boost/statistics/detail/distribution_common/distributions/reference/wrapper.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+
+ template<typename D,typename X>
+ typename reference_wrapper<D>::value_type
+ derivative_log_unnormalized_pdf(const reference_wrapper<D>& rw, const X& x)
+ {
+ return derivative_log_unnormalized_pdf(rw.distribution(),x);
+ }
+
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/description.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/description.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,37 @@
+//////////////////////////////////////////////////////////////////////////////////
+// distribution::common::distributions::reference::description.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_COMMON_DISTRIBUTIONS_REFERENCE_DESCRIPTION_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_DESCRIPTION_HPP_ER_2009
+#include <string>
+#include <boost/format.hpp>
+#include <boost/statistics/detail/distribution_common/distributions/reference/wrapper.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+
+ template<typename D>
+ std::string
+ description(
+ const reference_wrapper<D>& dist
+ ){
+ static const char* msg = "reference_wrapper<%1%>";
+ boost::format f(msg);
+ f%description(dist.distribution());
+ return f.str();
+ }
+
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
+
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/mean.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/mean.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,33 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::common::reference::wrapper::mean.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_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_MEAN_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_MEAN_HPP_ER_2009
+#include <boost/mpl/empty_base.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+#include <boost/statistics/detail/distribution_common/distributions/reference/wrapper.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+
+ template<typename D>
+ typename reference_wrapper<D>::value_type
+ mean(const reference_wrapper<D>& rw)
+ {
+ return mean(rw.distribution());
+ }
+
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/normalizing_constant.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/normalizing_constant.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,33 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::common::reference::wrapper::normalizing_constant.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_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_NORMALIZING_CONSTANT_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_NORMALIZING_CONSTANT_HPP_ER_2009
+#include <boost/mpl/empty_base.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+#include <boost/statistics/detail/distribution_common/distributions/reference/wrapper.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+
+ template<typename D>
+ typename reference_wrapper<D>::value_type
+ normalizing_constant(const reference_wrapper<D>& rw)
+ {
+ return normalizing_constant(rw.distribution());
+ }
+
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/os.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/os.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,33 @@
+/////////////////////////////////////////////////////////////////////////////////
+// distribution::commmon::distributions::reference::os.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_COMMON_DISTRIBUTIONS_REFERENCE_OS_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_OS_HPP_ER_2009
+#include <boost/statistics/detail/distribution_toolkit/distributions/uniform/description.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+
+ template<typename D>
+ std::ostream&
+ operator<<(
+ std::ostream& os,
+ const reference_wrapper<D>& dist
+ )
+ {
+ return (os << description(dist));
+ }
+
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/pdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/pdf.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,33 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::common::reference::wrapper::pdf.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_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_PDF_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_PDF_HPP_ER_2009
+#include <boost/mpl/empty_base.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+#include <boost/statistics/detail/distribution_common/distributions/reference/wrapper.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+
+ template<typename D,typename X>
+ typename reference_wrapper<D>::value_type
+ pdf(const reference_wrapper<D>& rw, const X& x)
+ {
+ return pdf(rw.distribution(),x);
+ }
+
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/random.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/random.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,39 @@
+/////////////////////////////////////////////////////////////////////////////////
+// distribution::common::distributions::reference::random.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_COMMON_DISTRIBUTIONS_REFERENCE_RANDOM_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_RANDOM_HPP_ER_2009
+#include <boost/math/distributions/exponential.hpp>
+#include <boost/random/exponential_distribution.hpp>
+#include <boost/statistics/detail/distribution_common/meta/random/distribution.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace meta{
+
+ template<typename D>
+ struct random_distribution< reference_wrapper<D> >
+ {
+ typedef typename reference_wrapper<D>::distribution_type dist_;
+ typedef random_distribution<dist_> inner_;
+ typedef typename inner_::type type;
+
+ static type call(const reference_wrapper<D>& d){
+ return inner_::call(d.distribution());
+ }
+ };
+
+}// meta
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/variance.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/distributions/reference/variance.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,33 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::common::reference::wrapper::variance.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_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_VARIANCE_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_DISTRIBUTIONS_REFERENCE_WRAPPER_VARIANCE_HPP_ER_2009
+#include <boost/mpl/empty_base.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+#include <boost/statistics/detail/distribution_common/distributions/reference/wrapper.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+
+ template<typename D>
+ typename reference_wrapper<D>::value_type
+ variance(const reference_wrapper<D>& rw)
+ {
+ return variance(rw.distribution());
+ }
+
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/cdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/cdf.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,61 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::common::functor::cdf.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_DISTRIBUTION_COMMON_FUNCTOR_CDF_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_FUNCTOR_CDF_HPP_ER_2009
+#include <boost/mpl/assert.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace functor{
+
+ template<typename D>
+ class cdf_
+ {
+
+ BOOST_MPL_ASSERT(( boost::mpl::not_< boost::is_reference<D> >));
+ // use reference::wrapper if a ref is needed
+
+ public:
+ typedef D distribution_type;
+ typedef typename distribution::meta::value<D>::type result_type;
+
+ cdf_(){}
+ cdf_(const D& d):d_(d){}
+ cdf_(const cdf_& that):d_(that.d_){}
+ cdf_& operator=(const cdf_& that)
+ {
+ if(&that!=this)
+ {
+ d_ = that.d_;
+ }
+ return (*this);
+ }
+
+ template<typename X>
+ result_type
+ operator()(const X& x)const{
+ return cdf( this->distribution(), x );
+ }
+
+ const D& distribution()const{ return this->d_; }
+
+ private:
+ D d_;
+
+ };
+
+}// functor
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/derivative_log_unnormalized_pdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/derivative_log_unnormalized_pdf.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,65 @@
+///////////////////////////////////////////////////////////////////////////////////
+// distribution::common::functor::derivative_derivative_log_unnormalized_pdf.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_DISTRIBUTION_COMMON_FUNCTOR_DERIVATIVE_LOG_UNNORMALIZED_PDF_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_FUNCTOR_DERIVATIVE_LOG_UNNORMALIZED_PDF_HPP_ER_2009
+#include <boost/mpl/assert.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace functor{
+
+ template<typename D>
+ class derivative_log_unnormalized_pdf_
+ {
+
+ BOOST_MPL_ASSERT(( boost::mpl::not_< boost::is_reference<D> >));
+ // use reference::wrapper if a ref is needed
+
+ public:
+ typedef D distribution_type;
+ typedef typename common::meta::value<D>::type result_type;
+
+ derivative_log_unnormalized_pdf_(){}
+ derivative_log_unnormalized_pdf_(const D& d):d_(d){}
+ derivative_log_unnormalized_pdf_(
+ const derivative_log_unnormalized_pdf_& that
+ ):d_(that.d_){}
+ derivative_log_unnormalized_pdf_& operator=(
+ const derivative_log_unnormalized_pdf_& that
+ )
+ {
+ if(&that!=this)
+ {
+ d_ = that.d_;
+ }
+ return (*this);
+ }
+
+ template<typename X>
+ result_type
+ operator()(const X& x)const{
+ return derivative_log_unnormalized_pdf( this->distribution(), x );
+ }
+
+ const D& distribution()const{ return this->d_; }
+
+ private:
+ D d_;
+
+ };
+
+}// functor
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/normalizing_constant.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_common/boost/statistics/detail/distribution_common/functor/normalizing_constant.hpp 2009-12-05 20:02:22 EST (Sat, 05 Dec 2009)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::common::functor::normalizing_constant.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_DISTRIBUTION_COMMON_FUNCTOR_NORMALIZING_CONSTANT_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_COMMON_FUNCTOR_NORMALIZING_CONSTANT_HPP_ER_2009
+#include <boost/mpl/assert.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace functor{
+
+ template<typename D>
+ class normalizing_constant_
+ {
+
+ BOOST_MPL_ASSERT(( boost::mpl::not_< boost::is_reference<D> >));
+ // use reference::wrapper if a ref is needed
+
+ public:
+ typedef D distribution_type;
+ typedef typename common::meta::value<D>::type result_type;
+
+ normalizing_constant_(){}
+ normalizing_constant_(const D& d):d_(d){}
+ normalizing_constant_(const normalizing_constant_& that):d_(that.d_){}
+ normalizing_constant_& operator=(const normalizing_constant_& that)
+ {
+ if(&that!=this)
+ {
+ d_ = that.d_;
+ }
+ return (*this);
+ }
+
+ template<typename X>
+ result_type operator()(const X& x)const{
+ return normalizing_constant( this->distribution(), x );
+ }
+
+ const D& distribution()const{ return this->d_; }
+
+ private:
+ D d_;
+
+ };
+
+}// functor
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#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