update copyright (#55)

* add missing copyright notices
* workaround for xml_iarchive bug to handle XML with comments
* fixing min/max according to boost guidelines
This commit is contained in:
Hans Dembinski 2019-08-19 16:53:27 +02:00 committed by GitHub
parent 6df7625740
commit df647cf959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 332 additions and 61 deletions

View File

@ -1,10 +1,10 @@
# Copyright Hans Dembinski 2019.
#
# Use, modification, and distribution are # Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying # 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) # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# #
# Copyright Hans Dembinski 2019. # Based on original work by Antony Polukhin, see https://svn.boost.org/trac/boost/wiki/TravisCoverals
#
# Based on original work by Antony Polukhin, see https://svn.boost.org/trac/boost/wiki/TravisCoveralss
language: cpp language: cpp
os: linux os: linux

View File

@ -1,8 +1,8 @@
# Copyright 2018-2019 Peter Dimov, Hans Dembinski # Copyright Peter Dimov, Hans Dembinski 2018-2019
# Distributed under the Boost Software License, Version 1.0. # 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 # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
# Beware: Boost-CMake support is experimental; testing works, install target doesn't # Warning: Boost-CMake support is incomplete; testing works, install target doesn't
cmake_minimum_required(VERSION 3.6) cmake_minimum_required(VERSION 3.6)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2018 Mateusz Loskot <mateusz@loskot.net> # Copyright Mateusz Loskot 2018 <mateusz@loskot.net>
# Copyright Klemens David Morgenstern, Hans P. Dembinski 2016-2017 # Copyright Klemens David Morgenstern, Hans P. Dembinski 2016-2017
# #
# Use, modification and distribution is subject to the Boost Software License, # Use, modification and distribution is subject to the Boost Software License,

View File

@ -1,3 +1,10 @@
<!--
Copyright Hans Dembinski 2016 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
-->
# Histogram # Histogram
**Fast multi-dimensional histogram with convenient interface for C++14** **Fast multi-dimensional histogram with convenient interface for C++14**

View File

@ -1,2 +1,7 @@
#/bin/bash #!/bin/bash
# Copyright Hans Dembinski 2019
# 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
for cpu in /sys/devices/system/cpu/cpu? ; do echo performance > $cpu/cpufreq/scaling_governor; done for cpu in /sys/devices/system/cpu/cpu? ; do echo performance > $cpu/cpufreq/scaling_governor; done

View File

@ -1,2 +1,7 @@
#/bin/bash #!/bin/bash
# Copyright Hans Dembinski 2019
# 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
for cpu in /sys/devices/system/cpu/cpu? ; do echo powersave > $cpu/cpufreq/scaling_governor; done for cpu in /sys/devices/system/cpu/cpu? ; do echo powersave > $cpu/cpufreq/scaling_governor; done

View File

@ -59,8 +59,8 @@ void fill_c(const Axes& axes, const std::size_t* strides, Storage& storage,
const Tuple& t) { const Tuple& t) {
using namespace boost::mp11; using namespace boost::mp11;
std::size_t index = 0; std::size_t index = 0;
assert(boost::histogram::detail::axes_rank(axes) == BOOST_ASSERT(boost::histogram::detail::axes_rank(axes) ==
boost::histogram::detail::axes_rank(t)); boost::histogram::detail::axes_rank(t));
mp_for_each<mp_iota<mp_size<Tuple>>>([&](auto i) { mp_for_each<mp_iota<mp_size<Tuple>>>([&](auto i) {
const auto& a = boost::histogram::detail::axis_get<i>(axes); const auto& a = boost::histogram::detail::axis_get<i>(axes);
const auto& v = std::get<i>(t); const auto& v = std::get<i>(t);
@ -137,9 +137,9 @@ static void fill_2d_c(benchmark::State& state) {
generator<Distribution> gen; generator<Distribution> gen;
auto storage = make_storage<T>(axes); auto storage = make_storage<T>(axes);
auto strides = make_strides(axes); auto strides = make_strides(axes);
assert(strides.size() == 3); BOOST_ASSERT(strides.size() == 3);
assert(strides[0] == 1); BOOST_ASSERT(strides[0] == 1);
assert(strides[1] == 102); BOOST_ASSERT(strides[1] == 102);
for (auto _ : state) { for (auto _ : state) {
fill_c(axes, strides.data(), storage, std::forward_as_tuple(gen(), gen())); fill_c(axes, strides.data(), storage, std::forward_as_tuple(gen(), gen()));
} }
@ -151,9 +151,9 @@ static void fill_2d_c_dyn(benchmark::State& state) {
generator<Distribution> gen; generator<Distribution> gen;
auto storage = make_storage<T>(axes); auto storage = make_storage<T>(axes);
auto strides = make_strides(axes); auto strides = make_strides(axes);
assert(strides.size() == 3); BOOST_ASSERT(strides.size() == 3);
assert(strides[0] == 1); BOOST_ASSERT(strides[0] == 1);
assert(strides[1] == 102); BOOST_ASSERT(strides[1] == 102);
for (auto _ : state) { for (auto _ : state) {
fill_c(axes, strides.data(), storage, std::forward_as_tuple(gen(), gen())); fill_c(axes, strides.data(), storage, std::forward_as_tuple(gen(), gen()));
} }

View File

@ -1,4 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright Hans Dembinski 2019
# 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
from matplotlib import pyplot as plt, lines from matplotlib import pyplot as plt, lines
import shelve import shelve
import json import json

View File

@ -1,4 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright Hans Dembinski 2019
# 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
""" """
Run this from a special build directory that uses the benchmark folder as root Run this from a special build directory that uses the benchmark folder as root

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:benchmarks Benchmarks] [section:benchmarks Benchmarks]
The library is designed to be fast. When configured correctly, it is one of the fastest libraries on the market. If you find a library that is faster than Boost.Histogram, please submit an issue on Github. We care about performance. The library is designed to be fast. When configured correctly, it is one of the fastest libraries on the market. If you find a library that is faster than Boost.Histogram, please submit an issue on Github. We care about performance.

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:history Revision history] [section:history Revision history]
[heading Boost 1.71] [heading Boost 1.71]

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:concepts Concepts] [section:concepts Concepts]
Users can extend the library with various new types whose concepts are defined here. Users can extend the library with various new types whose concepts are defined here.

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:Accumulator Accumulator] [section:Accumulator Accumulator]
An [*Accumulator] is a functor which consumes the argument to update some internal state. The state can be read with member functions or free functions. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable]. An [*Accumulator] is a functor which consumes the argument to update some internal state. The state can be read with member functions or free functions. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable].

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:Axis Axis] [section:Axis Axis]
An [*Axis] maps input values to indices. It holds state specific to that axis, like the number of bins and any metadata. Must be [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable], and *nothrow* [@https://en.cppreference.com/w/cpp/named_req/MoveAssignable MoveAssignable]. An [*Axis] maps input values to indices. It holds state specific to that axis, like the number of bins and any metadata. Must be [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable], and *nothrow* [@https://en.cppreference.com/w/cpp/named_req/MoveAssignable MoveAssignable].

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:DiscreteAxis DiscreteAxis] [section:DiscreteAxis DiscreteAxis]
A [*DiscreteAxis] is one of two optional refinements of the [link histogram.concepts.Axis [*Axis]] concept, the other one is the [link histogram.concepts.IntervalAxis IntervalAxis]. This concept is for values that do not form intervals, and for axes with intervals that contain exactly one value. A [*DiscreteAxis] is one of two optional refinements of the [link histogram.concepts.Axis [*Axis]] concept, the other one is the [link histogram.concepts.IntervalAxis IntervalAxis]. This concept is for values that do not form intervals, and for axes with intervals that contain exactly one value.

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:IntervalAxis IntervalAxis] [section:IntervalAxis IntervalAxis]
A [*IntervalAxis] is one of two optional refinements of the [link histogram.concepts.Axis [*Axis]] concept, the other one is the [link histogram.concepts.DiscreteAxis DiscreteAxis]. It is for ordered values that form intervals with a well-defined lower and upper edge, and a center. Each bin represents an interval of values. A [*IntervalAxis] is one of two optional refinements of the [link histogram.concepts.Axis [*Axis]] concept, the other one is the [link histogram.concepts.DiscreteAxis DiscreteAxis]. It is for ordered values that form intervals with a well-defined lower and upper edge, and a center. Each bin represents an interval of values.

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:Storage Storage] [section:Storage Storage]
A [*Storage] handles memory for the bin counters and provides a uniform vector-like interface for accessing cell values for reading and writing. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable]. A [*Storage] handles memory for the bin counters and provides a uniform vector-like interface for accessing cell values for reading and writing. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable].

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:Transform Transform] [section:Transform Transform]
A [*Transform] implements a monotonic mapping between two real-valued domains, external and internal. It is used to extend the [classref boost::histogram::axis::regular regular axis]. The bins in the internal domain are of equal width, while the bins in the external domain are non-equal width. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable]. A [*Transform] implements a monotonic mapping between two real-valued domains, external and internal. It is used to extend the [classref boost::histogram::axis::regular regular axis]. The bins in the internal domain are of equal width, while the bins in the external domain are non-equal width. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable].

