Repository navigation
fix: support sparse storage with accumulators - #421
Merged
Merged
Conversation
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Contributor
Author
|
C++17 version, FWIW: auto [it, _] = map->try_emplace(idx, value_type{});
it->second += u; |
Collaborator
|
Looks good, thanks. |
Contributor
Author
|
Will this make it into 1.91? The deadline for fixes is April 1. (Doesn't have to) |
Collaborator
|
Yeah, I think I can merge it into the release, because it is a bug-fix. |
henryiii
added a commit
to henryiii/boost-histogram
that referenced
this pull request
Jun 15, 2026
Add a hash-map backed `DoubleSparse` storage that only allocates filled cells, making histograms over very large or high-dimensional axis spaces feasible. Backed by `storage_adaptor<unordered_map<size_t, double>>`. Scoped to `double` only for now: accumulator-backed sparse storages need boostorg/histogram#421, which ships in Boost 1.92 (the repo vendors 1.90). Data access is COO-first and deliberately not a full drop-in: - `.view()` raises (no contiguous buffer to view into). - `Histogram.to_coo(flow=False)` returns the filled cells as `(per-axis index tuple, values)`, numpy-nonzero style. - The copying accessors `values()`/`variances()`/`counts()` and `np.asarray(h)` densify into a fresh array, so they keep working. - `at()` reads, slicing, projection, sum and histogram addition stay sparse. Serialization: pickle round-trips via free save/load on `double_sparse` (COO key/value arrays); UHI to_uhi/from_uhi store COO under a `"sparse"` payload plus writer_info, reconstructed via a C++ `_from_coo` bulk setter. Assisted-by: ClaudeCode:claude-opus-4.8
Contributor
Author
|
@HDembinski Will this make it into 1.92? The deadline for all changes is August 5. (I've got a few other fixes open too, and I can submit a fix for #430 if you want me to). |
Collaborator
|
yeah let's aim for that |
Contributor
Author
|
@HDembinski Will this make it into 1.93? The deadline for new libraries is October 21, and breaking changes is October 28, and all changes is November 4. I assume it's easier before those deadlines to update. (I've got a few open PRs too, #429 should be ready for review). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a fix for #416. Added test fails without the fix, compiles and passes with the fix. This was blocking sparse storage in boost-histogram (can't promise it is the only blocker, but was the first one we hit).
Use copilot in VSCode, which selected GPT-5.3-Codex, to convert the issue into a fix and test.