-
Notifications
You must be signed in to change notification settings - Fork 125
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
[NDTensors] Add SortedSets and TagSets #1204
Conversation
Codecov ReportAll modified lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1204 +/- ##
===========================================
- Coverage 85.41% 67.37% -18.05%
===========================================
Files 88 87 -1
Lines 8426 8388 -38
===========================================
- Hits 7197 5651 -1546
- Misses 1229 2737 +1508 ☔ View full report in Codecov by Sentry. |
@emstoudenmire I'm going to merge this so we can start testing it out in the wild. You can look at the new Some set operations on |
Description
This adds
SortedSets
andTagSets
submodules to NDTensors.SortedSets
defines a generic sorted set-like data structure which are more efficient for smaller collections than hash-based sets. Inserting new elements keeps the set sorted (and unique). When combined withSmallVectors
from #1202 (using aSmallVector
as a data backend for aSortedSet
), it should provide very fast data structures for applications like TagSets and QNs. This PR also adds a first draft of a newTagSet
type design, which is generic but can make use ofSmallVectors
andSortedSets
to reproduce speed that is similar to the currentITensors.TagSet
type but with less code and a simpler, more generic design that will allow users to choose their own tag and storage types.This is still a draft because I need to test the efficiency of
SortedSets
(I know there is some part that doesn't fully take advantage of the speed of using aSmallVector
but instead uses slower generic code), work out a few more things around the design of theTagSet
(and relatedly,QN
) type, and add tests and examples.