https://github.com/thelartians/indexset
A class for manipulating large sets of indices with optimal performance and memory use
https://github.com/thelartians/indexset
cpp fast high-performance indices low-memory set
Last synced: 3 months ago
JSON representation
A class for manipulating large sets of indices with optimal performance and memory use
- Host: GitHub
- URL: https://github.com/thelartians/indexset
- Owner: TheLartians
- License: mit
- Created: 2020-04-13T16:29:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-20T23:57:22.000Z (over 5 years ago)
- Last Synced: 2025-06-01T08:33:30.116Z (5 months ago)
- Topics: cpp, fast, high-performance, indices, low-memory, set
- Language: CMake
- Homepage:
- Size: 35.2 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/TheLartians/IndexSet/actions)
[](https://github.com/TheLartians/IndexSet/actions)
[](https://github.com/TheLartians/IndexSet/actions)
[](https://github.com/TheLartians/IndexSet/actions)
[](https://github.com/TheLartians/IndexSet/actions)
[](https://codecov.io/gh/TheLartians/IndexSet)# IndexSet
A small library to work on large sets of indices with optimal memory and runtime performance.
Internally IndexSet is using the [BitLens](https://github.com/TheLartians/BitLens) library store indices as a bitmask vector.
Operations on index sets are performed on data values, which is [many orders of magnitude faster](https://github.com/TheLartians/BitLens#Benchmark) than comparing individual indices.## Usage
You can easily add IndexSet through [CPM.cmake](https://github.com/TheLartians/CPM.cmake).
```cmake
CPMAddPackage(
NAME IndexSet
GITHUB_REPOSITORY TheLartians/IndexSet
VERSION 0.1
)
```## API
```cpp
#include
#includevoid example() {
// create index sets
auto a = index_set::createIndexSetFromIndices({2, 4, 6});
auto b = index_set::createIndexSetFromIndex(3);// add and remove single indices (slow)
b.addIndex(6);
a.removeIndex(4);// perform operations on index sets (very fast)
a.remove(b);
a.add(b);
a.intersect(b);// iteration
for (auto index: a.indices()) {
std::cout << index << std::endl;
}// printing
std::cout << a << std::endl;
}
```