GithubHelp home page GithubHelp logo

boostorg / histogram Goto Github PK

View Code? Open in Web Editor NEW
310.0 18.0 73.0 6.7 MB

Fast multi-dimensional generalized histogram with convenient interface for C++14

License: Boost Software License 1.0

C++ 96.24% Shell 0.14% HTML 0.09% Python 1.98% CMake 1.55%
histogram statistics boost-libraries boost convenient-interface data-analysis convenient header-only c-plus-plus c-plus-plus-14

histogram's Introduction

Multi-dimensional generalised histograms with convenient interface

Coded with ❤. Powered by the Boost community and the Scikit-HEP Project.

License

Distributed under the Boost Software License, Version 1.0.

Properties

Supported compiler versions gcc >= 5.5, clang >= 3.8, msvc >= 14.1 Supported C++ versions 14, 17, 20

Branch Linux, OSX, Windows Coverage
develop Fast Coveralls
master Fast Coveralls

Boost.Histogram is a very fast state-of-the-art multi-dimensional generalised histogram class for the beginner and expert alike.

  • Header-only
  • Easy to use, easy to customise
  • Designed for performance
  • Just count or use accumulators to compute means, minimum, maximum, ...
  • Supports multi-threading and restricted environments (no heap allocation, exceptions or RTTI)
  • Open hacker-friendly modular design
  • Has official Python bindings

Check out the full documentation.

💡 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. Chat with us on the Boost channel on Slack and Gitter.

Code example

The following stripped-down example was taken from the Getting started section in the documentation. Have a look into the docs to see the full version with comments and more examples.

Example: Make and fill a 1d-histogram (try it live on Wandbox). The core of this example compiles into 53 lines of assembly code.

#include <boost/histogram.hpp>
#include <boost/format.hpp> // used here for printing
#include <iostream>

int main() {
    using namespace boost::histogram;

    // make 1d histogram with 4 regular bins from 0 to 2
    auto h = make_histogram( axis::regular<>(4, 0.0, 2.0) );

    // push some values into the histogram
    for (auto&& value : { 0.4, 1.1, 0.3, 1.7, 10. })
      h(value);

    // iterate over bins
    for (auto&& x : indexed(h)) {
      std::cout << boost::format("bin %i [ %.1f, %.1f ): %i\n")
        % x.index() % x.bin().lower() % x.bin().upper() % *x;
    }

    std::cout << std::flush;

    /* program output:

    bin 0 [ 0.0, 0.5 ): 2
    bin 1 [ 0.5, 1.0 ): 0
    bin 2 [ 1.0, 1.5 ): 1
    bin 3 [ 1.5, 2.0 ): 1
    */
}

Features

  • Extremely customisable multi-dimensional histogram
  • Simple, convenient, STL and Boost-compatible interface
  • Counters with high dynamic range, cannot overflow or be capped [1]
  • Better performance than other libraries (see benchmarks for details)
  • Efficient use of memory [1]
  • Hand-crafted C++17 deduction guides for axes and histogram types
  • Support for custom axis types: define how input values should map to indices
  • Support for under-/overflow bins (can be disabled individually to reduce memory consumption)
  • Support for axes that grow automatically with input values [2]
  • Support for weighted increments
  • Support for profiles and more generally, user-defined accumulators in cells [3]
  • Support for completely stack-based histograms
  • Support for compilation without exceptions or RTTI [4]
  • Support for adding, subtracting, multiplying, dividing, and scaling histograms
  • Support for custom allocators
  • Support for programming with units [5]
  • Optional serialization based on Boost.Serialization

Note 1 In the standard configuration, if you don't use weighted increments. The counter capacity is increased dynamically as the cell counts grow. When even the largest plain integral type would overflow, the storage switches to a multiprecision integer similar to those in Boost.Multiprecision, which is only limited by available memory.

Note 2 An axis can be configured to grow when a value is encountered that is outside of its range. It then grows new bins towards this value so that the value ends up in the new highest or lowest bin.

