superintervals 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {superintervals-0.3.0/src/superintervals.egg-info → superintervals-0.3.2}/PKG-INFO +1 -1
- {superintervals-0.3.0 → superintervals-0.3.2}/README.md +8 -308
- {superintervals-0.3.0 → superintervals-0.3.2}/pyproject.toml +1 -1
- superintervals-0.3.2/src/superintervals/intervalmap.cpp +35508 -0
- {superintervals-0.3.0 → superintervals-0.3.2}/src/superintervals/intervalmap.pxd +4 -1
- {superintervals-0.3.0 → superintervals-0.3.2}/src/superintervals/intervalmap.pyx +204 -1
- {superintervals-0.3.0 → superintervals-0.3.2/src/superintervals.egg-info}/PKG-INFO +1 -1
- {superintervals-0.3.0 → superintervals-0.3.2}/src/superintervals.egg-info/SOURCES.txt +1 -0
- superintervals-0.3.0/src/SuperIntervals.hpp → superintervals-0.3.2/src/superintervals.hpp +70 -71
- superintervals-0.3.0/src/superintervals/intervalmap.cpp +0 -14792
- {superintervals-0.3.0 → superintervals-0.3.2}/LICENSE +0 -0
- {superintervals-0.3.0 → superintervals-0.3.2}/setup.cfg +0 -0
- {superintervals-0.3.0 → superintervals-0.3.2}/setup.py +0 -0
- {superintervals-0.3.0 → superintervals-0.3.2}/src/superintervals/__init__.py +0 -0
- {superintervals-0.3.0 → superintervals-0.3.2}/src/superintervals.egg-info/dependency_links.txt +0 -0
- {superintervals-0.3.0 → superintervals-0.3.2}/src/superintervals.egg-info/requires.txt +0 -0
- {superintervals-0.3.0 → superintervals-0.3.2}/src/superintervals.egg-info/top_level.txt +0 -0
|
@@ -5,7 +5,8 @@ A fast, memory-efficient data structure for interval intersection queries.
|
|
|
5
5
|
SuperIntervals uses a novel superset-index approach that maintains
|
|
6
6
|
intervals in position-sorted order, enabling cache-friendly searches and SIMD-optimized counting.
|
|
7
7
|
|
|
8
|
-
Available for [C++](#cpp), [Rust](#rust), [Python](#python)
|
|
8
|
+
Available for [C++](#cpp), [Rust](#rust), [Python](#python).
|
|
9
|
+
A version for R can be found at https://github.com/kcleal/superintervalsr.
|
|
9
10
|
|
|
10
11
|
### Features:
|
|
11
12
|
|
|
@@ -35,150 +36,8 @@ imap.build()
|
|
|
35
36
|
results = imap.search_values(8, 20) # ['A']
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
**IntervalMap** class:
|
|
41
|
-
|
|
42
|
-
- `add(start, end, value=None)`
|
|
43
|
-
Add interval with associated value
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- `build()`
|
|
47
|
-
Build index (required before queries)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- `clear()`
|
|
51
|
-
Remove all intervals
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- `reserve(n)`
|
|
55
|
-
Reserve space for n intervals
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- `size()`
|
|
59
|
-
Get number of intervals
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- `at(index)`
|
|
63
|
-
Get interval at index as (start, end, value)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- `starts_at(index)`
|
|
67
|
-
Get start position at index
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- `ends_at(index)`
|
|
71
|
-
Get end position at index
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- `data_at(index)`
|
|
75
|
-
Get value at index
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- `has_overlaps(start, end)`
|
|
79
|
-
Check if any intervals overlap range
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- `count(start, end)`
|
|
83
|
-
Count overlapping intervals
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- `search_values(start, end)`
|
|
87
|
-
Get values of overlapping intervals
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
- `search_idxs(start, end)`
|
|
91
|
-
Get indices of overlapping intervals
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
- `search_keys(start, end)`
|
|
95
|
-
Get (start, end) pairs of overlapping intervals
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
- `search_items(start, end)`
|
|
99
|
-
Get (start, end, value) tuples of overlapping intervals
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
- `coverage(start, end)`
|
|
103
|
-
Get (count, total_coverage) for range
|
|
104
|
-
|
|
105
|
-
## R
|
|
106
|
-
|
|
107
|
-
```r
|
|
108
|
-
library(superintervals)
|
|
109
|
-
|
|
110
|
-
imap <- IntervalMap()
|
|
111
|
-
add(imap, 10, 20, "A")
|
|
112
|
-
build(imap)
|
|
113
|
-
results <- search_values(imap, 8, 20)
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### API Reference
|
|
117
|
-
|
|
118
|
-
**IntervalMap()** - Create new IntervalMap object
|
|
119
|
-
|
|
120
|
-
- `add(x, start, end, value=NULL)`
|
|
121
|
-
Add interval with associated value
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
- `build(x)`
|
|
125
|
-
Build index (required before queries)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- `clear(x)`
|
|
129
|
-
Remove all intervals
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- `reserve(x, n)`
|
|
133
|
-
Reserve space for n intervals
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
- `size(x)`
|
|
137
|
-
Get number of intervals
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
- `at(x, idx)`
|
|
141
|
-
Get interval at index as list(start, end, value)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
- `starts_at(x, idx)`
|
|
145
|
-
Get start position at index
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
- `ends_at(x, idx)`
|
|
149
|
-
Get end position at index
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- `data_at(x, idx)`
|
|
153
|
-
Get value at index
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
- `has_overlaps(x, start, end)`
|
|
157
|
-
Check if any intervals overlap range
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
- `count(x, start, end)`
|
|
161
|
-
Count overlapping intervals
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- `search_values(x, start, end)`
|
|
165
|
-
Get values of overlapping intervals
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
- `search_idxs(x, start, end)`
|
|
169
|
-
Get indices of overlapping intervals
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
- `search_keys(x, start, end)`
|
|
173
|
-
Get list(start, end) of overlapping intervals
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
- `search_items(x, start, end)`
|
|
177
|
-
Get list(start, end, value) of overlapping intervals
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
- `coverage(x, start, end)`
|
|
181
|
-
Get list(count, total_coverage) for range
|
|
39
|
+
Python API documentation can be found here:
|
|
40
|
+
https://github.com/kcleal/superintervals/blob/main/src/superintervals/README.md
|
|
182
41
|
|
|
183
42
|
|
|
184
43
|
## Cpp
|
|
@@ -195,88 +54,8 @@ std::vector<std::string> results;
|
|
|
195
54
|
imap.search_values(4, 9, results);
|
|
196
55
|
```
|
|
197
56
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
**IntervalMap<S, T>** class (also **IntervalMapEytz<S, T>** for Eytzinger layout):
|
|
201
|
-
|
|
202
|
-
- `void add(S start, S end, const T& value)`
|
|
203
|
-
Add interval with associated value
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
- `void build()`
|
|
207
|
-
Build index (required before queries)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
- `void clear()`
|
|
211
|
-
Remove all intervals
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
- `void reserve(size_t n)`
|
|
215
|
-
Reserve space for n intervals
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
- `size_t size()`
|
|
219
|
-
Get number of intervals
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
- `const Interval<S,T>& at(size_t index)`
|
|
223
|
-
Get Interval<S,T> at index
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
- `void at(size_t index, Interval<S,T>& interval)`
|
|
227
|
-
Fill provided Interval object
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
- `bool has_overlaps(S start, S end)`
|
|
231
|
-
Check if any intervals overlap range
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
- `size_t count(S start, S end)`
|
|
235
|
-
Count overlapping intervals (SIMD optimized)
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
- `size_t count_linear(S start, S end)`
|
|
239
|
-
Count overlapping intervals (linear)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
- `size_t count_large(S start, S end)`
|
|
243
|
-
Count optimized for large ranges
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
- `void search_values(S start, S end, std::vector<T>& found)`
|
|
247
|
-
Fill vector with values of overlapping intervals
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
- `void search_values_large(S start, S end, std::vector<T>& found)`
|
|
251
|
-
Search optimized for large ranges
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
- `void search_idxs(S start, S end, std::vector<size_t>& found)`
|
|
255
|
-
Fill vector with indices of overlapping intervals
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
- `void search_keys(S start, S end, std::vector<std::pair<S,S>>& found)`
|
|
259
|
-
Fill vector with (start,end) pairs
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
- `void search_items(S start, S end, std::vector<Interval<S,T>>& found)`
|
|
263
|
-
Fill vector with Interval<S,T> objects
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
- `void search_point(S point, std::vector<T>& found)`
|
|
267
|
-
Find intervals containing single point
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
- `void coverage(S start, S end, std::pair<size_t,S>& result)`
|
|
271
|
-
Get pair(count, total_coverage) for range
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
- `IndexRange search_idxs(S start, S end)`
|
|
275
|
-
Returns IndexRange for range-based loops over indices
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
- `ItemRange search_items(S start, S end)`
|
|
279
|
-
Returns ItemRange for range-based loops over intervals
|
|
57
|
+
C++ API documentation can be found here:
|
|
58
|
+
https://github.com/kcleal/superintervals/blob/main/src/README.md
|
|
280
59
|
|
|
281
60
|
|
|
282
61
|
## Rust
|
|
@@ -293,88 +72,9 @@ let mut results = Vec::new();
|
|
|
293
72
|
imap.search_values(4, 11, &mut results);
|
|
294
73
|
```
|
|
295
74
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
**IntervalMap<T>** struct (also **IntervalMapEytz<T>** for Eytzinger layout):
|
|
299
|
-
|
|
300
|
-
- `fn new() -> Self`
|
|
301
|
-
Create new IntervalMap
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
- `fn add(&mut self, start: i32, end: i32, value: T)`
|
|
305
|
-
Add interval with associated value
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
- `fn build(&mut self)`
|
|
309
|
-
Build index (required before queries)
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
- `fn clear(&mut self)`
|
|
313
|
-
Remove all intervals
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
- `fn reserve(&mut self, n: usize)`
|
|
317
|
-
Reserve space for n intervals
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
- `fn size(&self) -> usize`
|
|
321
|
-
Get number of intervals
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
- `fn at(&self, index: usize) -> Interval<T>`
|
|
325
|
-
Get Interval<T> at index
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
- `fn has_overlaps(&mut self, start: i32, end: i32) -> bool`
|
|
329
|
-
Check if any intervals overlap range
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
- `fn count(&mut self, start: i32, end: i32) -> usize`
|
|
333
|
-
Count overlapping intervals (SIMD optimized)
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
- `fn count_linear(&mut self, start: i32, end: i32) -> usize`
|
|
337
|
-
Count overlapping intervals (linear)
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
- `fn count_large(&mut self, start: i32, end: i32) -> usize`
|
|
341
|
-
Count optimized for large ranges
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
- `fn search_values(&mut self, start: i32, end: i32, found: &mut Vec<T>)`
|
|
345
|
-
Fill vector with values of overlapping intervals
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
- `fn search_values_large(&mut self, start: i32, end: i32, found: &mut Vec<T>)`
|
|
349
|
-
Search optimized for large ranges
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
- `fn search_idxs(&mut self, start: i32, end: i32, found: &mut Vec<usize>)`
|
|
353
|
-
Fill vector with indices of overlapping intervals
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
- `fn search_keys(&mut self, start: i32, end: i32, found: &mut Vec<(i32, i32)>)`
|
|
357
|
-
Fill vector with (start,end) pairs
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
- `fn search_items(&mut self, start: i32, end: i32, found: &mut Vec<Interval<T>>)`
|
|
361
|
-
Fill vector with Interval<T> objects
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
- `fn search_stabbed(&mut self, point: i32, found: &mut Vec<T>)`
|
|
365
|
-
Find intervals containing single point
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
- `fn coverage(&mut self, start: i32, end: i32) -> (usize, i32)`
|
|
369
|
-
Get (count, total_coverage) for range
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
- `fn search_idxs_iter(&mut self, start: i32, end: i32) -> IndexIterator<T>`
|
|
373
|
-
Iterator over indices
|
|
374
|
-
|
|
75
|
+
Rust API documentation can be found here:
|
|
76
|
+
https://github.com/kcleal/superintervals/blob/main/src/README.md
|
|
375
77
|
|
|
376
|
-
- `fn search_items_iter(&mut self, start: i32, end: i32) -> ItemIterator<T>`
|
|
377
|
-
Iterator over intervals
|
|
378
78
|
|
|
379
79
|
|
|
380
80
|
## Test programs
|
|
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
|
|
|
8
8
|
|
|
9
9
|
[project]
|
|
10
10
|
name = "superintervals"
|
|
11
|
-
version = "0.3.
|
|
11
|
+
version = "0.3.2"
|
|
12
12
|
description = "Rapid interval intersections"
|
|
13
13
|
dependencies = ['Cython']
|
|
14
14
|
authors = [{name = "Kez Cleal", email = "clealk@cardiff.ac.uk"}]
|