Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56691 - in sandbox/statistics/distribution_joint: . boost boost/statistics boost/statistics/detail boost/statistics/detail/distribution boost/statistics/detail/distribution/joint boost/statistics/detail/distribution/joint/distributions boost/statistics/detail/distribution/joint/distributions/detail boost/statistics/detail/distribution/joint/distributions/iid boost/statistics/detail/distribution/joint/distributions/independent boost/statistics/detail/distribution/joint/fun_wrap boost/statistics/detail/distribution/joint/fun_wrap/detail boost/statistics/detail/distribution/joint/meta boost/statistics/detail/distribution/joint/random boost/statistics/detail/distribution/joint/random/concept boost/statistics/detail/distribution/joint/random/detail boost/statistics/detail/distribution/joint/unscope libs libs/statistics libs/statistics/detail libs/statistics/detail/distribution libs/statistics/detail/distribution/joint libs/statistics/detail/distribution/joint/doc libs/statistics/detail/distribution/joint/example libs/statistics/detail/distribution/joint/src libs/statistics/detail/distribution/joint/test
From: erwann.rogard_at_[hidden]
Date: 2009-10-09 22:54:02


Author: e_r
Date: 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
New Revision: 56691
URL: http://svn.boost.org/trac/boost/changeset/56691

Log:
a
Added:
   sandbox/statistics/distribution_joint/
   sandbox/statistics/distribution_joint/boost/
   sandbox/statistics/distribution_joint/boost/statistics/
   sandbox/statistics/distribution_joint/boost/statistics/detail/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/detail/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/detail/dim.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/iid.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/include.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/is_joint_distribution.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/log_unnormalized_pdf.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/random.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/include.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/independent.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/is_joint_distribution.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/log_unnormalized_pdf.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/detail/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/detail/fun_wrap.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/include.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/log_unnormalized_pdf.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/delegate.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/is_joint_distribution.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/pointer.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/signature.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/random/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/random/concept/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/random/detail/
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/random/inner_sampler.hpp (contents, props changed)
   sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/unscope/
   sandbox/statistics/distribution_joint/libs/
   sandbox/statistics/distribution_joint/libs/statistics/
   sandbox/statistics/distribution_joint/libs/statistics/detail/
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/doc/
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/doc/readme.txt (contents, props changed)
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/example/
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/example/random.cpp (contents, props changed)
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/example/random.h (contents, props changed)
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/src/
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/src/main.cpp (contents, props changed)
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/test/
   sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/test/functions.cpp (contents, props changed)

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/detail/dim.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/detail/dim.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,48 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::detail::dim.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_JOINT_DISTRIBUTION_DETAIL_DIM_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTION_DETAIL_DIM_HPP_ER_2009
+#include <ostream>
+#include <boost/format.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+namespace detail{
+
+ class dim{
+ public:
+ typedef std::size_t size_type;
+
+ dim():n_(0){};
+ dim(size_type n):n_(n){};
+ const size_type& dimension()const{ return n_; }
+
+ friend std::ostream& operator<<(
+ std::ostream& out,
+ const dim& d
+ )
+ {
+ return (out << (boost::format("dim(%1%)")%d.dimension()).str());
+ }
+
+ private:
+ size_type n_;
+ };
+
+}// detail
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/iid.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/iid.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,87 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::iid::iid.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_JOINT_DISTRIBUTIONS_IID_IID_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTIONS_IID_IID_HPP_ER_2009
+#include <string>
+#include <sstream>
+#include <boost/format.hpp>
+#include <boost/range.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+#include <boost/statistics/detail/distribution_common/meta/inherit_policy.hpp>
+#include <boost/statistics/detail/distribution_toolkit/meta/is_pseudo_scalar_distribution.hpp>
+#include <boost/statistics/detail/distribution_toolkit/unscope/os.hpp>
+
+#include <boost/statistics/detail/distribution/joint/distributions/detail/dim.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ // An iid distribution
+ template<typename D>
+ class iid :
+ D,
+ public detail::dim,
+ public common::meta::inherit_policy<D>
+ {
+ typedef detail::dim dim_;
+ typedef std::string str_;
+ public:
+
+ //BOOST_MPL_ASSERT((
+ // distribution::toolkit::is_pseudo_scalar_distribution<D>
+ //));
+
+ typedef typename distribution::common::meta::value<
+ D
+ >::type value_type;
+ typedef D element_type;
+
+ iid(): D(), dim_(0){}
+ iid(const D& d,size_type dim):D(d),dim_(dim){}
+ iid(const iid& that):D(that),dim_(that){}
+
+ iid& operator=(const iid& that)
+ {
+ if(&that!=this){
+ static_cast<D&>(*this) = that;
+ static_cast<dim_&>(*this) = that;
+ }
+ return *this;
+ }
+
+ const element_type& element()const{
+ return static_cast<const D&>(*this);
+ }
+
+ str_ description()const
+ {
+ static const char* msg = "iid{%1%:i=0,...,%2%}";
+ std::stringstream sstr;
+
+ sstr << this->element();
+
+ return (
+ boost::format(msg)
+ % sstr.str()
+ % this->dimension()
+ ).str();
+ }
+ };
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/include.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/include.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::iid::include.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_JOINT_DISTRIBUTIONS_IID_INCLUDE_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTIONS_IID_INCLUDE_HPP_ER_2009
+
+#include <boost/statistics/detail/distribution/joint/distributions/iid/iid.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/iid/log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/iid/is_joint_distribution.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/iid/random.hpp>
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/is_joint_distribution.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/is_joint_distribution.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,30 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::iid::is_joint.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_JOINT_DISTRIBUTIONS_IID_IS_JOINT_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTIONS_IID_IS_JOINT_HPP_ER_2009
+#include <boost/mpl/bool.hpp>
+#include <boost/statistics/detail/distribution/joint/meta/is_joint_distribution.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/iid/iid.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ template<typename D>
+ struct is_joint_distribution< iid<D> > : mpl::bool_<true>{};
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/log_unnormalized_pdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/log_unnormalized_pdf.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,61 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::iid::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_JOINT_DISTRIBUTIONS_IID_LOG_UNNORMALIZED_PDF_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTIONS_IID_LOG_UNNORMALIZED_PDF_HPP_ER_2009
+#include <stdexcept>
+#include <numeric>
+#include <functional>
+#include <ostream>
+#include <boost/range.hpp>
+#include <boost/format.hpp>
+
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+
+#include <boost/statistics/detail/distribution_toolkit/fun_wrap/log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/iterator/distribution_function.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/iid/iid.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+
+ template<typename D,typename R>
+ typename distribution::common::meta::value<
+ distribution::joint::iid<D>
+ >::type
+ log_unnormalized_pdf(const distribution::joint::iid<D>& dist,const R& x){
+ static const char* msg =
+ "log_unnormalized_pdf(%1%,x) : size(x) = %2% != dim";
+ if( boost::size(x) != dist.dimension() ){
+ throw std::runtime_error(
+ (format(msg)%dist%size(x)).str()
+ );
+ }
+ typedef distribution::joint::iid<D> iid_;
+ typedef typename iid_::value_type val_;
+ val_ init = static_cast<val_>(0);
+ val_ log_pdf
+ = std::accumulate(
+ distribution::toolkit::iterator::make_distribution_function<
+ distribution::toolkit::fun_wrap::log_unnormalized_pdf_
+ >(dist.element(),boost::begin(x)),
+ distribution::toolkit::iterator::make_distribution_function<
+ distribution::toolkit::fun_wrap::log_unnormalized_pdf_
+ >(dist.element(),boost::end(x)),
+ init
+ );
+
+ return log_pdf;
+ };
+
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/random.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/iid/random.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,90 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::iid::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_JOINT_DISTRIBUTIONS_IID_RANDOM_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTIONS_IID_RANDOM_HPP_ER_2009
+#include <vector>
+#include <algorithm>
+#include <boost/range.hpp>
+#include <boost/statistics/detail/distribution_toolkit/meta/random.hpp>
+#include <boost/statistics/detail/distribution_toolkit/random/generator.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ template<typename D>
+ class random_iid : joint::iid<D>{
+ typedef joint::iid<D> iid_;
+ typedef typename common::meta::value<iid_>::type value_;
+ typedef std::vector<value_> cache_type;
+ typedef typename toolkit::meta::random<D>::type rand_;
+
+ public:
+ typedef typename rand_::input_type input_type;
+ typedef sub_range<const cache_type> result_type;
+
+ random_iid(){}
+ random_iid(iid_ jd) // can pass D (implicit conversion)
+ :iid_(jd),cache_(this->dimension()){}
+ random_iid(const random_iid& that)
+ :iid_(static_cast<const iid_&>(that)),cache_(that.cache_){}
+ random_iid& operator=(const random_iid& that)
+ {
+ if(&that!=this)
+ {
+ static_cast<iid_&>(*this) = static_cast<const iid_&>(that);
+ this->cache_ = that.cache_;
+ }
+ return *this;
+ }
+
+ typename iid_::size_type
+ dimension()const{
+ return static_cast<const iid_&>(*this).dimension();
+ }
+
+ template<typename U>
+ result_type operator()(U& urng)
+ {
+ std::generate_n(
+ boost::begin(this->cache_),
+ this->dimension(),
+ make_random_generator(
+ urng,
+ static_cast<const iid_&>(*this).element()
+ )
+ );
+
+ return result_type(this->cache_);
+
+ }
+
+ protected:
+ cache_type cache_;
+
+ };
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+
+ template<typename D>
+ statistics::detail::distribution::joint::random_iid<D>
+ make_random(const statistics::detail::distribution::joint::iid<D>& jd){
+ typedef statistics::detail::distribution::joint::random_iid<D> r_;
+ return r_(jd);
+ }
+
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/include.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/include.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,18 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::independent::include.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_JOINT_DISTRIBUTIONS_INDEPENDENT_INCLUDE_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTIONS_INDEPENDENT_INCLUDE_HPP_ER_2009
+
+#include <boost/statistics/detail/distribution/joint/distributions/independent/independent.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/independent/log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/independent/is_joint_distribution.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/independent/os.hpp>
+//#include <boost/statistics/detail/distribution/joint/distributions/independent/random.hpp>
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/independent.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/independent.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,97 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::independent::independent.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_JOINT_DISTRIBUTION_INDEPENDENT_INDEPENDENT_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTION_INDEPENDENT_INDEPENDENT_HPP_ER_2009
+#include <string>
+#include <sstream>
+#include <boost/format.hpp>
+#include <boost/range.hpp>
+#include <boost/foreach.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+#include <boost/statistics/detail/distribution_common/meta/inherit_policy.hpp>
+
+#include <boost/statistics/detail/distribution/joint/distributions/detail/dim.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ // Joint distribution of a collection of indepdendent variables, each from
+ // the same distribution, but with different parameters
+ template<typename R>
+ class independent
+ : public detail::dim,
+ public common::meta::inherit_policy<
+ typename remove_cv<
+ typename remove_reference<
+ typename range_value<R>::type
+ >::type
+ >::type
+ >
+ {
+ typedef detail::dim dim_;
+ typedef std::string str_;
+
+ public:
+
+ typedef
+ typename remove_cv<
+ typename remove_reference<
+ typename range_value<R>::type
+ >::type
+ >::type element_type;
+
+ typedef typename distribution::common::meta::value<
+ element_type
+ >::type value_type;
+
+ independent(){}
+ template<typename It>
+ independent(typename call_traits<R>::param_type elems )
+ :dim_(boost::size(elems)),elements_(elements){}
+ independent(const independent& that)
+ :dim_(that),elements_(that.elements_){}
+
+ independent& operator=(const independent& that)
+ {
+ if(&that!=this){
+ static_cast<dim_&>(*this) = that;
+ this->elements_ = that.elements_;
+ }
+ }
+
+ typename call_traits<R>::const_reference elements()const{
+ return this->elements_;
+ }
+
+ str_ decription()const{
+ std::stringstream sstr;
+ sstr << "independent(";
+ BOOST_FOREACH(const element_type& e,this->elements()){
+ sstr << e;
+ sstr << ' ';
+ }
+ sstr << ')';
+ return sstr.str();
+ }
+
+ private:
+ typename call_traits<R>::value_type elements_;
+ };
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/is_joint_distribution.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/is_joint_distribution.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,30 @@
+//////////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::independent::is_joint_distribution.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_JOINT_DISTRIBUTIONS_INDEPENDENT_IS_JOINT_DISTRIBUTION_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTIONS_INDEPENDENT_IS_JOINT_DISTRIBUTION_HPP_ER_2009
+#include <boost/mpl/bool.hpp>
+#include <boost/statistics/detail/distribution/joint/meta/is_joint_distribution.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/independent/independent.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ template<typename R>
+ struct is_joint_distribution< independent<R> > : mpl::bool_<true>{};
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/log_unnormalized_pdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/distributions/independent/log_unnormalized_pdf.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,72 @@
+//////////////////////////////////////////////////////////////////////////////////
+// distribution::joint::distributions::independent::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_JOINT_DISTRIBUTIONS_INDEPENDENT_LOG_UNNORMALIZED_PDF_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_DISTRIBUTIONS_INDEPENDENT_LOG_UNNORMALIZED_PDF_HPP_ER_2009
+#include <stdexcept>
+#include <numeric>
+#include <functional>
+#include <ostream>
+#include <boost/range.hpp>
+#include <boost/format.hpp>
+
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+
+#include <boost/statistics/detail/distribution_toolkit/fun_wrap/log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution_toolkit/iterator/distribution_function.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/independent/independent.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+
+ template<typename R,typename R1>
+ typename distribution::common::meta::value<
+ distribution::joint::independent<R>
+ >::type
+ log_unnormalized_pdf(
+ const distribution::joint::independent<R>& dist,
+ const R1& x
+ ){
+ static const char* msg =
+ "log_unnormalized_pdf(%1%,x) : size(x) = %2% != dim";
+ if( boost::size(x) != dist.dimension() ){
+ throw std::runtime_error(
+ (format(msg)%dist%size(x)).str()
+ );
+ }
+ typedef distribution::joint::independent<R> indep_;
+ typedef typename distribution::common::meta::value<
+ indep_
+ >::type val_;
+ typedef typename indep_::element_type dist_;
+ val_ init = static_cast<val_>(0);
+
+ typedef distribution::toolkit::fun_wrap::log_unnormalized_pdf_<
+ dist_
+ > f_;
+ boost::begin(dist.elements());
+ return std::inner_product(
+ boost::begin(dist.elements()),
+ boost::end(dist.elements()),
+ boost::begin(x),
+ init,
+ boost::lambda::_1 + boost::lambda::_2,
+ boost::lambda::bind(
+ f_::instance,
+ boost::lambda::_1,
+ boost::lambda::_2
+ )
+ );
+ }
+
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/detail/fun_wrap.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/detail/fun_wrap.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::fun_wrap::cdf::detail::fun_wrap.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_JOINT_FUN_WRAP_DETAIL_FUN_WRAP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_FUN_WRAP_DETAIL_FUN_WRAP_ER_2009
+#include <boost/statistics/detail/distribution/joint/meta/pointer.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+namespace fun_wrap{
+namespace detail{
+
+ template<typename D,typename R,typename pointer<D,R>::type f>
+ struct fun_wrap{
+ typedef function<D> fun_;
+ typedef typename pointer<D,R>::type type;
+ static type instance;
+ };
+
+ template<typename D,typename R,typename pointer<D,R>::type f>
+ typename fun_wrap<D,R,f>::type
+ fun_wrap<D,R,f>::instance = f;
+
+}// detail
+}// fun_wrap
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/include.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/include.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::fun_wrap::include.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_JOINT_FUN_WRAP_INCLUDE_PDF_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_FUN_WRAP_INCLUDE_PDF_ER_2009
+
+#include <boost/statistics/detail/distribution/joint/fun_wrap/log_unnormalized_pdf.hpp>
+
+#endif
+

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/log_unnormalized_pdf.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/fun_wrap/log_unnormalized_pdf.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::fun_wrap::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_JOINT_FUN_WRAP_LOG_UNNORMALIZED_PDF_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_FUN_WRAP_LOG_UNNORMALIZED_PDF_ER_2009
+#include <boost/statistics/detail/distribution/common/meta/value.hpp>
+#include <boost/statistics/detail/distribution/joint/fun_wrap/detail/fun_wrap.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ namespace fun_wrap{
+ template<typename D,typename R>
+ struct log_unnormalized_pdf_
+ : detail::fun_wrap<D,R,statistics::detail::log_unnormalized_pdf>{};
+ }
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/delegate.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/delegate.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::meta::delegate.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_JOINT_META_DELEGATE_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_META_DELEGATE_ER_2009
+#include <boost/function.hpp>
+#include <boost/statistics/detail/distribution/joint/meta/signature.hpp>
+#include <boost/statistics/detail/distribution/joint/meta/pointer.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ template<typename D,typename R>
+ struct delegate{
+ typedef signature<R> meta_sig;
+ typedef typename meta_sig::type sig_;
+ typedef boost::function<sig_> type;
+ };
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/is_joint_distribution.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/is_joint_distribution.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,30 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::meta::is_joint_distribution.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_JOINT_FUN_WRAP_META_IS_JOINT_DISTRIBUTION_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_FUN_WRAP_META_IS_JOINT_DISTRIBUTION_ER_2009
+#include <boost/mpl/bool.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ template<typename D>
+ struct is_joint_distribution : mpl::bool_<false> {};
+
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
+
+

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/pointer.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/pointer.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::meta::pointer.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_JOINT_META_POINTER_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_META_POINTER_ER_2009
+#include <boost/statistics/detail/distribution/joint/meta/signature.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ template<typename D,typename R>
+ struct pointer{
+ typedef signature<D,R> meta_sig_;
+ typedef typename meta_sig_::type sig_;
+ typedef sig_* type;
+ };
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/signature.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/meta/signature.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::meta::signature.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_JOINT_META_SIGNATURE_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_META_SIGNATURE_ER_2009
+#include <boost/statistics/detail/distribution_common/meta/value.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+ template<typename D,typename R>
+ struct signature{
+ typedef typename distribution::common::meta::value<D>::type value_type;
+ typedef value_type type(
+ const D&,
+ const R&
+ );
+ };
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/random/inner_sampler.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/boost/statistics/detail/distribution/joint/random/inner_sampler.hpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,84 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::random::inner_sampler.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_JOINT_RANDOM_INNER_SAMPLER_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_DISTRIBUTION_JOINT_RANDOM_INNER_SAMPLER_HPP_ER_2009
+#include <algorithm>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace distribution{
+namespace joint{
+
+
+ // Usage:
+ // std::for_each(
+ // b, // *b is a range
+ // e,
+ // make_inner_sampler(urng,random_dist)
+ // );
+ //
+ // U = V, V&
+ template<typename U, typename D>
+ class inner_sampler : D{
+
+ public:
+ inner_sampler(){}
+ inner_sampler(
+ typename call_traits<U>::param_type u,
+ const D& d
+ ):D(d),urng_(u){}
+ inner_sampler(const inner_sampler& that)
+ :D(static_cast<const D&>(that)),urng_(that.urng_){}
+ inner_sampler& operator=(const inner_sampler& that)
+ {
+ static_cast<D&>(*this) = static_cast<const D&>( that );
+ this->urng_ = that.urng_;
+
+ }
+
+ template<typename R>
+ void operator()(R& r){
+ typedef typename D::result_type res_;
+
+ res_ res = static_cast<D&>(*this)(this->ref_urng());
+ std::copy(
+ boost::begin(res),
+ boost::end(res),
+ boost::begin(r)
+ );
+
+ }
+
+ private:
+ typename call_traits<U>::reference
+ ref_urng(){
+ // useful in case a pointer
+ return this->urng_;
+ }
+ U urng_;
+
+ };
+
+ template<typename U,typename D>
+ inner_sampler<U&,D>
+ make_inner_sampler(U& urng,const D& random_dist){
+ return inner_sampler<U&,D>(urng,random_dist);
+ }
+
+
+}// joint
+}// distribution
+}// detail
+}// statistics
+}// boost
+
+
+#endif
+
\ No newline at end of file

