quemb.shared.numba_helpers.SortedIntSet

class quemb.shared.numba_helpers.SortedIntSet(*args, **kwargs)

A sorted set implementation using Numba’s jitclass.

This class maintains a set of unique integers in sorted order. Internally, it uses a dictionary for fast membership checks and a list for ordered storage of elements. All operations are JIT-compiled for high performance in numerical code.

_lookup

A dictionary mapping integers to booleans, used for fast membership testing and ensuring uniqueness.

Type:

numba.typed.Dict

items

A list of sorted, unique integers representing the elements of the set in ascending order.

Type:

numba.typed.List

Examples

>>> s = SortedIntSet()
>>> s.add(3)
>>> s.add(1)
>>> s.add(2)
>>> s.items
[1, 2, 3]
>>> 2 in s
True
>>> s.remove(2)
>>> s.items
[1, 3]

Attributes

class_type = jitclass.SortedIntSet#7fd6eb4ad790<_lookup:DictType[int64,bool]<iv=None>,items:ListType[int64]>

Methods

__init__()

add(val)

remove(val)