mirror of
https://github.com/boostorg/histogram.git
synced 2026-01-30 20:02:13 +00:00
updating tests, include examples in docu
This commit is contained in:
26
examples/module_cpp_filler.cpp
Normal file
26
examples/module_cpp_filler.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2015-2016 Hans Dembinski
|
||||
//
|
||||
// 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 <boost/python.hpp>
|
||||
#include <boost/histogram.hpp>
|
||||
#include <boost/random/mersenne_twister.hpp>
|
||||
#include <boost/random/normal_distribution.hpp>
|
||||
|
||||
namespace br = boost::random;
|
||||
namespace bh = boost::histogram;
|
||||
namespace bp = boost::python;
|
||||
|
||||
void process(bh::histogram<bh::Dynamic, bh::builtin_axes>& h) {
|
||||
br::mt19937 gen;
|
||||
br::normal_distribution<> norm;
|
||||
// fill histogram
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
h.fill(norm(gen), norm(gen));
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE(cpp_filler) {
|
||||
bp::def("process", process);
|
||||
}
|
||||
Reference in New Issue
Block a user