Added: sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/doc/readme.txt
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/doc/readme.txt 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,38 @@
+//////////////////////////////////////////////////////////////////////////////
+// distribution::joint::doc::readme //
+// //
+// (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) //
+//////////////////////////////////////////////////////////////////////////////
+
+[ Contact ]
+
+erwann.rogard_at_[hidden]
+
+[ Overview ]
+
+These C++ classes mirror sandbox/statistics/distribution_toolkit but in the
+multivariate framework.
+
+[ Compiler ]
+
+gcc version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1
+
+[ Dependencies ]
+
+/usr/local/boost_1_40_0/
+/Users/erwann/sandbox/statistics/distribution_common/
+/Users/erwann/sandbox/statistics/distribution_toolkit/
+/Users/erwann/sandbox/statistics/mpl/
+
+
+[ History ]
+
+October 9th 2009 :
+ distribution_joint supersedes joint_dist.
+
+July 2009 : First version
+
+

Added: sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/example/random.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/example/random.cpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::example::random.cpp //
+// //
+// 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) //
+///////////////////////////////////////////////////////////////////////////////
+#include <algorithm>
+#include <boost/range.hpp>
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/foreach.hpp>
+#include <boost/statistics/detail/distribution_toolkit/distributions/normal/include.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/iid/include.hpp>
+//#include <boost/statistics/detail/distribution/joint/distributions/independent.hpp>
+
+#include <boost/statistics/detail/distribution/joint/random/inner_sampler.hpp>
+
+#include <libs/statistics/detail/distribution/joint/example/random.h>
+
+void example_random(std::ostream& out){
+ out << " -> example_random" << std::endl;
+ out.flush();
+
+ using namespace boost;
+ namespace stat = boost::statistics::detail;
+ namespace dist = stat::distribution;
+ namespace tk = dist::toolkit;
+ namespace dj = dist::joint;
+
+ const long dim = 2; // each sample of size dim
+ const long n = 1e1; // number of samples
+
+ typedef double val_;
+ typedef boost::mt19937 urng_;
+ typedef std::vector<val_> row_;
+ typedef std::vector<row_> mat_;
+ typedef math::normal_distribution<val_> dist_;
+ typedef dj::iid<dist_> iid_;
+ typedef dj::random_iid<dist_> random_iid_;
+
+ urng_ urng;
+
+ mat_ mat(n,row_(dim));
+ row_ lpdfs; lpdfs.reserve(n);
+
+ iid_ iid( dist_(), dim );
+
+ dist_ d;
+
+
+ std::for_each(
+ boost::begin(mat),
+ boost::end(mat),
+ dj::make_inner_sampler(
+ urng,
+ make_random(iid)
+ )
+ );
+
+ out << (format("sample of %1% draws from ")%n).str()
+ << iid.description()
+ << std::endl;
+
+ BOOST_FOREACH(const row_& r,mat){
+ out << std::endl;
+ BOOST_FOREACH(const val_& x,r){
+ out << x << " ";
+ }
+ }
+
+ out << "<-" << std::endl;
+
+}

