mirror of
https://github.com/boostorg/histogram.git
synced 2025-05-09 23:04:07 +00:00
This PR keeps the useful changes from PR #370, which was never finished.
This commit is contained in:
parent
b11364eb99
commit
cd3e1110cb
2
.github/workflows/cov.yml
vendored
2
.github/workflows/cov.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
cov:
|
cov:
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Fetch Boost superproject
|
- name: Fetch Boost superproject
|
||||||
run: |
|
run: |
|
||||||
cd ..
|
cd ..
|
||||||
|
2
.github/workflows/fast.yml
vendored
2
.github/workflows/fast.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: prepare build
|
- name: prepare build
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
|
8
.github/workflows/slow.yml
vendored
8
.github/workflows/slow.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
appleclang:
|
appleclang:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Fetch Boost superproject
|
- name: Fetch Boost superproject
|
||||||
run: |
|
run: |
|
||||||
cd ..
|
cd ..
|
||||||
@ -49,7 +49,7 @@ jobs:
|
|||||||
gcc7:
|
gcc7:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: egor-tensin/setup-gcc@v1
|
- uses: egor-tensin/setup-gcc@v1
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 7
|
||||||
@ -73,7 +73,7 @@ jobs:
|
|||||||
gcc10:
|
gcc10:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Fetch Boost superproject
|
- name: Fetch Boost superproject
|
||||||
run: |
|
run: |
|
||||||
cd ..
|
cd ..
|
||||||
@ -94,7 +94,7 @@ jobs:
|
|||||||
clang14:
|
clang14:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Fetch Boost superproject
|
- name: Fetch Boost superproject
|
||||||
run: |
|
run: |
|
||||||
cd ..
|
cd ..
|
||||||
|
2
.github/workflows/superproject_cmake.yml
vendored
2
.github/workflows/superproject_cmake.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Fetch Boost superproject
|
- name: Fetch Boost superproject
|
||||||
run: |
|
run: |
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -11,7 +11,7 @@ add_library(boost_histogram INTERFACE)
|
|||||||
add_library(Boost::histogram ALIAS boost_histogram)
|
add_library(Boost::histogram ALIAS boost_histogram)
|
||||||
|
|
||||||
target_include_directories(boost_histogram INTERFACE include)
|
target_include_directories(boost_histogram INTERFACE include)
|
||||||
target_compile_features(boost_histogram INTERFACE cxx_std_14)
|
|
||||||
target_link_libraries(boost_histogram
|
target_link_libraries(boost_histogram
|
||||||
INTERFACE
|
INTERFACE
|
||||||
Boost::config
|
Boost::config
|
||||||
@ -22,6 +22,8 @@ target_link_libraries(boost_histogram
|
|||||||
Boost::math
|
Boost::math
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_features(boost_histogram INTERFACE cxx_std_14)
|
||||||
|
|
||||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||||
# Standalone build, fetch dependencies
|
# Standalone build, fetch dependencies
|
||||||
|
|
||||||
|
17
README.md
17
README.md
@ -9,7 +9,13 @@
|
|||||||
|
|
||||||
**Multi-dimensional generalised histograms with convenient interface**
|
**Multi-dimensional generalised histograms with convenient interface**
|
||||||
|
|
||||||
Coded with ❤. Powered by the [Boost community](https://www.boost.org) and the [Scikit-HEP Project](http://scikit-hep.org). Licensed under the [Boost Software License](http://www.boost.org/LICENSE_1_0.txt).
|
Coded with ❤. Powered by the [Boost community](https://www.boost.org) and the [Scikit-HEP Project](http://scikit-hep.org).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
**Supported compiler versions** gcc >= 5.5, clang >= 3.8, msvc >= 14.1
|
**Supported compiler versions** gcc >= 5.5, clang >= 3.8, msvc >= 14.1
|
||||||
**Supported C++ versions** 14, 17, 20
|
**Supported C++ versions** 14, 17, 20
|
||||||
@ -33,7 +39,7 @@ Check out the [full documentation](https://www.boost.org/doc/libs/master/libs/hi
|
|||||||
|
|
||||||
💡 Boost.Histogram is a mature library with 100 % of code lines covered by unit tests, is benchmarked for performance, and has extensive documentation. If you still find some issue or find the documentation lacking, tell us about it by [submitting an issue](https://github.com/boostorg/histogram/issues). Chat with us on the [Boost channel on Slack](https://cpplang.slack.com) and [Gitter](https://gitter.im/boostorg/histogram).
|
💡 Boost.Histogram is a mature library with 100 % of code lines covered by unit tests, is benchmarked for performance, and has extensive documentation. If you still find some issue or find the documentation lacking, tell us about it by [submitting an issue](https://github.com/boostorg/histogram/issues). Chat with us on the [Boost channel on Slack](https://cpplang.slack.com) and [Gitter](https://gitter.im/boostorg/histogram).
|
||||||
|
|
||||||
## Code examples
|
## Code example
|
||||||
|
|
||||||
The following stripped-down example was taken from the [Getting started](https://www.boost.org/doc/libs/master/libs/histogram/doc/html/histogram/getting_started.html) section in the documentation. Have a look into the docs to see the full version with comments and more examples.
|
The following stripped-down example was taken from the [Getting started](https://www.boost.org/doc/libs/master/libs/histogram/doc/html/histogram/getting_started.html) section in the documentation. Have a look into the docs to see the full version with comments and more examples.
|
||||||
|
|
||||||
@ -115,3 +121,10 @@ Details on the benchmark are given in the [documentation](https://www.boost.org/
|
|||||||
**John Buonagurio** | Manager at [**E<sup><i>x</i></sup>ponent<sup>®</sup>**](https://www.exponent.com)
|
**John Buonagurio** | Manager at [**E<sup><i>x</i></sup>ponent<sup>®</sup>**](https://www.exponent.com)
|
||||||
|
|
||||||
*"I just wanted to say 'thanks' for your awesome Histogram library. I'm working on a software package for processing meteorology data and I'm using it to generate wind roses with the help of Qt and QwtPolar. Looks like you thought of just about everything here – the circular axis type was practically designed for this application, everything 'just worked'."*
|
*"I just wanted to say 'thanks' for your awesome Histogram library. I'm working on a software package for processing meteorology data and I'm using it to generate wind roses with the help of Qt and QwtPolar. Looks like you thought of just about everything here – the circular axis type was practically designed for this application, everything 'just worked'."*
|
||||||
|
|
||||||
|
## More information
|
||||||
|
|
||||||
|
* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-template)
|
||||||
|
* [Report bugs](https://github.com/boostorg/template/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
|
||||||
|
* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
||||||
|
* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[template]` tag at the beginning of the subject line.
|
||||||
|
@ -83,7 +83,7 @@ struct large_int : totally_ordered<large_int<Allocator>, large_int<Allocator>>,
|
|||||||
|
|
||||||
large_int& operator+=(const large_int& o) {
|
large_int& operator+=(const large_int& o) {
|
||||||
if (this == &o) {
|
if (this == &o) {
|
||||||
auto tmp{o};
|
auto tmp = o; // make a copy
|
||||||
return operator+=(tmp);
|
return operator+=(tmp);
|
||||||
}
|
}
|
||||||
bool carry = false;
|
bool carry = false;
|
||||||
|
@ -40,6 +40,8 @@ boost_test(TYPE compile-fail SOURCES histogram_fail4.cpp)
|
|||||||
|
|
||||||
set(BOOST_TEST_LINK_LIBRARIES Boost::histogram Boost::core)
|
set(BOOST_TEST_LINK_LIBRARIES Boost::histogram Boost::core)
|
||||||
|
|
||||||
|
boost_test(TYPE run SOURCES quick.cpp)
|
||||||
|
|
||||||
boost_test(TYPE run SOURCES accumulators_count_test.cpp)
|
boost_test(TYPE run SOURCES accumulators_count_test.cpp)
|
||||||
boost_test(TYPE run SOURCES accumulators_mean_test.cpp)
|
boost_test(TYPE run SOURCES accumulators_mean_test.cpp)
|
||||||
boost_test(TYPE run SOURCES accumulators_sum_test.cpp)
|
boost_test(TYPE run SOURCES accumulators_sum_test.cpp)
|
||||||
|
@ -39,6 +39,7 @@ alias odr :
|
|||||||
;
|
;
|
||||||
|
|
||||||
alias cxx14 :
|
alias cxx14 :
|
||||||
|
[ run quick.cpp ]
|
||||||
[ run accumulators_count_test.cpp ]
|
[ run accumulators_count_test.cpp ]
|
||||||
[ run accumulators_fraction_test.cpp ]
|
[ run accumulators_fraction_test.cpp ]
|
||||||
[ run accumulators_mean_test.cpp ]
|
[ run accumulators_mean_test.cpp ]
|
||||||
|
@ -31,19 +31,19 @@ int main() {
|
|||||||
BOOST_TEST_EQ(h.at(1), (fraction_t{1, 0}));
|
BOOST_TEST_EQ(h.at(1), (fraction_t{1, 0}));
|
||||||
|
|
||||||
// cannot use std::vector<bool> because of vector specialization
|
// cannot use std::vector<bool> because of vector specialization
|
||||||
std::vector<char> s = {true, false};
|
std::vector<char> s = {{true, false}};
|
||||||
std::vector<int> x = {0, 1};
|
std::vector<int> x = {0, 1};
|
||||||
h.fill(x, sample(s));
|
h.fill(x, sample(s));
|
||||||
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 1}));
|
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 1}));
|
||||||
BOOST_TEST_EQ(h.at(1), (fraction_t{1, 1}));
|
BOOST_TEST_EQ(h.at(1), (fraction_t{1, 1}));
|
||||||
|
|
||||||
// any contiguous container of bool works which is not specialized
|
// any contiguous container of bool works which is not specialized
|
||||||
std::array<bool, 2> s2 = {false, true};
|
std::array<bool, 2> s2 = {{false, true}};
|
||||||
h.fill(x, sample(s2));
|
h.fill(x, sample(s2));
|
||||||
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 2}));
|
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 2}));
|
||||||
BOOST_TEST_EQ(h.at(1), (fraction_t{2, 1}));
|
BOOST_TEST_EQ(h.at(1), (fraction_t{2, 1}));
|
||||||
|
|
||||||
std::valarray<bool> s3 = {false, true};
|
std::valarray<bool> s3 = {{false, true}};
|
||||||
h.fill(x, sample(s3));
|
h.fill(x, sample(s3));
|
||||||
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 3}));
|
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 3}));
|
||||||
BOOST_TEST_EQ(h.at(1), (fraction_t{3, 1}));
|
BOOST_TEST_EQ(h.at(1), (fraction_t{3, 1}));
|
||||||
|
19
test/quick.cpp
Normal file
19
test/quick.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2022 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/histogram.hpp>
|
||||||
|
#include "throw_exception.hpp"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
using namespace boost::histogram;
|
||||||
|
|
||||||
|
auto h = make_histogram(axis::integer<>(0, 5));
|
||||||
|
|
||||||
|
h(0);
|
||||||
|
|
||||||
|
auto values = {1, 2};
|
||||||
|
h.fill(values);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user