Hans Dembinski
Hans Dembinski
Prototype of an axis that works with boost::rational: https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGEgMykrgAyeAyYAHI%2BAEaYxCAAbKQADqgKhE4MHt6%2BASlpGQKh4VEssfFJdpgOmUIETMQE2T5%2BXIFVNQJ1DQTFkTFxibb1jc25bcM9faXliQCUtqhexMjsHOb%2BYcjeWADUJv5u0ahpBAD0CHgKRMDErAB0CMnJB9gmGgCCG1s7mPuHx1OFyuNzuLDOp2ImAeTxe/jen2%2BDG2Xj2ByOJ2uZzujgEYkez1e7y%2BZk2yN%2B/zcTmuUNYRMRnzCBF2LCYYQgc32AHYrJ9dvzdsw2ApkkxVrtogh/gARCWYgggECXa6oW50/y8j4C3ZedJGXY4mVy06KnGZMToplEjXE4namleBy7JiqK7czXa7W6sLAXYANzEXkwAH0CABPZJ/A6ynEHD2e/ne/VhLCqUMRqP%2BWWSxUuq6KlOYNPhyNx218hO7QvFjOCnzBssVhMB7whkt/VBUKhKAgNm1Nz0toPpyO7BSieh9zV2yt5hQQasjv4MUj%2BwNt2tMVdDjej6KckAzysChj1kw8hjn6WrzvdzC988WJhX1fjsQhx%2Bxi9X3ZnXYQaJdgAWmdOYf0fK9yy1StF3bKsGFTCA0AYa411bJdzASXZVE5ZDUIggdjzw5kmC8IgqyNQFrlNJhcWYWhg1Ea5LQQosMPhCA30nXYACp/1UYDdlvHtgzmMD%2B2g49%2BShAhlgYCjrVlICuH%2BAAxf88EpOsWGDNSKJAbTRN2AzlMbSTPUghlzO1HclzQoMF1YmtRzwXCBHwnkjykmS5Iov8uJDfZLCErsRLM49LK%2BQiBVg2t0gAL0wDldmI90DXvXzTx0uNuWlKDj2uWi8GQFL3IIItkmIZ0yNQITkjo%2BdOUfdLZOIeScxAOdFVQerMkVLxWOIKhaFQAB3bk3AlJBOtdBRut65wQFQP04mGsacsi7VIIkrzSPIqVoymxVWQAaxDZVQVYCA50fLgNFXe7dgAVivcTpwHBAIGUt6vM%2Brgfo%2BiAzABqLzOudBFTQMjKXRXYDsOWHwcVVxaDMq8OAWWhOCe3g/A4LRSFQTg3GsawxyWFYo1JHhSAVfGMYWE6QCegAOe4AE4uQ0SQuQSdmuCkfwNC5aQsY4SRcc0XgiY4Xg5vuumtAWOBYBgRAUFQFhkjoOJyEoNAtZ1%2BJtkMYABY0Lg%2BDocriDmgCpdIaIwgaMNOBpg22EEAB5BhaFd%2BnSCwVkjHEAP8ChGoVrmgOi2qMi1gJplMDFgnaDwaI7mIMMPCwN3eAIYg8BYPOFmGphgAUAA1PBMFGr3Izxmn%2BEEER3wkaRm/kJQ1Ad3RLYMIwUFJyx9HTubYCFdgqIIUgVvibguS5BnCYWlDODl5PqjolwELGVoggQ6YBniS3UnSOi970M/CgYI%2BykGS2Ojo7pRk8Fo9Cf2oRl6MJ%2Bnvk/JivxyPvQqjQ76zH%2BosZYqw9AF0wGsHgmNsaSwDjLVQLMEhAQSJIFKA9fQC3uBoe4KkIAk0sNYVcuBCAkCCv4S2uwPCG3oFVDY/185SzEqQJmT17piwlqQYukhJCEK4CzSQ3N2bC05k9SQSQ8YExlnLEACsOGkBVurJYBBkhkT1khTW2tmF6EwPgIgADO6t3EFIGQghFAqHUAHUadxkgl30Mg0g8jpacC9mRbRzJOzYQwVgnBJt9QEKISQxhBi4i0LYbTDhCwEDQiwPEDkrjxa8GLk9J6HMWZcCeuzHh7MzAaDMJIGR7iHaKNsMouJ9NOFM0kFwQhZgCmkg0CzFmT0%2BZmCSGLfwKCFHr1qUrJBHAzADM8bLYZy857pGcJIIAA
@emmenlau Could you please post a minimal example that shows the bug you experiencing? What I said earlier, that integer arithmetic with doubles is exact to my knowledge, is only...
axis::regular currently uses yet another version of this calculation: ``` index3 = n * ((x - a) / (b - a)) ``` https://github.com/boostorg/histogram/blob/bf7712f0d7b548f5f29487a18aa1ae9f221e08ad/include/boost/histogram/axis/regular.hpp#L330 This calculation also uses non-integer values as...
For reference, numpy.histogram uses a rather expensive algorithm to handle values which end up exactly on bin edges: https://github.com/numpy/numpy/blob/e2d35064df262efa6eb7dfe5bfc43160c73cf685/numpy/lib/histograms.py#L857
Here is a little numerical test. It looks like the calculation that axis::regular uses is the worst of the aforementioned alternatives. Surprisingly, index2, index4, and index5 work the best. index5...
That index2, index4 and index5 give the same answers is not a surprise, since by construction (b-a) / n == 1.0.
~Hi all, I am still confused why you cannot use an integer axis, because that should be faster than a regular axis and provides exact integer arithmetic.~ Ok, I think...
> What I can say is that we observe a tiny slowdown in benchmarks with our solution compared to the upstream code, which is surprising since we use integer math...
I did the check, it turns out that the implementation of value() also needs to be modified. The version that I use ensures that the upper edge of the last...
Hi Kyle, this seems doable, but requires linking to the external healpix library. I need to check how to best handle this inside the Boost.Build framework.