Added: sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/example/random.h
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/example/random.h 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::example::random.h //
+// //
+// 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 LIBS_STATISTICS_DETAIL_DISTRIBUTION_JOINT_EXAMPLE_RANDOM_H_ER_2009
+#define LIBS_STATISTICS_DETAIL_DISTRIBUTION_JOINT_EXAMPLE_RANDOM_H_ER_2009
+#include <ostream>
+
+void example_random(std::ostream& out);
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/src/main.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/src/main.cpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::src::main.cpp //
+// //
+// 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) //
+///////////////////////////////////////////////////////////////////////////////
+#include <iostream>
+#include <libs/statistics/detail/distribution/joint/test/functions.cpp>
+#include <libs/statistics/detail/distribution/joint/example/random.h>
+
+int main(){
+ typedef double val_;
+ typedef std::vector<val_> vec_;
+
+ example_random(std::cout);
+ test_functions<val_,vec_>(std::cout);
+
+ return 0;
+}

Added: sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/test/functions.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/distribution_joint/libs/statistics/detail/distribution/joint/test/functions.cpp 2009-10-09 22:53:59 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,64 @@
+///////////////////////////////////////////////////////////////////////////////
+// distribution::joint::test::functions.cpp //
+// //
+// 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 LIBS_STATISTICS_DETAIL_DISTRIBUTION_JOINT_TEST_FUNCTIONS_HPP_ER_2009
+#define LIBS_STATISTICS_DETAIL_DISTRIBUTION_JOINT_TEST_FUNCTIONS_HPP_ER_2009
+#include <vector>
+#include <boost/statistics/detail/distribution_toolkit/distributions/normal/include.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/iid/iid.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/iid/log_unnormalized_pdf.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/independent/independent.hpp>
+#include <boost/statistics/detail/distribution/joint/distributions/independent/log_unnormalized_pdf.hpp>
+
+#include <boost/statistics/detail/distribution_common/concept/unary/log_unnormalized_pdf.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,typename X>
+void test_functions(std::ostream& os)
+{
+ os << "-> test_functions" << std::endl;
+
+ using namespace boost;
+ namespace stat = boost::statistics::detail;
+ namespace dist = stat::distribution;
+ namespace tk = dist::toolkit;
+ namespace dj = dist::joint;
+ namespace dc = dist::common;
+ namespace dc_c = dc::concept;
+
+ typedef dc::meta::wrapper_variable<X> x_;
+ typedef dc::meta::wrapper_probability<T,x_> p_x_;
+
+ {
+ typedef math::normal_distribution<T> d_;
+ typedef dj::iid<d_> jd_;
+ typedef dc::meta::wrapper_distribution<jd_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ dc_c::LogUnnormalizedPdf<w_>
+ ));
+
+ }
+ {
+ typedef math::normal_distribution<T> d_;
+ typedef std::vector<d_> ds_;
+ typedef dj::independent<ds_> jd_;
+ typedef dc::meta::wrapper_distribution<jd_,p_x_> w_;
+
+ BOOST_CONCEPT_ASSERT((
+ 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