quemb.molbe.sparse_2el_integral.get_blocks

quemb.molbe.sparse_2el_integral.get_blocks(reachable)

Return the value of the border elements of contiguous blocks in the sequence X.”

A block is defined as a sequence of consecutive integers. Returns a list of tuples, where each tuple contains the value at the start and at the end of a block.

Parameters:

X

Return type:

list[tuple[TypeVar(_T, int, integer), TypeVar(_T, int, integer)]]

Example

>>> X = [1, 2, 3, 5, 6, 7, 9, 10]
>>> get_blocks(X) == [(1, 3), (5, 7), (9, 10)]