diff --git a/examples/speed_vs_root.cpp b/examples/speed_vs_root.cpp index 7faf1a2d..499edb87 100644 --- a/examples/speed_vs_root.cpp +++ b/examples/speed_vs_root.cpp @@ -43,7 +43,7 @@ void compare_1d(unsigned n) double best_root = std::numeric_limits::max(); double best_boost = std::numeric_limits::max(); - for (unsigned k = 0; k < 3; ++k) { + for (unsigned k = 0; k < 10; ++k) { TH1I hroot("", "", 100, 0, 1); clock_t t = clock(); for (unsigned i = 0; i < n; ++i) @@ -72,7 +72,7 @@ void compare_3d(unsigned n) double best_root = std::numeric_limits::max(); double best_boost = std::numeric_limits::max(); - for (unsigned k = 0; k < 3; ++k) { + for (unsigned k = 0; k < 10; ++k) { TH3I hroot("", "", 100, 0, 1, 100, 0, 1, 100, 0, 1); clock_t t = clock(); for (unsigned i = 0; i < n; ++i) @@ -102,7 +102,7 @@ void compare_6d(unsigned n) double best_root = std::numeric_limits::max(); double best_boost = std::numeric_limits::max(); - for (unsigned k = 0; k < 3; ++k) { + for (unsigned k = 0; k < 10; ++k) { double x[6]; vector bin(6, 10); vector min(6, 0); diff --git a/include/boost/histogram/axis.hpp b/include/boost/histogram/axis.hpp index 7240835c..fb5db77a 100644 --- a/include/boost/histogram/axis.hpp +++ b/include/boost/histogram/axis.hpp @@ -248,8 +248,6 @@ typedef variant< integer_axis > axis_type; -typedef std::vector axes_type; - std::ostream& operator<<(std::ostream&, const axis_type&); } diff --git a/include/boost/histogram/histogram.hpp b/include/boost/histogram/histogram.hpp index abbf4b87..41d82e54 100644 --- a/include/boost/histogram/histogram.hpp +++ b/include/boost/histogram/histogram.hpp @@ -172,7 +172,7 @@ private: ar & data_; } - friend class buffer_access; + friend class histogram_access; }; histogram operator+(const histogram& a, const histogram& b) { diff --git a/include/boost/histogram/histogram_base.hpp b/include/boost/histogram/histogram_base.hpp index aca55fd8..c5ff3e53 100644 --- a/include/boost/histogram/histogram_base.hpp +++ b/include/boost/histogram/histogram_base.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -21,7 +22,8 @@ namespace histogram { // holds an array of axis and computes the internal index class histogram_base { public: - typedef uint64_t size_type; + typedef container::static_vector axes_type; + typedef uintptr_t size_type; histogram_base(const histogram_base&); histogram_base& operator=(const histogram_base&); @@ -55,7 +57,7 @@ protected: update_buffers(); \ } -// generates constructors taking 2 to AXIS_LIMIT arguments +// generates constructors taking 1 to AXIS_LIMIT arguments BOOST_PP_REPEAT_FROM_TO(1, BOOST_HISTOGRAM_AXIS_LIMIT, BOOST_HISTOGRAM_BASE_CTOR, nil) bool operator==(const histogram_base&) const; @@ -106,9 +108,15 @@ private: void serialize(Archive& ar, unsigned version) { using namespace serialization; - ar & axes_; - if (Archive::is_loading::value) + unsigned size = axes_.size(); + ar & size; + if (Archive::is_loading::value) { + axes_.resize(size); + ar & serialization::make_array(&axes_[0], size); update_buffers(); + } else { + ar & serialization::make_array(&axes_[0], size); + } } }; diff --git a/src/python/histogram.cpp b/src/python/histogram.cpp index 7edeaddd..6d040775 100644 --- a/src/python/histogram.cpp +++ b/src/python/histogram.cpp @@ -29,7 +29,7 @@ histogram_init(python::tuple args, python::dict kwargs) { } // normal constructor - axes_type axes; + histogram_base::axes_type axes; for (unsigned i = 1, n = len(args); i < n; ++i) { object pa = args[i]; extract er(pa); @@ -135,7 +135,7 @@ histogram_getitem(const histogram& self, python::object oidx) { return self.value(self.dim(), idx); } -class buffer_access { +class histogram_access { public: static python::dict @@ -161,8 +161,8 @@ void register_histogram() >("histogram", no_init) .def("__init__", raw_function(histogram_init)) // shadowed C++ ctors - .def(init()) - .add_property("__array_interface__", &buffer_access::histogram_array_interface) + .def(init()) + .add_property("__array_interface__", &histogram_access::histogram_array_interface) .def("fill", raw_function(histogram_fill)) .add_property("depth", &histogram::depth) .add_property("sum", &histogram::sum) diff --git a/src/python/histogram_base.cpp b/src/python/histogram_base.cpp index 626c5407..0e3a0f52 100644 --- a/src/python/histogram_base.cpp +++ b/src/python/histogram_base.cpp @@ -275,7 +275,7 @@ void register_histogram_base() { // used to pass arguments from raw python init to specialized C++ constructors class_ >("vector_double", no_init); class_ >("vector_string", no_init); - class_("axes", no_init); + class_("axes", no_init); class_("regular_axis", no_init) .def(init(