Note 3 The histogram can be configured to hold an arbitrary accumulator in each cell instead of a simple counter. Extra values can be passed to the histogram, for example, to compute the mean and variance of values which fall into the same cell. This feature can be used to calculate variance estimates for each cell, which are useful when you need to fit a statistical model to the cell values.

Note 4 The library throws exceptions when exceptions are enabled. When exceptions are disabled, a user-defined exception handler is called instead upon a throw and the program terminates, see boost::throw_exception for details. Disabling exceptions improves performance by 10 % to 20 % in benchmarks. The library does not use RTTI (only CTTI) so disabling it has no effect.

Note 5 Builtin axis types can be configured to only accept dimensional quantities, like those from Boost.Units. This means you get a useful error if you accidentally try to fill a length where the histogram axis expects a time, for example.

Benchmarks

Boost.Histogram is more flexible and faster than other C/C++ libraries. It was compared to:

Details on the benchmark are given in the documentation.

What users say

John Buonagurio | Manager at Exponent®

"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
  • Report bugs: 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.
  • Discussions about the library are held on the Boost developers mailing list. Be sure to read the discussion policy before posting and add the [template] tag at the beginning of the subject line.

histogram's People

Contributors

axel-naumann avatar ecatmur avatar eldiener avatar glenfe avatar gohil-jay avatar hdembinski avatar henryiii avatar jbuonagurio avatar jhcarl0814 avatar jvansanten avatar klemens-morgenstern avatar lastique avatar ldionne avatar mborland avatar mloskot avatar pdimov avatar przemb avatar renbaoshuo avatar sdarwin avatar wiso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

histogram's Issues

use operator() to fill

This allows compact STL code like this

auto h = make_static_histogram(...);
std::foreach(container.begin(), container.end(), h);

and it is compatible with the Boost Accumulator interface, which is important for consistency.

Link to documentation is broken

From the README:

Check out the full documentation. Highlights are given below.