View File

@ -1,3 +1,8 @@
# Copyright Hans Dembinski 2018 - 2019.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
from __future__ import print_function from __future__ import print_function
import sys import sys
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET

View File

@ -1,4 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright Hans Dembinski 2018 - 2019.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
import os import os
import numpy as np import numpy as np
import glob import glob

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:getting_started Getting started] [section:getting_started Getting started]
Here are some commented examples to copy-paste from, this should allow you to kick off a project with Boost.Histogram. If you prefer a traditional structured exposition, go to the [link histogram.guide user guide]. Here are some commented examples to copy-paste from, this should allow you to kick off a project with Boost.Histogram. If you prefer a traditional structured exposition, go to the [link histogram.guide user guide].

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:guide User guide] [section:guide User guide]
Boost.Histogram is designed to make simple things simple, yet complex things possible. Correspondingly, this guides covers the basic usage first, and the advanced usage in later sections. For an alternative quick start guide, have a look at the [link histogram.getting_started Getting started] section. Boost.Histogram is designed to make simple things simple, yet complex things possible. Correspondingly, this guides covers the basic usage first, and the advanced usage in later sections. For an alternative quick start guide, have a look at the [link histogram.getting_started Getting started] section.

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2016 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[library Boost.Histogram [library Boost.Histogram
[quickbook 1.6] [quickbook 1.6]
[copyright 2016 - 2019 Hans Dembinski] [copyright 2016 - 2019 Hans Dembinski]

View File

@ -1,3 +1,10 @@
#!/usr/bin/env python3
# Copyright Hans Dembinski 2018 - 2019.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
import numpy as np import numpy as np
import json import json
from collections import defaultdict from collections import defaultdict

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:overview Overview] [section:overview Overview]
[section:introduction Introduction] [section:introduction Introduction]

View File

@ -1,3 +1,10 @@
[/
Copyright Hans Dembinski 2018 - 2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt)
]
[section:rationale Rationale] [section:rationale Rationale]
[section:guidelines Guidelines] [section:guidelines Guidelines]

