clang format

This commit is contained in:
Hans Dembinski
2017-11-06 11:50:05 +01:00
parent ba274ed04d
commit 52dfdbc585
8 changed files with 144 additions and 153 deletions

View File

@@ -214,7 +214,9 @@ struct pow {
return std::pow(v, 1.0 / value);
}
double value = 1.0;
bool operator==(const pow &other) const noexcept { return value == other.value; }
bool operator==(const pow &other) const noexcept {
return value == other.value;
}
template <class Archive> void serialize(Archive &, unsigned);
};
} // namespace transform
@@ -240,8 +242,7 @@ public:
* \param uoflow whether to add under-/overflow bins.
* \param trans arguments passed to the transform.
*/
regular(unsigned n, value_type min, value_type max,
string_view label = {},
regular(unsigned n, value_type min, value_type max, string_view label = {},
enum uoflow uo = ::boost::histogram::axis::uoflow::on,
Transform trans = Transform())
: axis_base_uoflow(n, label, uo), Transform(trans),
@@ -282,8 +283,7 @@ public:
}
bool operator==(const regular &o) const noexcept {
return axis_base_uoflow::operator==(o) &&
Transform::operator==(o) &&
return axis_base_uoflow::operator==(o) && Transform::operator==(o) &&
min_ == o.min_ && delta_ == o.delta_;
}
@@ -296,7 +296,7 @@ public:
}
const Transform &transform() const noexcept {
return static_cast<const Transform&>(*this);
return static_cast<const Transform &>(*this);
}
private:
@@ -312,8 +312,7 @@ private:
* perimeter value. Therefore, there are no overflow/underflow
* bins for this axis. Binning is a O(1) operation.
*/
template <typename RealType = double>
class circular : public axis_base {
template <typename RealType = double> class circular : public axis_base {
public:
using value_type = RealType;
using bin_type = interval<value_type>;
@@ -377,8 +376,7 @@ private:
* Binning is a O(log(N)) operation. If speed matters
* and the problem domain allows it, prefer a regular.
*/
template <typename RealType = double>
class variable : public axis_base_uoflow {
template <typename RealType = double> class variable : public axis_base_uoflow {
public:
using value_type = RealType;
using bin_type = interval<value_type>;
@@ -390,8 +388,7 @@ public:
* \param label description of the axis.
* \param uoflow whether to add under-/overflow bins.
*/
variable(std::initializer_list<value_type> x,
string_view label = {},
variable(std::initializer_list<value_type> x, string_view label = {},
enum uoflow uo = ::boost::histogram::axis::uoflow::on)
: axis_base_uoflow(x.size() - 1, label, uo),
x_(new value_type[x.size()]) {
@@ -473,8 +470,7 @@ private:
* Binning is a O(1) operation. This axis operates
* faster than a regular.
*/
template <typename IntType = int>
class integer : public axis_base_uoflow {
template <typename IntType = int> class integer : public axis_base_uoflow {
public:
using value_type = IntType;
using bin_type = interval<value_type>;
@@ -534,8 +530,7 @@ private:
* for this axis, which counts values that are not part of the set.
* Binning is a O(1) operation. The value type must be hashable.
*/
template <typename T = int>
class category : public axis_base {
template <typename T = int> class category : public axis_base {
using map_type = bimap<T, int>;
public:

View File

@@ -57,7 +57,8 @@ struct weight {
}
template <typename T>
explicit weight(const T &t) : w(static_cast<double>(t)), w2(static_cast<double>(t)) {}
explicit weight(const T &t)
: w(static_cast<double>(t)), w2(static_cast<double>(t)) {}
template <typename T> weight &operator=(const T &t) {
w = static_cast<double>(t);

View File

@@ -67,44 +67,67 @@ inline detail::keep_dynamic keep(unsigned i, Rest... rest) {
// fast operators (boost::operators does not use rvalue references yet)
template <typename Variant, typename Axes, typename Storage>
histogram<Variant, Axes, Storage> && operator+(histogram<Variant, Axes, Storage> &&a,
const histogram<Variant, Axes, Storage> &b)
{ a+=b; return std::move(a); }
histogram<Variant, Axes, Storage> &&
operator+(histogram<Variant, Axes, Storage> &&a,
const histogram<Variant, Axes, Storage> &b) {
a += b;
return std::move(a);
}
template <typename Variant, typename Axes, typename Storage>
histogram<Variant, Axes, Storage>&& operator+(histogram<Variant, Axes, Storage> &&a,
histogram<Variant, Axes, Storage> &&b)
{ a+=b; return std::move(a); }
histogram<Variant, Axes, Storage> &&
operator+(histogram<Variant, Axes, Storage> &&a,
histogram<Variant, Axes, Storage> &&b) {
a += b;
return std::move(a);
}
template <typename Variant, typename Axes, typename Storage>
histogram<Variant, Axes, Storage>&& operator+(const histogram<Variant, Axes, Storage> &a,
histogram<Variant, Axes, Storage> &&b)
{ b+=a; return std::move(b); }
histogram<Variant, Axes, Storage> &&
operator+(const histogram<Variant, Axes, Storage> &a,
histogram<Variant, Axes, Storage> &&b) {
b += a;
return std::move(b);
}
template <typename Variant, typename Axes, typename Storage>
histogram<Variant, Axes, Storage> operator+(const histogram<Variant, Axes, Storage> &a,
const histogram<Variant, Axes, Storage> &b)
{ histogram<Variant, Axes, Storage> r(a); r+=b; return r; }
histogram<Variant, Axes, Storage>
operator+(const histogram<Variant, Axes, Storage> &a,
const histogram<Variant, Axes, Storage> &b) {
histogram<Variant, Axes, Storage> r(a);
r += b;
return r;
}
template <typename Variant, typename Axes, typename Storage>
histogram<Variant, Axes, Storage>&& operator*(histogram<Variant, Axes, Storage> &&a,
const double x)
{ a*=x; return std::move(a); }
histogram<Variant, Axes, Storage> &&
operator*(histogram<Variant, Axes, Storage> &&a, const double x) {
a *= x;
return std::move(a);
}
template <typename Variant, typename Axes, typename Storage>
histogram<Variant, Axes, Storage>&& operator*(const double x,
histogram<Variant, Axes, Storage> &&b)
{ b*=x; return std::move(b); }
histogram<Variant, Axes, Storage> &&
operator*(const double x, histogram<Variant, Axes, Storage> &&b) {
b *= x;
return std::move(b);
}
template <typename Variant, typename Axes, typename Storage>
histogram<Variant, Axes, Storage> operator*(const histogram<Variant, Axes, Storage> &a,
const double x)
{ histogram<Variant, Axes, Storage> r(a); r*=x; return r; }
histogram<Variant, Axes, Storage>
operator*(const histogram<Variant, Axes, Storage> &a, const double x) {
histogram<Variant, Axes, Storage> r(a);
r *= x;
return r;
}
template <typename Variant, typename Axes, typename Storage>
histogram<Variant, Axes, Storage> operator*(const double x,
const histogram<Variant, Axes, Storage> &b)
{ histogram<Variant, Axes, Storage> r(b); r*=x; return r; }
histogram<Variant, Axes, Storage>
operator*(const double x, const histogram<Variant, Axes, Storage> &b) {
histogram<Variant, Axes, Storage> r(b);
r *= x;
return r;
}
} // namespace histogram
} // namespace boost

View File

@@ -430,24 +430,20 @@ private:
};
template <typename... Axes>
inline histogram<
Dynamic, detail::combine<builtin_axes, mpl::vector<Axes...>>>
inline histogram<Dynamic, detail::combine<builtin_axes, mpl::vector<Axes...>>>
make_dynamic_histogram(Axes &&... axes) {
return histogram<Dynamic, detail::combine<
builtin_axes, mpl::vector<Axes...>>>(
return histogram<Dynamic,
detail::combine<builtin_axes, mpl::vector<Axes...>>>(
std::forward<Axes>(axes)...);
}
template <typename Storage, typename... Axes>
inline histogram<
Dynamic, detail::combine<builtin_axes, mpl::vector<Axes...>>,
Storage>
inline histogram<Dynamic, detail::combine<builtin_axes, mpl::vector<Axes...>>,
Storage>
make_dynamic_histogram_with(Axes &&... axes) {
return histogram<
Dynamic,
detail::combine<builtin_axes, mpl::vector<Axes...>>,
Storage>(std::forward<Axes>(axes)...);
return histogram<Dynamic, detail::combine<builtin_axes, mpl::vector<Axes...>>,
Storage>(std::forward<Axes>(axes)...);
}
} // namespace histogram

View File

@@ -50,8 +50,7 @@ void serialize(Archive &ar, array_storage<Container> &store,
}
template <class Archive>
void adaptive_storage::serialize(Archive &ar,
unsigned /* version */) {
void adaptive_storage::serialize(Archive &ar, unsigned /* version */) {
using detail::array;
std::size_t size = this->size();
ar &size;
@@ -106,11 +105,13 @@ void adaptive_storage::serialize(Archive &ar,
tid = 4;
ar &tid;
ar &serialization::make_array(a->begin(), size);
} else if (array<detail::mp_int> *a = get<array<detail::mp_int>>(&buffer_)) {
} else if (array<detail::mp_int> *a =
get<array<detail::mp_int>>(&buffer_)) {
tid = 5;
ar &tid;
ar &serialization::make_array(a->begin(), size);
} else if (array<detail::weight> *a = get<array<detail::weight>>(&buffer_)) {
} else if (array<detail::weight> *a =
get<array<detail::weight>>(&buffer_)) {
tid = 6;
ar &tid;
ar &serialization::make_array(a->begin(), size);

View File

@@ -56,8 +56,7 @@ public:
std::size_t size = 0;
};
template <typename T>
class array : public array_base {
template <typename T> class array : public array_base {
public:
explicit array(const std::size_t s) : array_base(s), ptr(new T[s]) {
std::fill(begin(), end(), T(0));
@@ -76,8 +75,7 @@ public:
}
return *this;
}
array(array &&rhs)
: array_base(std::move(rhs)), ptr(std::move(rhs.ptr)) {
array(array &&rhs) : array_base(std::move(rhs)), ptr(std::move(rhs.ptr)) {
rhs.size = 0;
}
array &operator=(array &&rhs) {
@@ -109,20 +107,14 @@ private:
std::unique_ptr<T[]> ptr;
};
template <>
class array<void> : public array_base {
template <> class array<void> : public array_base {
public:
using array_base::array_base;
};
using any_array =
variant<array<void>,
array<uint8_t>,
array<uint16_t>,
array<uint32_t>,
array<uint64_t>,
array<mp_int>,
array<weight>>;
variant<array<void>, array<uint8_t>, array<uint16_t>, array<uint32_t>,
array<uint64_t>, array<mp_int>, array<weight>>;
template <typename T> struct next_type;
template <> struct next_type<uint8_t> { using type = uint16_t; };
@@ -131,16 +123,14 @@ template <> struct next_type<uint32_t> { using type = uint64_t; };
template <> struct next_type<uint64_t> { using type = mp_int; };
template <typename T> using next = typename next_type<T>::type;
template <typename T>
inline bool safe_increase(T& t) {
template <typename T> inline bool safe_increase(T &t) {
if (t == std::numeric_limits<T>::max())
return false;
++t;
return true;
}
template <typename T, typename U>
inline bool safe_assign(T& t, const U& u) {
template <typename T, typename U> inline bool safe_assign(T &t, const U &u) {
if (std::numeric_limits<T>::max() < std::numeric_limits<U>::max() &&
std::numeric_limits<T>::max() < u)
return false;
@@ -148,8 +138,7 @@ inline bool safe_assign(T& t, const U& u) {
return true;
}
template <typename T, typename U>
inline bool safe_radd(T& t, const U& u) {
template <typename T, typename U> inline bool safe_radd(T &t, const U &u) {
if ((std::numeric_limits<T>::max() - t) < u)
return false;
t += static_cast<T>(u);
@@ -157,8 +146,7 @@ inline bool safe_radd(T& t, const U& u) {
}
// float rounding is a mess, the equal sign is necessary here
template <typename T>
inline bool safe_radd(T& t, const double u) {
template <typename T> inline bool safe_radd(T &t, const double u) {
if ((std::numeric_limits<T>::max() - t) <= u)
return false;
t += u;
@@ -171,8 +159,7 @@ struct size_visitor : public static_visitor<std::size_t> {
}
};
template <typename RHS>
struct assign_visitor : public static_visitor<void> {
template <typename RHS> struct assign_visitor : public static_visitor<void> {
any_array &lhs_any;
const std::size_t idx;
const RHS &rhs;
@@ -191,9 +178,7 @@ struct assign_visitor : public static_visitor<void> {
operator()(get<array<uint8_t>>(lhs_any));
}
void operator()(array<mp_int> &lhs) const {
lhs[idx].assign(rhs);
}
void operator()(array<mp_int> &lhs) const { lhs[idx].assign(rhs); }
void operator()(array<weight> &lhs) const { lhs[idx] = rhs; }
};
@@ -201,8 +186,7 @@ struct assign_visitor : public static_visitor<void> {
struct increase_visitor : public static_visitor<void> {
any_array &lhs_any;
const std::size_t idx;
increase_visitor(any_array& a, const std::size_t i)
: lhs_any(a), idx(i) {}
increase_visitor(any_array &a, const std::size_t i) : lhs_any(a), idx(i) {}
template <typename T> void operator()(array<T> &lhs) const {
if (!safe_increase(lhs[idx])) {
@@ -253,13 +237,9 @@ struct value_visitor : public static_visitor<double> {
return static_cast<double>(b[idx]);
}
double operator()(const array<void> & /*b*/) const {
return 0;
}
double operator()(const array<void> & /*b*/) const { return 0; }
double operator()(const array<weight> &b) const {
return b[idx].w;
}
double operator()(const array<weight> &b) const { return b[idx].w; }
};
struct variance_visitor : public static_visitor<double> {
@@ -270,13 +250,9 @@ struct variance_visitor : public static_visitor<double> {
return static_cast<double>(b[idx]);
}
double operator()(const array<void> & /*b*/) const {
return 0;
}
double operator()(const array<void> & /*b*/) const { return 0; }
double operator()(const array<weight> &b) const {
return b[idx].w2;
}
double operator()(const array<weight> &b) const { return b[idx].w2; }
};
template <typename RHS> struct radd_visitor : public static_visitor<void> {
@@ -307,7 +283,6 @@ template <typename RHS> struct radd_visitor : public static_visitor<void> {
void operator()(array<weight> &lhs) const { lhs[idx] += rhs; }
};
template <> struct radd_visitor<weight> : public static_visitor<void> {
any_array &lhs_any;
const std::size_t idx;
@@ -325,15 +300,13 @@ template <> struct radd_visitor<weight> : public static_visitor<void> {
operator()(get<array<weight>>(lhs_any));
}
void operator()(array<weight> &lhs) const {
lhs[idx] += rhs;
}
void operator()(array<weight> &lhs) const { lhs[idx] += rhs; }
};
// precondition: both arrays must have same size and may not be identical
struct radd_array_visitor : public static_visitor<void> {
any_array& lhs_any;
radd_array_visitor(any_array& l) : lhs_any(l) {}
any_array &lhs_any;
radd_array_visitor(any_array &l) : lhs_any(l) {}
template <typename T> void operator()(const array<T> &rhs) const {
for (auto i = 0ul; i < rhs.size; ++i)
apply_visitor(radd_visitor<T>(lhs_any, i, rhs[i]), lhs_any);
@@ -342,15 +315,15 @@ struct radd_array_visitor : public static_visitor<void> {
};
struct rmul_visitor : public static_visitor<void> {
any_array& lhs_any;
any_array &lhs_any;
const double x;
rmul_visitor(any_array& l, const double v) : lhs_any(l), x(v) {}
template <typename T> void operator()(array<T>& lhs) const {
rmul_visitor(any_array &l, const double v) : lhs_any(l), x(v) {}
template <typename T> void operator()(array<T> &lhs) const {
lhs_any = array<weight>(lhs);
operator()(get<array<weight>>(lhs_any));
}
void operator()(array<void>&) const {}
void operator()(array<weight>& lhs) const {
void operator()(array<void> &) const {}
void operator()(array<weight> &lhs) const {
for (auto i = 0ul; i != lhs.size; ++i)
lhs[i] *= x;
}
@@ -368,7 +341,7 @@ struct bicmp_visitor : public static_visitor<bool> {
bool operator()(const array<T> &b1, const array<void> &b2) const {
if (b1.size != b2.size)
return false;
return std::all_of(b1.begin(), b1.end(), [](const T& t) { return t == 0; });
return std::all_of(b1.begin(), b1.end(), [](const T &t) { return t == 0; });
}
template <typename T>
@@ -385,6 +358,7 @@ struct bicmp_visitor : public static_visitor<bool> {
class adaptive_storage {
using buffer_type = detail::any_array;
public:
using value_type = double;
@@ -397,12 +371,12 @@ public:
adaptive_storage &operator=(adaptive_storage &&) = default;
template <typename RHS, typename = detail::is_storage<RHS>>
explicit adaptive_storage(const RHS &rhs) : buffer_(detail::array<void>(rhs.size())) {
explicit adaptive_storage(const RHS &rhs)
: buffer_(detail::array<void>(rhs.size())) {
using T = typename RHS::value_type;
for (auto i = 0ul, n = rhs.size(); i < n; ++i) {
apply_visitor(
detail::assign_visitor<T>(buffer_, i, rhs.value(i)),
buffer_);
apply_visitor(detail::assign_visitor<T>(buffer_, i, rhs.value(i)),
buffer_);
}
}
@@ -414,15 +388,16 @@ public:
buffer_ = detail::array<void>(n);
}
for (auto i = 0ul; i < n; ++i) {
apply_visitor(
detail::assign_visitor<T>(buffer_, i, rhs.value(i)),
buffer_);
apply_visitor(detail::assign_visitor<T>(buffer_, i, rhs.value(i)),
buffer_);
}
}
return *this;
}
std::size_t size() const { return apply_visitor(detail::size_visitor(), buffer_); }
std::size_t size() const {
return apply_visitor(detail::size_visitor(), buffer_);
}
void increase(std::size_t i) {
apply_visitor(detail::increase_visitor(buffer_, i), buffer_);
@@ -433,11 +408,13 @@ public:
}
template <typename T>
void add(std::size_t i, const T& value, const T& variance) {
void add(std::size_t i, const T &value, const T &variance) {
if (value == variance) {
apply_visitor(detail::radd_visitor<T>(buffer_, i, value), buffer_);
} else {
apply_visitor(detail::radd_visitor<detail::weight>(buffer_, i, detail::weight(value, variance)), buffer_);
apply_visitor(detail::radd_visitor<detail::weight>(
buffer_, i, detail::weight(value, variance)),
buffer_);
}
}
@@ -458,12 +435,11 @@ public:
}
// precondition: storages have same size
adaptive_storage& operator+=(const adaptive_storage& rhs) {
adaptive_storage &operator+=(const adaptive_storage &rhs) {
if (this == &rhs) {
for (auto i = 0ul, n = size(); i < n; ++i)
add(i, rhs.value(i), rhs.variance(i)); // this is losing precision
}
else {
} else {
apply_visitor(detail::radd_array_visitor(buffer_), rhs.buffer_);
}
return *this;
@@ -471,13 +447,15 @@ public:
// precondition: storages have same size
template <typename RHS, typename = detail::is_storage<RHS>>
adaptive_storage& operator+=(const RHS& rhs) {
adaptive_storage &operator+=(const RHS &rhs) {
for (auto i = 0ul, n = size(); i < n; ++i)
apply_visitor(detail::radd_visitor<typename RHS::value_type>(buffer_, i, rhs.value(i)), buffer_);
apply_visitor(detail::radd_visitor<typename RHS::value_type>(
buffer_, i, rhs.value(i)),
buffer_);
return *this;
}
adaptive_storage& operator*=(const value_type x) {
adaptive_storage &operator*=(const value_type x) {
apply_visitor(detail::rmul_visitor(buffer_, x), buffer_);
return *this;
}

View File

@@ -9,9 +9,9 @@
#include <algorithm>
#include <boost/histogram/detail/meta.hpp>
#include <type_traits>
#include <cstddef>
#include <memory>
#include <type_traits>
// forward declaration for serialization
namespace boost {
@@ -74,10 +74,9 @@ public:
std::size_t size() const noexcept { return size_; }
void increase(std::size_t i) noexcept { ++array_[i]; }
void add(std::size_t i, const value_type& n) noexcept {
array_[i] += n;
}
void add(std::size_t i, const value_type& n, const value_type& /* variance */) noexcept {
void add(std::size_t i, const value_type &n) noexcept { array_[i] += n; }
void add(std::size_t i, const value_type &n,
const value_type & /* variance */) noexcept {
array_[i] += n;
}
@@ -85,13 +84,13 @@ public:
value_type variance(std::size_t i) const noexcept { return array_[i]; }
template <typename U>
array_storage& operator+=(const array_storage<U>& rhs) noexcept {
array_storage &operator+=(const array_storage<U> &rhs) noexcept {
for (auto i = 0ul; i < size_; ++i)
array_[i] += rhs.array_[i];
return *this;
}
array_storage& operator*=(const value_type x) noexcept {
array_storage &operator*=(const value_type x) noexcept {
for (auto i = 0ul; i < size_; ++i)
array_[i] *= x;
return *this;

View File

@@ -76,8 +76,8 @@ template <typename Type> void run_tests() {
// init_2
{
auto h = make_histogram<adaptive_storage>(
Type(), axis::regular<>{3, -1, 1}, axis::integer<>{-1, 2});
auto h = make_histogram<adaptive_storage>(Type(), axis::regular<>{3, -1, 1},
axis::integer<>{-1, 2});
BOOST_TEST_EQ(h.dim(), 2);
BOOST_TEST_EQ(h.size(), 25);
BOOST_TEST_EQ(shape(h.axis(0_c)), 5);
@@ -89,9 +89,9 @@ template <typename Type> void run_tests() {
// init_3
{
auto h = make_histogram<adaptive_storage>(
Type(), axis::regular<>{3, -1, 1}, axis::integer<>{-1, 2},
axis::circular<>{3});
auto h = make_histogram<adaptive_storage>(Type(), axis::regular<>{3, -1, 1},
axis::integer<>{-1, 2},
axis::circular<>{3});
BOOST_TEST_EQ(h.dim(), 3);
BOOST_TEST_EQ(h.size(), 75);
auto h2 = make_histogram<array_storage<unsigned>>(
@@ -132,7 +132,7 @@ template <typename Type> void run_tests() {
// copy_ctor
{
auto h = make_histogram<adaptive_storage>(Type(), axis::integer<>{0, 2},
axis::integer<>{0, 3});
axis::integer<>{0, 3});
h.fill(0, 0);
auto h2 = decltype(h)(h);
BOOST_TEST(h2 == h);
@@ -144,7 +144,7 @@ template <typename Type> void run_tests() {
// copy_assign
{
auto h = make_histogram<adaptive_storage>(Type(), axis::integer<>(0, 1),
axis::integer<>(0, 2));
axis::integer<>(0, 2));
h.fill(0, 0);
auto h2 = decltype(h)();
BOOST_TEST(h != h2);
@@ -162,7 +162,7 @@ template <typename Type> void run_tests() {
// move
{
auto h = make_histogram<adaptive_storage>(Type(), axis::integer<>(0, 1),
axis::integer<>(0, 2));
axis::integer<>(0, 2));
h.fill(0, 0);
const auto href = h;
decltype(h) h2(std::move(h));
@@ -182,8 +182,7 @@ template <typename Type> void run_tests() {
// utility
{
auto a =
make_histogram<adaptive_storage>(Type(), axis::regular<>(1, 1, 2));
auto a = make_histogram<adaptive_storage>(Type(), axis::regular<>(1, 1, 2));
BOOST_TEST_EQ(size(a.axis()), 1);
BOOST_TEST_EQ(shape(a.axis()), 3);
BOOST_TEST_EQ(index(a.axis(), 1.0), 0);
@@ -202,7 +201,7 @@ template <typename Type> void run_tests() {
{
auto a = make_histogram<adaptive_storage>(Type(), axis::integer<>(0, 2));
auto b = make_histogram<adaptive_storage>(Type(), axis::integer<>(0, 2),
axis::integer<>(0, 3));
axis::integer<>(0, 3));
BOOST_TEST(a != b);
BOOST_TEST(b != a);
auto c = make_histogram<adaptive_storage>(Type(), axis::integer<>(0, 2));
@@ -210,8 +209,7 @@ template <typename Type> void run_tests() {
BOOST_TEST(c != b);
BOOST_TEST(a == c);
BOOST_TEST(c == a);
auto d =
make_histogram<adaptive_storage>(Type(), axis::regular<>(2, 0, 1));
auto d = make_histogram<adaptive_storage>(Type(), axis::regular<>(2, 0, 1));
BOOST_TEST(c != d);
BOOST_TEST(d != c);
c.fill(0);
@@ -417,8 +415,8 @@ template <typename Type> void run_tests() {
// d3w
{
auto h = make_histogram<adaptive_storage>(Type(), axis::integer<>(0, 3),
axis::integer<>(0, 4),
axis::integer<>(0, 5));
axis::integer<>(0, 4),
axis::integer<>(0, 5));
for (auto i = 0; i < size(h.axis(0_c)); ++i) {
for (auto j = 0; j < size(h.axis(1_c)); ++j) {
for (auto k = 0; k < size(h.axis(2_c)); ++k) {
@@ -613,7 +611,7 @@ template <typename Type> void run_tests() {
// reduce
{
auto h1 = make_histogram<adaptive_storage>(Type(), axis::integer<>(0, 2),
axis::integer<>(0, 3));
axis::integer<>(0, 3));
h1.fill(0, 0);
h1.fill(0, 1);
h1.fill(1, 0);
@@ -638,8 +636,8 @@ template <typename Type> void run_tests() {
BOOST_TEST(axis_equal(Type(), h1_1.axis(), h1.axis(1_c)));
auto h2 = make_histogram<adaptive_storage>(Type(), axis::integer<>(0, 2),
axis::integer<>(0, 3),
axis::integer<>(0, 4));
axis::integer<>(0, 3),
axis::integer<>(0, 4));
h2.fill(0, 0, 0);
h2.fill(0, 1, 0);
h2.fill(0, 1, 1);
@@ -704,22 +702,22 @@ template <typename T1, typename T2> void run_mixed_tests() {
// compare
{
auto a = make_histogram<adaptive_storage>(T1{}, axis::regular<>{3, 0, 3},
axis::integer<>(0, 2));
axis::integer<>(0, 2));
auto b = make_histogram<array_storage<int>>(T2{}, axis::regular<>{3, 0, 3},
axis::integer<>(0, 2));
BOOST_TEST_EQ(a, b);
auto b2 = make_histogram<adaptive_storage>(T2{}, axis::integer<>{0, 3},
axis::integer<>(0, 2));
axis::integer<>(0, 2));
BOOST_TEST_NE(a, b2);
auto b3 = make_histogram<adaptive_storage>(T2{}, axis::regular<>(3, 0, 4),
axis::integer<>(0, 2));
axis::integer<>(0, 2));
BOOST_TEST_NE(a, b3);
}
// copy_assign
{
auto a = make_histogram<adaptive_storage>(T1{}, axis::regular<>{3, 0, 3},
axis::integer<>(0, 2));
axis::integer<>(0, 2));
auto b = make_histogram<array_storage<int>>(T2{}, axis::regular<>{3, 0, 3},
axis::integer<>(0, 2));
a.fill(1, 1);