|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56522 - sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/test
From: erwann.rogard_at_[hidden]
Date: 2009-10-02 13:56:08
Author: e_r
Date: 2009-10-02 13:56:07 EDT (Fri, 02 Oct 2009)
New Revision: 56522
URL: http://svn.boost.org/trac/boost/changeset/56522
Log:
m/a
Added:
sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/test/functions.cpp (contents, props changed)
Text files modified:
sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/test/function_ptrs.cpp | 140 ++++++++++++++++++++++-----------------
1 files changed, 80 insertions(+), 60 deletions(-)
Modified: sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/test/function_ptrs.cpp
==============================================================================
--- sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/test/function_ptrs.cpp (original)
+++ sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/test/function_ptrs.cpp 2009-10-02 13:56:07 EDT (Fri, 02 Oct 2009)
@@ -8,79 +8,99 @@
//////////////////////////////////////////////////////////////////////////////
#ifndef LIBS_STATISTICS_DETAIL_DISTRIBUTION_TOOLKIT_TEST_FUNCTION_PTRS_H_ER_2009
#define LIBS_STATISTICS_DETAIL_DISTRIBUTION_TOOLKIT_TEST_FUNCTION_PTRS_H_ER_2009
+#include <ostream>
#include <boost/concept/assert.hpp>
#include <boost/statistics/detail/distribution_toolkit/distributions/include.hpp>
#include <boost/statistics/detail/distribution_toolkit/map_pdf/include.hpp>
#include <boost/statistics/detail/distribution_toolkit/fun_wrap/pdf.hpp>
#include <boost/statistics/detail/distribution_toolkit/concept/aggregate/function_ptrs.hpp>
-
template <typename T>
-void test_function_ptrs()
+void test_function_ptrs(std::ostream& os)
{
+ os << "test_function_ptrs - >" << std::endl;
+
using namespace boost;
using namespace math;
namespace tk = boost::statistics::detail::distribution_toolkit;
namespace tk_c = tk::concept;
-
- typedef math::chi_squared_distribution<T> chi_squared_;
- BOOST_CONCEPT_ASSERT((
- tk_c::FunctionPtrs<chi_squared_>
- ));
-
- typedef math::exponential_distribution<T> exponential_;
- BOOST_CONCEPT_ASSERT((
- tk_c::FunctionPtrs<exponential_>
- ));
-
- typedef math::gamma_distribution<T> gamma_;
- BOOST_CONCEPT_ASSERT((
- tk_c::FunctionPtrs<gamma_>
- ));
-
- typedef math::normal_distribution<T> normal_;
- BOOST_CONCEPT_ASSERT((
- tk_c::FunctionPtrs<normal_>
- ));
-
- typedef math::uniform_distribution<T> uniform_;
- BOOST_CONCEPT_ASSERT((
- tk_c::FunctionPtrs<uniform_>
- ));
-
- typedef math::students_t_distribution<T> students_t_;
- BOOST_CONCEPT_ASSERT((
- tk_c::FunctionPtrs<students_t_>
- ));
-
- //typedef tk::wrapper< const normal_& > wrapper_;
- //BOOST_CONCEPT_ASSERT((
- // tk_c::FunctionPtrs<wrapper_>
- //));
-
- typedef tk::location_scale_distribution< normal_ > loc_scale_;
- BOOST_CONCEPT_ASSERT((
- tk_c::FunctionPtrs<loc_scale_>
- ));
-
- // Weaker requirements
- typedef tk::inverse_pdf< normal_ > inv_;
- BOOST_CONCEPT_ASSERT((
- tk_c::LogUnnormalizedPdf<inv_>
- ));
-
- typedef tk::product_pdf< normal_,students_t_ > prod_;
- BOOST_CONCEPT_ASSERT((
- tk_c::LogUnnormalizedPdf<prod_>
- ));
-
- typedef typename
- tk::meta_ratio_pdf< normal_,students_t_ >::type ratio_;
- BOOST_CONCEPT_ASSERT((
- tk_c::LogUnnormalizedPdf<ratio_>
- ));
-
+ {
+ typedef math::chi_squared_distribution<T> d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtrs<d_>
+ ));
+ }
+ {
+ typedef math::exponential_distribution<T> d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtrs<d_>
+ ));
+ }
+ {
+
+ typedef math::gamma_distribution<T> d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtrs<d_>
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtrs<d_>
+ ));
+ }
+ {
+ typedef math::uniform_distribution<T> d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtrs<d_>
+ ));
+ }
+ {
+ typedef math::students_t_distribution<T> d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtrs<d_>
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d0_;
+ typedef tk::wrapper< const d0_& > d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtrs<d_>
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d0_;
+ typedef tk::location_scale_distribution< d0_ > d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtrs<d_>
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d0_;
+ typedef tk::inverse_pdf< d0_ > d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtr<d_,tk::fun_wrap::log_unnormalized_pdf_>
+ ));
+ }
+ {
+ typedef math::students_t_distribution<T> d0_;
+ typedef math::normal_distribution<T> d1_;
+ typedef tk::product_pdf<d0_,d1_ > d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtr<d_,tk::fun_wrap::log_unnormalized_pdf_>
+ ));
+ }
+ {
+ typedef math::students_t_distribution<T> d0_;
+ typedef math::normal_distribution<T> d1_;
+ typedef typename tk::meta_ratio_pdf<d0_,d1_>::type d_;
+ BOOST_CONCEPT_ASSERT((
+ tk_c::FunctionPtr<d_,tk::fun_wrap::log_unnormalized_pdf_>
+ ));
+ }
+
+ os << "<-" << std::endl;
}
#endif
\ No newline at end of file
Added: sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/test/functions.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_toolkit/libs/statistics/detail/distribution_toolkit/test/functions.cpp 2009-10-02 13:56:07 EDT (Fri, 02 Oct 2009)
@@ -0,0 +1,268 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution_toolkit::test::functions.h //
+// //
+// (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 LIBS_STATISTICS_DETAIL_DISTRIBUTION_TOOLKIT_TEST_FUNCTIONS_H_ER_2009
+#define LIBS_STATISTICS_DETAIL_DISTRIBUTION_TOOLKIT_TEST_FUNCTIONS_H_ER_2009
+#include <ostream>
+#include <boost/concept/assert.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>
+#include <boost/statistics/detail/distribution_toolkit/distributions/uniform/include.hpp>
+
+#include <boost/statistics/detail/distribution_toolkit/fwd_math/cdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/fwd_math/mean.hpp>
+#include <boost/statistics/detail/distribution_toolkit/fwd_math/pdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/fwd_math/quantile.hpp>
+#include <boost/statistics/detail/distribution_toolkit/fwd_math/variance.hpp>
+
+#include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/location_scale.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/quantile.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/cdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/pdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/mean.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/derivative_log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/location_scale/variance.hpp>
+
+#include <boost/statistics/detail/distribution_toolkit/distributions/wrapper/include.hpp>
+
+#include <boost/statistics/detail/distribution_toolkit/map_pdf/inverse_pdf/include.hpp>
+#include <boost/statistics/detail/distribution_toolkit/map_pdf/product_pdf/include.hpp>
+#include <boost/statistics/detail/distribution_toolkit/map_pdf/ratio_pdf/include.hpp>
+
+// Concepts must come after distributions
+#include <boost/statistics/detail/distribution_common/concept/unary/mean.hpp>
+#include <boost/statistics/detail/distribution_common/concept/unary/variance.hpp>
+#include <boost/statistics/detail/distribution_common/concept/unary/quantile.hpp>
+#include <boost/statistics/detail/distribution_common/concept/unary/cdf.hpp>
+#include <boost/statistics/detail/distribution_common/concept/unary/pdf.hpp>
+#include <boost/statistics/detail/distribution_common/concept/unary/log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution_common/concept/unary/derivative_log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/concept/aggregate/function_ptrs.hpp>
+
+#include <boost/statistics/detail/distribution_common/meta/wrapper_distribution.hpp>
+#include <boost/statistics/detail/distribution_common/meta/wrapper_variable.hpp>
+#include <boost/statistics/detail/distribution_common/meta/wrapper_probability.hpp>
+
+template <typename T>
+void test_functions(std::ostream& os)
+{
+ os << "test_functions - >" << std::endl;
+ using namespace boost;
+ using namespace math;
+
+ namespace st = boost::statistics::detail;
+ namespace st_dc = st::distribution::common;
+ namespace st_dc_c = st_dc::concept;
+ namespace st_tk = st::distribution_toolkit;
+ namespace st_tk_c = st_tk::concept;
+
+ typedef st_dc::meta::wrapper_variable<T> x_;
+ typedef st_dc::meta::wrapper_probability<T,x_> p_x_;
+
+ {
+ typedef math::chi_squared_distribution<T> d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ st_tk_c::FunctionPtrs<d_>
+ ));
+
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::DerivativeLogUnnormalizedPdf<
+ st_dc_c::LogUnnormalizedPdf<
+ st_dc_c::Pdf<
+ st_dc_c::Quantile<
+ st_dc_c::Cdf<
+ st_dc_c::Mean<
+ st_dc_c::Variance<w_>
+ >
+ >
+ >
+ >
+ >
+ >
+ ));
+ }
+ {
+ typedef math::exponential_distribution<T> d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::DerivativeLogUnnormalizedPdf<
+ st_dc_c::LogUnnormalizedPdf<
+ st_dc_c::Pdf<
+ st_dc_c::Quantile<
+ st_dc_c::Cdf<
+ st_dc_c::Mean<
+ st_dc_c::Variance<w_>
+ >
+ >
+ >
+ >
+ >
+ >
+ ));
+ }
+ {
+ typedef math::gamma_distribution<T> d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::DerivativeLogUnnormalizedPdf<
+ st_dc_c::LogUnnormalizedPdf<
+ st_dc_c::Pdf<
+ st_dc_c::Quantile<
+ st_dc_c::Cdf<
+ st_dc_c::Mean<
+ st_dc_c::Variance<w_>
+ >
+ >
+ >
+ >
+ >
+ >
+ ));
+
+ }
+ {
+ typedef math::normal_distribution<T> d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::DerivativeLogUnnormalizedPdf<
+ st_dc_c::LogUnnormalizedPdf<
+ st_dc_c::Pdf<
+ st_dc_c::Quantile<
+ st_dc_c::Cdf<
+ st_dc_c::Mean<
+ st_dc_c::Variance<w_>
+ >
+ >
+ >
+ >
+ >
+ >
+ ));
+ }
+ {
+ typedef math::students_t_distribution<T> d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::DerivativeLogUnnormalizedPdf<
+ st_dc_c::LogUnnormalizedPdf<
+ st_dc_c::Pdf<
+ st_dc_c::Quantile<
+ st_dc_c::Cdf<
+ st_dc_c::Mean<
+ st_dc_c::Variance<w_>
+ >
+ >
+ >
+ >
+ >
+ >
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::DerivativeLogUnnormalizedPdf<
+ st_dc_c::LogUnnormalizedPdf<
+ st_dc_c::Pdf<
+ st_dc_c::Quantile<
+ st_dc_c::Cdf<
+ st_dc_c::Mean<
+ st_dc_c::Variance<w_>
+ >
+ >
+ >
+ >
+ >
+ >
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> z_;
+ typedef st_tk::location_scale_distribution< z_ > d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::DerivativeLogUnnormalizedPdf<
+ st_dc_c::LogUnnormalizedPdf<
+ st_dc_c::Pdf<
+ st_dc_c::Quantile<
+ st_dc_c::Cdf<
+ st_dc_c::Mean<
+ st_dc_c::Variance<w_>
+ >
+ >
+ >
+ >
+ >
+ >
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d0_;
+ typedef st_tk::wrapper< const d0_& > d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::DerivativeLogUnnormalizedPdf<
+ st_dc_c::LogUnnormalizedPdf<
+ st_dc_c::Pdf<
+ st_dc_c::Quantile<
+ st_dc_c::Cdf<
+ st_dc_c::Mean<
+ st_dc_c::Variance<w_>
+ >
+ >
+ >
+ >
+ >
+ >
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d0_;
+ typedef st_tk::inverse_pdf< d0_ > d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::LogUnnormalizedPdf<w_>
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d0_;
+ typedef math::chi_squared_distribution<T> d1_;
+ typedef st_tk::product_pdf< d0_, d1_ > d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::LogUnnormalizedPdf<w_>
+ ));
+ }
+ {
+ typedef math::normal_distribution<T> d0_;
+ typedef math::chi_squared_distribution<T> d1_;
+ typedef typename st_tk::meta_ratio_pdf< d0_, d1_ >::type d_;
+ typedef st_dc::meta::wrapper_distribution<d_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ st_dc_c::LogUnnormalizedPdf<w_>
+ ));
+ }
+ os << " <- " << std::endl;
+}
+
+#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