View File

@ -206,7 +206,7 @@ decltype(auto) reduce(const Histogram& hist, const Iterable& options) {
o_out.begin = o_in.begin; o_out.begin = o_in.begin;
o_out.end = o_in.end; o_out.end = o_in.end;
} }
o_out.merge = std::max(o_in.merge, o_out.merge); o_out.merge = (std::max)(o_in.merge, o_out.merge);
} }
// make new axes container with default-constructed axis instances // make new axes container with default-constructed axis instances
@ -231,8 +231,8 @@ decltype(auto) reduce(const Histogram& hist, const Iterable& options) {
[&o](auto&& aout, const auto& ain) { [&o](auto&& aout, const auto& ain) {
using A = std::decay_t<decltype(ain)>; using A = std::decay_t<decltype(ain)>;
if (o.indices_set) { if (o.indices_set) {
o.begin = std::max(0, o.begin); o.begin = (std::max)(0, o.begin);
o.end = std::min(o.end, ain.size()); o.end = (std::min)(o.end, ain.size());
} else { } else {
o.begin = 0; o.begin = 0;
o.end = ain.size(); o.end = ain.size();

View File

@ -152,13 +152,13 @@ public:
if (0 <= i) { if (0 <= i) {
if (i < size()) return std::make_pair(i, 0); if (i < size()) return std::make_pair(i, 0);
const auto d = value(size()) - value(size() - 0.5); const auto d = value(size()) - value(size() - 0.5);
x = std::nextafter(x, std::numeric_limits<value_type>::max()); x = std::nextafter(x, (std::numeric_limits<value_type>::max)());
x = std::max(x, vec.back() + d); x = (std::max)(x, vec.back() + d);
vec.push_back(x); vec.push_back(x);
return std::make_pair(i, -1); return std::make_pair(i, -1);
} }
const auto d = value(0.5) - value(0); const auto d = value(0.5) - value(0);
x = std::min(x, value(0) - d); x = (std::min)(x, value(0) - d);
vec.insert(vec.begin(), x); vec.insert(vec.begin(), x);
return std::make_pair(0, -i); return std::make_pair(0, -i);
} }

View File

@ -30,7 +30,7 @@ using is_unsigned_integral = mp11::mp_and<std::is_integral<T>, std::is_unsigned<
template <class T> template <class T>
bool safe_increment(T& t) { bool safe_increment(T& t) {
if (t < std::numeric_limits<T>::max()) { if (t < (std::numeric_limits<T>::max)()) {
++t; ++t;
return true; return true;
} }
@ -41,7 +41,7 @@ template <class T, class U>
bool safe_radd(T& t, const U& u) { bool safe_radd(T& t, const U& u) {
static_assert(is_unsigned_integral<T>::value, "T must be unsigned integral type"); static_assert(is_unsigned_integral<T>::value, "T must be unsigned integral type");
static_assert(is_unsigned_integral<U>::value, "T must be unsigned integral type"); static_assert(is_unsigned_integral<U>::value, "T must be unsigned integral type");
if (static_cast<T>(std::numeric_limits<T>::max() - t) >= u) { if (static_cast<T>((std::numeric_limits<T>::max)() - t) >= u) {
t += static_cast<T>(u); // static_cast to suppress conversion warning t += static_cast<T>(u); // static_cast to suppress conversion warning
return true; return true;
} }
@ -212,7 +212,7 @@ struct large_int : totally_ordered<large_int<Allocator>, large_int<Allocator>>,
// in decimal system it would look like this: // in decimal system it would look like this:
// 8 + 8 = 6 = 8 - (9 - 8) - 1 // 8 + 8 = 6 = 8 - (9 - 8) - 1
// 9 + 1 = 0 = 9 - (9 - 1) - 1 // 9 + 1 = 0 = 9 - (9 - 1) - 1
auto tmp = std::numeric_limits<std::uint64_t>::max(); auto tmp = (std::numeric_limits<std::uint64_t>::max)();
tmp -= o; tmp -= o;
--d -= tmp; --d -= tmp;
} }

View File

@ -30,7 +30,7 @@ constexpr float lowest() {
template <typename T> template <typename T>
constexpr T highest() { constexpr T highest() {
return std::numeric_limits<T>::max(); return (std::numeric_limits<T>::max)();
} }
template <> template <>

View File

@ -185,7 +185,7 @@ void grow_storage(const A& axes, S& storage, const axis::index_type* shifts) {
} }
// we are in a normal bin: // we are in a normal bin:
// move storage pointer to index position, apply positive shifts // move storage pointer to index position, apply positive shifts
ns += (dit->idx + std::max(*sit, 0)) * dit->new_stride; ns += (dit->idx + (std::max)(*sit, 0)) * dit->new_stride;
++dit; ++dit;
++sit; ++sit;
}); });

View File

@ -55,7 +55,7 @@ struct vector_impl : T {
using value_type = typename T::value_type; using value_type = typename T::value_type;
const auto old_size = T::size(); const auto old_size = T::size();
T::resize(n, value_type()); T::resize(n, value_type());
std::fill_n(T::begin(), std::min(n, old_size), value_type()); std::fill_n(T::begin(), (std::min)(n, old_size), value_type());
} }
}; // namespace detail }; // namespace detail

