Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filling a weighted dynamic rank histogram with a dynamic input #402

Open
dguest opened this issue Nov 3, 2024 · 0 comments
Open

Filling a weighted dynamic rank histogram with a dynamic input #402

dguest opened this issue Nov 3, 2024 · 0 comments

Comments

@dguest
Copy link

dguest commented Nov 3, 2024

I might have missed something, but I can't figure out a clean way to fill a dynamic rank histogram with inputs that also dynamic without using fill and some slightly weird reformatting for the inputs.

Specifically I have something like this

  namespace bh = boost::histogram;
  using dax_t = bh::axis::regular<double>;
  std::vector<dax_t> axes {
    dax_t(1, -0.5, 0.5, "ax0"),
    dax_t(1, -0.5, 0.5, "ax1")
  };
  auto hdyn = bh::make_weighted_histogram(axes);
  // seems we need to do some funny organization to make weighting
  // work with dynamic axes.
  std::vector<std::vector<double>> vals { {0}, {0} };
  hdyn.fill(vals, bh::weight(0.5));

If I try to fill with a std::vector<double> vals {0, 0}; and using hdyn(vals, bh::weight(0.5)); I get a number of arguments != histogram rank exception. Of course calling hdyn(0, 0, bh::weight(0.5)) works fine, but that sort of limits the dynamic part of the dynamic axes.

To be clear, what I have works fine and everything else about this library is amazing. And I don't have much of a use case for dynamic axes anyway, so this is more of a curiosity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant