oasislmf.pytools.aal.utils

Functions

heap_push(heap, size, element)

Heapq heappush

heap_pop(heap, size)

Heapq heappop

init_heap([num_rows])

Initialise heap

exact_binary_search(arr, value)

if no match is found return len(arr) instead of the insert index like in normal binary search

Module Contents

oasislmf.pytools.aal.utils.heap_push(heap, size, element)[source]

Heapq heappush

oasislmf.pytools.aal.utils.heap_pop(heap, size)[source]

Heapq heappop

oasislmf.pytools.aal.utils.init_heap(num_rows=4)[source]

Initialise heap

if no match is found return len(arr) instead of the insert index like in normal binary search >>> exact_binary_search(np.array([1,3,5,7,9]), 3) 1

>>> exact_binary_search(np.array([1,3,5,7,9]), 0)
5
>>> exact_binary_search(np.array([1,3,5,7,9]), 4)
5
>>> exact_binary_search(np.array([1,3,5,7,9]), 9)
4