The link now points to https://htmlpreview.github.io/?https://raw.githubusercontent.com/HDembinski/histogram/html/doc/html/index.html
which is a working page, but none of the links on the page itself work for me (I've tried bunch of browsers), so I can't get to any documentation text.

Would you consider using gh-pages? I've checked and they render documentation just fine for me: https://veprbl.github.io/histogram/doc/html/ All you need to do the switch is to rename your html branch into gh-pages and update README of course.

Cannot run histogram_test on MacOS: libboost_serialization.dylib not loaded

I get

○ → ./histogram_test
dyld: Library not loaded: libboost_serialization.dylib
  Referenced from: /Users/axel/build/tmp/HDembinski-histogram/cmake/./histogram_test
  Reason: image not found
Abort trap: 6

Thanks to SIP, this doesn't help either:

○ → LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Users/axel/build/boost/inst/lib ./histogram_test
dyld: Library not loaded: libboost_serialization.dylib
  Referenced from: /Users/axel/build/tmp/HDembinski-histogram/cmake/./histogram_test
  Reason: image not found
Abort trap: 6
○ → ls -l /Users/axel/build/boost/inst/lib/libboost_serialization.dylib
-rwxr-xr-x  1 axel  staff  578644 Dec 13 17:43 /Users/axel/build/boost/inst/lib/libboost_serialization.dylib

Get assigned bin

Hi, ¿is there any way to know assigned bin number for each data value(s) added?
Example: in a 2D histogram of points (x, y) each point has a charge and I need a way to perform additional calcs with charge value for each bin.

-Wsign-compare warning

Compiling the first example under "Getting Started" with -Wall (gcc 5.4.0) results in -Wsign-compare warnings in the following line in save_radd():

  if ((std::numeric_limits<T>::max() - t) < u)

These warnings are false positives, but it would be nice to get rid of them as they are quite noisy.

The warning occurs because the minus operator turns its intermediary result into int (via integral promotion and arithmetic conversion) regardless of the sign of T.

A workaround is to explicitly turn the intermediary result back into T because we know that max - t will never be negative.

  if (T(std::numeric_limits<T>::max() - t) < u)

Notice that we have to use the normal constructor T(x) instead of brace initialization T{x} because the latter would result in a narrowing warning, which btw is also a false positive here.

PS: I am too lazy to fork-branch-commit-etc to do a pull request for this small change.

add axis::discrete_map

Maps user-defined collections of values to bins. For example:
discrete_map(((1,2,3), (4,5,6))) maps the values 1,2,3 to bin 0, and 4,5,6 to bin 1.

operator() and container unpacking

What happens when a user has 1d histogram with an axis that accepts std::string and fills with vectorstd::string. We want to unpack the vector. When user fills just a std::string, we want to pass this to the relevant axis. From the PoV of the code, both are containers, so how do we determine when it should be unpacked?

Undefined reference

Hey there,

I want to to use your project for an c++ university project. I'm running arch linux.

Two Issues:

  1. Following:
git clone https://github.com/HDembinski/histogram.git
mkdir build && cd build
cmake ../histogram/build
make install # (or just 'make' to run the tests)

give the following output:

`/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyString_Size'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyUnicodeUCS4_FromEncodedObject'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyFile_FromString'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyString_Type'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyInt_Type'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyString_FromString'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyUnicodeUCS4_AsWideChar'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyString_FromStringAndSize'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `Py_InitModule4_64'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyString_FromFormat'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyNumber_Divide'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyNumber_InPlaceDivide'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyInt_AsLong'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyString_InternFromString'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyClass_Type'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyString_AsString'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyInt_FromLong'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libboost_python.so: undefined reference to `PyFile_AsFile'
collect2: Fehler: ld gab 1 als Ende-Status zurück
make[2]: *** [CMakeFiles/axis_test.dir/build.make:102: axis_test] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/axis_test.dir/all] Fehler 2
make: *** [Makefile:139: all] Fehler 2
`





**2) Then I tried to just use the c++ headers yielding to**


/tmp/ccB9sU5c.o: In function `main':
main.cpp:(.text+0x57): undefined reference to `boost::histogram::regular_axis::regular_axis(int, double, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/tmp/ccB9sU5c.o: In function `boost::histogram::detail::nstore::~nstore()':
main.cpp:(.text._ZN5boost9histogram6detail6nstoreD2Ev[_ZN5boost9histogram6detail6nstoreD5Ev]+0x14): undefined reference to `boost::histogram::detail::nstore::destroy()'
/tmp/ccB9sU5c.o: In function `boost::histogram::histogram::histogram(boost::variant<boost::histogram::regular_axis, boost::histogram::polar_axis, boost::histogram::variable_axis, boost::histogram::category_axis, boost::histogram::integer_axis> const&)':
main.cpp:(.text._ZN5boost9histogram9histogramC2ERKNS_7variantINS0_12regular_axisEJNS0_10polar_axisENS0_13variable_axisENS0_13category_axisENS0_12integer_axisEEEE[_ZN5boost9histogram9histogramC5ERKNS_7variantINS0_12regular_axisEJNS0_10polar_axisENS0_13variable_axisENS0_13category_axisENS0_12integer_axisEEEE]+0x2c): undefined reference to `boost::histogram::basic_histogram::field_count() const'
main.cpp:(.text._ZN5boost9histogram9histogramC2ERKNS_7variantINS0_12regular_axisEJNS0_10polar_axisENS0_13variable_axisENS0_13category_axisENS0_12integer_axisEEEE[_ZN5boost9histogram9histogramC5ERKNS_7variantINS0_12regular_axisEJNS0_10polar_axisENS0_13variable_axisENS0_13category_axisENS0_12integer_axisEEEE]+0x47): undefined reference to `boost::histogram::detail::nstore::nstore(unsigned long, boost::histogram::detail::nstore::depth_type)'
/tmp/ccB9sU5c.o: In function `boost::detail::variant::make_initializer_node::apply<boost::mpl::pair<boost::detail::variant::initializer_root, mpl_::int_<0> >, boost::mpl::l_iter<boost::mpl::list5<boost::histogram::regular_axis, boost::histogram::polar_axis, boost::histogram::variable_axis, boost::histogram::category_axis, boost::histogram::integer_axis> > >::initializer_node::initialize(void*, boost::histogram::regular_axis&&)':
main.cpp:(.text._ZN5boost6detail7variant21make_initializer_node5applyINS_3mpl4pairINS1_16initializer_rootEN4mpl_4int_ILi0EEEEENS4_6l_iterINS4_5list5INS_9histogram12regular_axisENSD_10polar_axisENSD_13variable_axisENSD_13category_axisENSD_12integer_axisEEEEEE16initializer_node10initializeEPvOSE_[_ZN5boost6detail7variant21make_initializer_node5applyINS_3mpl4pairINS1_16initializer_rootEN4mpl_4int_ILi0EEEEENS4_6l_iterINS4_5list5INS_9histogram12regular_axisENSD_10polar_axisENSD_13variable_axisENSD_13category_axisENSD_12integer_axisEEEEEE16initializer_node10initializeEPvOSE_]+0x44): undefined reference to `boost::histogram::regular_axis::regular_axis(boost::histogram::regular_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::regular_axis>(boost::histogram::regular_axis const&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram12regular_axisEEEvRKT_i[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram12regular_axisEEEvRKT_i]+0x3f): undefined reference to `boost::histogram::regular_axis::regular_axis(boost::histogram::regular_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::regular_axis>(boost::detail::variant::backup_holder<boost::histogram::regular_axis> const&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram12regular_axisEEEvRKNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram12regular_axisEEEvRKNS1_13backup_holderIT_EEl]+0x4b): undefined reference to `boost::histogram::regular_axis::regular_axis(boost::histogram::regular_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::polar_axis>(boost::histogram::polar_axis const&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram10polar_axisEEEvRKT_i[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram10polar_axisEEEvRKT_i]+0x3f): undefined reference to `boost::histogram::polar_axis::polar_axis(boost::histogram::polar_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::polar_axis>(boost::detail::variant::backup_holder<boost::histogram::polar_axis> const&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram10polar_axisEEEvRKNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram10polar_axisEEEvRKNS1_13backup_holderIT_EEl]+0x4b): undefined reference to `boost::histogram::polar_axis::polar_axis(boost::histogram::polar_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::variable_axis>(boost::histogram::variable_axis const&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram13variable_axisEEEvRKT_i[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram13variable_axisEEEvRKT_i]+0x3f): undefined reference to `boost::histogram::variable_axis::variable_axis(boost::histogram::variable_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::variable_axis>(boost::detail::variant::backup_holder<boost::histogram::variable_axis> const&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram13variable_axisEEEvRKNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram13variable_axisEEEvRKNS1_13backup_holderIT_EEl]+0x4b): undefined reference to `boost::histogram::variable_axis::variable_axis(boost::histogram::variable_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::category_axis>(boost::histogram::category_axis const&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram13category_axisEEEvRKT_i[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram13category_axisEEEvRKT_i]+0x3f): undefined reference to `boost::histogram::category_axis::category_axis(boost::histogram::category_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::category_axis>(boost::detail::variant::backup_holder<boost::histogram::category_axis> const&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram13category_axisEEEvRKNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram13category_axisEEEvRKNS1_13backup_holderIT_EEl]+0x4b): undefined reference to `boost::histogram::category_axis::category_axis(boost::histogram::category_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::integer_axis>(boost::histogram::integer_axis const&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram12integer_axisEEEvRKT_i[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram12integer_axisEEEvRKT_i]+0x3f): undefined reference to `boost::histogram::integer_axis::integer_axis(boost::histogram::integer_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::copy_into::internal_visit<boost::histogram::integer_axis>(boost::detail::variant::backup_holder<boost::histogram::integer_axis> const&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram12integer_axisEEEvRKNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9copy_into14internal_visitINS_9histogram12integer_axisEEEvRKNS1_13backup_holderIT_EEl]+0x4b): undefined reference to `boost::histogram::integer_axis::integer_axis(boost::histogram::integer_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::regular_axis>(boost::histogram::regular_axis&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram12regular_axisEEEvRT_i[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram12regular_axisEEEvRT_i]+0x4a): undefined reference to `boost::histogram::regular_axis::regular_axis(boost::histogram::regular_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::regular_axis>(boost::detail::variant::backup_holder<boost::histogram::regular_axis>&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram12regular_axisEEEvRNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram12regular_axisEEEvRNS1_13backup_holderIT_EEl]+0x53): undefined reference to `boost::histogram::regular_axis::regular_axis(boost::histogram::regular_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::polar_axis>(boost::histogram::polar_axis&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram10polar_axisEEEvRT_i[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram10polar_axisEEEvRT_i]+0x4a): undefined reference to `boost::histogram::polar_axis::polar_axis(boost::histogram::polar_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::polar_axis>(boost::detail::variant::backup_holder<boost::histogram::polar_axis>&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram10polar_axisEEEvRNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram10polar_axisEEEvRNS1_13backup_holderIT_EEl]+0x53): undefined reference to `boost::histogram::polar_axis::polar_axis(boost::histogram::polar_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::variable_axis>(boost::histogram::variable_axis&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram13variable_axisEEEvRT_i[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram13variable_axisEEEvRT_i]+0x4a): undefined reference to `boost::histogram::variable_axis::variable_axis(boost::histogram::variable_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::variable_axis>(boost::detail::variant::backup_holder<boost::histogram::variable_axis>&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram13variable_axisEEEvRNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram13variable_axisEEEvRNS1_13backup_holderIT_EEl]+0x53): undefined reference to `boost::histogram::variable_axis::variable_axis(boost::histogram::variable_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::category_axis>(boost::histogram::category_axis&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram13category_axisEEEvRT_i[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram13category_axisEEEvRT_i]+0x4a): undefined reference to `boost::histogram::category_axis::category_axis(boost::histogram::category_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::category_axis>(boost::detail::variant::backup_holder<boost::histogram::category_axis>&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram13category_axisEEEvRNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram13category_axisEEEvRNS1_13backup_holderIT_EEl]+0x53): undefined reference to `boost::histogram::category_axis::category_axis(boost::histogram::category_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::integer_axis>(boost::histogram::integer_axis&, int) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram12integer_axisEEEvRT_i[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram12integer_axisEEEvRT_i]+0x4a): undefined reference to `boost::histogram::integer_axis::integer_axis(boost::histogram::integer_axis const&)'
/tmp/ccB9sU5c.o: In function `void boost::detail::variant::move_into::internal_visit<boost::histogram::integer_axis>(boost::detail::variant::backup_holder<boost::histogram::integer_axis>&, long) const':
main.cpp:(.text._ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram12integer_axisEEEvRNS1_13backup_holderIT_EEl[_ZNK5boost6detail7variant9move_into14internal_visitINS_9histogram12integer_axisEEEvRNS1_13backup_holderIT_EEl]+0x53): undefined reference to `boost::histogram::integer_axis::integer_axis(boost::histogram::integer_axis const&)'
collect2: Fehler: ld gab 1 als Ende-Status zurück

Are there any solutions? Thank you in advance!

Request: Better integration with <numeric>

On 18. Nov 2017, at 17:08, Bjorn Reese via Boost [email protected] wrote:

I would like to see a better integration between boost.histogram and
standard algorithms, especially those from <numeric>. Today they do not
work together because the dereference operator of the axis iterator
returns a pair (index and content) rather than the content.

An example of where standard algorithms could be useful is calculating
the cumulative distribution of a one-dimensional histogram, which ought
to be a simple as:

auto& axis = h.axis();
std:partial_sum(axis.begin(), axis.end(), axis.begin());

Another example is ranking a set of histograms based on the cosine
similarity [1] using std::inner_product().

[1] https://en.wikipedia.org/wiki/Cosine_similarity

make histogram iterators faster

the STL copies iterators a lot, assuming they are cheap to copy. the histogram iterators are not cheap to copy, but expensive parts could be handled with lazy initialization. Or we store the fat parts in the histogram, where they could speed up bin access in general.

benchmarks are needed to decide on the design.

add more detail on the variance estimates

I've read that you computes variance: can that computation be
switched-on/off (e.g. I might not need it)? Also, there are various online
(single pass, weighted) variance algorithms: some a stable, other not.
Which one have you implemented? Does is use std::accumulate? It would be
nice to reassure numerically focused users about the level of quality of he
internals.
I am not using std::accumulate, since it does not fit into my scheme.
If you do not fill the histogram with weighted events, there is no overhead involved for the variance estimate.

If you fill the histogram with normal data, without using weights, then the variance computation is done on-the-fly when the user requests it via histogram::variance(...). When no are weights involved, the variance estimate per bin is equal to the count in that bin (a common estimate based on Poisson theory). When weights were used during the filling, the variance estimate is the sum of squared weights. Storing the sum of squared weights for each bin requires twice the memory.

I did not implement an option to switch that off, since in statistical analysis, the variance estimate is as important as the actual count. If you have a special case with weighted data, I think it is safe to assume that a variance estimate is also desired.

I will put in more details on these things into the Notes section of the documentation.

Fix CMake on Windows

The CMake build does not work on Windows. This is most likely a simple issue related to custom flags that are set.

The script needs to be changed so that special compiler flags are only set for those compilers that understand and need them.

Histograms or binned counters

Hi! This is a really great work! A clear improvement over TH* mess.

There is another library which attempts to tackle this issue - YODA. They have some interesting ideas and one of them is that they've realised that ROOT histograms are not exactly histograms but more of "binned counters". A simple illustration of this can be done using modified 1d histogram example:

import histogram as hg
import numpy as np
import matplotlib.pyplot as plt

h = hg.histogram(hg.variable_axis(1.,2.,4.))
h.fill(1.5)
h.fill(2.5)

x = np.array(h.axis(0))
y = np.asarray(h)
y = y[:len(x)-1]
y = np.append(y, [0])

plt.plot(x, y, drawstyle="steps-post")
plt.ylim(0.5, 1.5)
plt.xlabel("x")
plt.ylabel("y")
plt.show()

This will draw a straight line suggesting that the probability of filled value is uniformly distributed over range from 1.0 to 3.0, which is a wrong estimate. YODA, on the other hand, operates with values normalised by the bin width by default, so it will draw a step instead of a straight line. I think it makes a lot of sense for boost_histogram to distinguish between bin width and sum of weights as well.

Boost::python: missing `init_module`

With

-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   iostreams
--   serialization
--   python
--   numpy
-- Build type: RELEASE [optimizations on]

I get

Undefined symbols for architecture x86_64:
  "boost::python::detail::init_module(PyModuleDef&, void (*)())", referenced from:
      _PyInit_cpp_filler in guide_listing_16.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [cpp_filler.so] Error 1

That's on MacOS 10.13.1 with Xcode 9.2

add a templated histogram with a storage parameter

The standard type (that uses the nstore) should still be called histogram. The template that allows to parametrize the storage type, could be called static_histogram. The shared interface should be put into static_histogram, histogram would derive from it and specialize what's needed for the nstore. The method "depth()" is only relevant for histogram.

doc improvements

  • make it more clear that library is header-only if you turn off Python support
  • make serialization support optional or disable auto-linking

replace cppint with custom bignum type

cppint is producing a lot of warnings and it is a big dependency. we don't need a full bignum type, only a few operations are used. we could roll a custom type here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.