|
Boost : |
From: Niitsuma Hirotaka (hirotaka.niitsuma_at_[hidden])
Date: 2007-01-16 04:18:12
I made joint_histgram component and did little modify on existing components.
It is seem to a component can not depend on many other components.
In the following example, enabling switch
#define USE_ACC_MIN_MAX_IN_ACC_DENSITY 1
causes compile err in MSVC8
How to use more depended components?
usage::
#define USE_ACC_MIN_MAX_IN_ACC_DENSITY 0
#include <boost/accumulators/statistics/density.hpp>
#include <boost/accumulators/statistics/joint_histogram.hpp>
namespace accumulators = boost::accumulators;
double ddd=0.0;
accumulators::accumulator_set<double
, accumulators::stats<
accumulators::tag::joint_histogram< double ,
accumulators::tag::covariate1>
>
>acc(
accumulators::sample_cache_size=200
,accumulators::density_num_bins=50
,accumulators::sample = ddd
,accumulators::covariate1 = ddd
);
// two random number generators
boost::lagged_fibonacci607 rng;
boost::normal_distribution<> mean_sigma(0,1);
boost::variate_generator<boost::lagged_fibonacci607&,
boost::normal_distribution<> > normal(rng, mean_sigma);
int n=100000;
for (std::size_t i=0; i<n; ++i)
{
double d1=normal()*normal();
acc(normal(), accumulators::covariate1 = d1);
}
boost::numeric::ublas::matrix<double > jointhist;
jointhist = accumulators::joint_histogram(acc);
std::cout << jointhist<< std::endl;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk