Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Feature request: strided array support for fill?

Open
#331 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
data

Research direction

No file, test, or entry point is identified. Start by reading issues #327 and #303, then trace boost-histogram's fill handling for span mismatches and non-dense input arrays. Done would require an agreed strided-array design that supports scalar samples and addresses unnecessary input copies.

Written by the indexing model from the issue text.

Description

In #327, the bug seems to be that single values are not supported correctly. In https://github.com/scikit-hep/hist/issues/303, scalars are currently not allowed for samples - in working on this, I found that h.fill(0.3, sample=[1, 2], weight=1) is not supported in boost-histogram, due to the spans not matching (may be solvable on the boost-histogram side).

A way to support this easily could be to support strided arrays, like NumPy, Eigen, Boost.MultiArray, etc. all provide. If an array is described by a stride and an offset, then setting that stride to 0 would allow a scalar value without having a scalar datatype. Then there would be half as many items in the fill variant, just arrays, no scalars anymore.

A related issue is that boost-histogram has to copy the input array if it's not already a dense 1D array. If describing an array with a starting pointer, stride, and offset was possible, then this would no longer be necessary, only the datatype would have to match to avoid a copy.

Thoughts?

Dominant language
C++
Stars
334
Forks
76
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/histogram

All issues in boostorg/histogram

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.