View File

@ -1,4 +1,4 @@
# Copyright 2019 Hans Dembinski # Copyright Hans Dembinski 2019
# Distributed under the Boost Software License, Version 1.0. # 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 # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

View File

@ -61,8 +61,8 @@ int main() {
// axis::integer with int type // axis::integer with int type
{ {
axis::integer<int> a{-1, 2}; axis::integer<int> a{-1, 2};
BOOST_TEST_EQ(a.bin(-2), std::numeric_limits<int>::min()); BOOST_TEST_EQ(a.bin(-2), (std::numeric_limits<int>::min)());
BOOST_TEST_EQ(a.bin(4), std::numeric_limits<int>::max()); BOOST_TEST_EQ(a.bin(4), (std::numeric_limits<int>::max)());
BOOST_TEST_EQ(a.index(-10), -1); BOOST_TEST_EQ(a.index(-10), -1);
BOOST_TEST_EQ(a.index(-2), -1); BOOST_TEST_EQ(a.index(-2), -1);
BOOST_TEST_EQ(a.index(-1), 0); BOOST_TEST_EQ(a.index(-1), 0);

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -3,7 +3,6 @@
// Copyright 2018 Peter Dimov // Copyright 2018 Peter Dimov
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file LICENSE_1_0.txt or copy at // See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt // http://www.boost.org/LICENSE_1_0.txt
@ -11,17 +10,16 @@
#include <boost/version.hpp> #include <boost/version.hpp>
#include <cstdio> #include <cstdio>
int main( int ac, char const* av[] ) int main(int ac, char const* av[]) {
{ BOOST_TEST_EQ(ac, 2);
BOOST_TEST_EQ( ac, 2 );
if( ac >= 2 ) if (ac >= 2) {
{ char version[64];
char version[ 64 ]; std::sprintf(version, "%d.%d.%d", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000,
std::sprintf( version, "%d.%d.%d", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100 ); BOOST_VERSION % 100);
BOOST_TEST_CSTR_EQ( av[1], version ); BOOST_TEST_CSTR_EQ(av[1], version);
} }
return boost::report_errors(); return boost::report_errors();
} }

View File

@ -130,7 +130,7 @@ int main() {
// bincount overflow // bincount overflow
{ {
auto v = std::vector<axis::integer<>>( auto v = std::vector<axis::integer<>>(
100, axis::integer<>(0, std::numeric_limits<int>::max() - 2)); 100, axis::integer<>(0, (std::numeric_limits<int>::max)() - 2));
BOOST_TEST_THROWS(detail::bincount(v), std::overflow_error); BOOST_TEST_THROWS(detail::bincount(v), std::overflow_error);
} }

View File

@ -54,7 +54,7 @@ int main() {
BOOST_TEST_EQ(c, 255); BOOST_TEST_EQ(c, 255);
} }
const auto vmax = std::numeric_limits<std::uint64_t>::max(); const auto vmax = (std::numeric_limits<std::uint64_t>::max)();
// ctors, assign // ctors, assign
{ {

View File

@ -12,11 +12,11 @@ using namespace boost::histogram::detail;
int main() { int main() {
BOOST_TEST_EQ(lowest<int>(), std::numeric_limits<int>::min()); BOOST_TEST_EQ(lowest<int>(), (std::numeric_limits<int>::min)());
BOOST_TEST_EQ(lowest<float>(), -std::numeric_limits<float>::infinity()); BOOST_TEST_EQ(lowest<float>(), -std::numeric_limits<float>::infinity());
BOOST_TEST_EQ(lowest<double>(), -std::numeric_limits<double>::infinity()); BOOST_TEST_EQ(lowest<double>(), -std::numeric_limits<double>::infinity());
BOOST_TEST_EQ(highest<int>(), std::numeric_limits<int>::max()); BOOST_TEST_EQ(highest<int>(), (std::numeric_limits<int>::max)());
BOOST_TEST_EQ(highest<float>(), std::numeric_limits<float>::infinity()); BOOST_TEST_EQ(highest<float>(), std::numeric_limits<float>::infinity());
BOOST_TEST_EQ(highest<double>(), std::numeric_limits<double>::infinity()); BOOST_TEST_EQ(highest<double>(), std::numeric_limits<double>::infinity());

View File

@ -34,7 +34,7 @@ public:
const auto x = std::get<0>(xy); const auto x = std::get<0>(xy);
const auto y = std::get<1>(xy); const auto y = std::get<1>(xy);
const auto r = std::sqrt(x * x + y * y); const auto r = std::sqrt(x * x + y * y);
return std::min(static_cast<axis::index_type>(r), size()); return (std::min)(static_cast<axis::index_type>(r), size());
} }
auto update(std::tuple<double, double> xy) { auto update(std::tuple<double, double> xy) {

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -1,3 +1,11 @@
<!--
Copyright 2018-2019 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)
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization> <!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17"> <boost_serialization signature="serialization::archive" version="17">

View File

@ -49,13 +49,13 @@ unlimited_storage_type prepare(std::size_t n, T x = T{}) {
} }
template <class T> template <class T>
auto max() { auto limits_max() {
return std::numeric_limits<T>::max(); return (std::numeric_limits<T>::max)();
} }
template <> template <>
inline auto max<large_int>() { inline auto limits_max<large_int>() {
return large_int(std::numeric_limits<uint64_t>::max()); return large_int(limits_max<uint64_t>());
} }
template <typename T> template <typename T>
@ -97,7 +97,7 @@ void equal_2() {
template <typename T> template <typename T>
void increase_and_grow() { void increase_and_grow() {
auto tmax = max<T>(); auto tmax = limits_max<T>();
auto s = prepare(2, tmax); auto s = prepare(2, tmax);
auto n = s; auto n = s;
auto n2 = s; auto n2 = s;
@ -205,7 +205,7 @@ struct adder {
// LHS is never downgraded, only upgraded to RHS. // LHS is never downgraded, only upgraded to RHS.
// If RHS is normal integer, LHS doesn't change. // If RHS is normal integer, LHS doesn't change.
BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type,
iRHS < 4 ? iLHS : std::max(iLHS, iRHS)); iRHS < 4 ? iLHS : (std::max)(iLHS, iRHS));
BOOST_TEST_EQ(a[0], 2); BOOST_TEST_EQ(a[0], 2);
} }
{ {
@ -224,7 +224,7 @@ struct adder {
// If RHS is normal integer, LHS doesn't change. // If RHS is normal integer, LHS doesn't change.
a[0] += b[0]; a[0] += b[0];
BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type,
iRHS < 4 ? iLHS : std::max(iLHS, iRHS)); iRHS < 4 ? iLHS : (std::max)(iLHS, iRHS));
BOOST_TEST_EQ(a[0], 2); BOOST_TEST_EQ(a[0], 2);
a[0] -= b[0]; a[0] -= b[0];
BOOST_TEST_EQ(a[0], 0); BOOST_TEST_EQ(a[0], 0);
@ -233,17 +233,17 @@ struct adder {
} }
{ {
auto a = prepare<LHS>(1); auto a = prepare<LHS>(1);
auto b = max<RHS>(); auto b = limits_max<RHS>();
// LHS is never downgraded, only upgraded to RHS. // LHS is never downgraded, only upgraded to RHS.
// If RHS is normal integer, LHS doesn't change. // If RHS is normal integer, LHS doesn't change.
a[0] += b; a[0] += b;
// BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, // BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type,
// iRHS < 4 ? iLHS : std::max(iLHS, iRHS)); // iRHS < 4 ? iLHS : std::max(iLHS, iRHS));
BOOST_TEST_EQ(a[0], max<RHS>()); BOOST_TEST_EQ(a[0], limits_max<RHS>());
a[0] += prepare<RHS>(1, b)[0]; a[0] += prepare<RHS>(1, b)[0];
// BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, // BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type,
// iRHS < 4 ? iLHS + 1 : std::max(iLHS, iRHS)); // iRHS < 4 ? iLHS + 1 : std::max(iLHS, iRHS));
BOOST_TEST_EQ(a[0], 2 * double(max<RHS>())); BOOST_TEST_EQ(a[0], 2 * double(limits_max<RHS>()));
} }
} }
}; };
@ -471,7 +471,7 @@ int main() {
// test failure in buffer.make<large_int>(n, iter), AT::construct // test failure in buffer.make<large_int>(n, iter), AT::construct
s.reset(3); s.reset(3);
s[1] = std::numeric_limits<std::uint64_t>::max(); s[1] = (std::numeric_limits<std::uint64_t>::max)();
db.failure_countdown = 2; db.failure_countdown = 2;
const auto old_ptr = buffer.ptr; const auto old_ptr = buffer.ptr;
BOOST_TEST_THROWS(++s[1], std::bad_alloc); BOOST_TEST_THROWS(++s[1], std::bad_alloc);

View File

@ -9,8 +9,8 @@
#include <boost/archive/xml_iarchive.hpp> #include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp> #include <boost/archive/xml_oarchive.hpp>
#include <boost/assert.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <cassert>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -30,7 +30,13 @@ std::string join(const char* a, const char* b) {
template <class T> template <class T>
void load_xml(const std::string& filename, T& t) { void load_xml(const std::string& filename, T& t) {
std::ifstream ifs(filename); std::ifstream ifs(filename);
assert(ifs.is_open()); BOOST_ASSERT(ifs.is_open());
// manually skip XML comments at the beginning of the stream, because of
// https://github.com/boostorg/serialization/issues/169
char line[128];
do {
ifs.getline(line, 128);
} while (!ifs.fail() && !ifs.eof() && std::strstr(line, "-->") == nullptr);
boost::archive::xml_iarchive ia(ifs); boost::archive::xml_iarchive ia(ifs);
ia >> boost::serialization::make_nvp("item", t); ia >> boost::serialization::make_nvp("item", t);
} }

View File

@ -1,4 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright Hans Dembinski 2019
# 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
import sys import sys
from os.path import abspath, join from os.path import abspath, join
import re import re
@ -8,7 +13,7 @@ project_dir = "/".join(abspath(__file__).split("/")[:-2])
filename = abspath(sys.argv[1]) filename = abspath(sys.argv[1])
copyright = """// Copyright {} Hans Dembinski copyright = """// Copyright Hans Dembinski {}
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt

View File

@ -1,4 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright Hans Dembinski 2019
# 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
from __future__ import print_function from __future__ import print_function
import sys import sys
import glob import glob

View File

@ -1,5 +1,10 @@
#!/bin/sh #!/bin/sh
# must be executed in project root folder # must be executed in project root folder
# Copyright Hans Dembinski 2018-2019
# 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
if [ -z $GCOV ]; then if [ -z $GCOV ]; then
for i in 9 8 5; do for i in 9 8 5; do
if test $(which gcov-$i); then if test $(which gcov-$i); then

View File

@ -1,2 +1,7 @@
#!/bin/sh #!/bin/sh
# Copyright Hans Dembinski 2018-2019
# 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
exec llvm-cov gcov "$@" exec llvm-cov gcov "$@"