openfermion.measurements.pair_between

Pairs between two fragments of a larger list

A pairing of a list is a set of pairs of list elements. E.g. a pairing of

labels = [1, 2, 3, 4, 5, 6, 7, 8]

could be

[(1, 2), (3, 4), (5, 6), (7, 8)]

(Note that we insist each element only appears in a pairing once; the following is not a pairing:

[(1, 1), (2, 2), (3, 4), (5, 6), (7, 8)]

This function generates a set of pairings between elements of frag1 and frag2 such that element1 in frag 1 and element2 in frag2, the pair (element1, element2) is found exactly once within the pairing.

frag1, frag2 (lists): the elements to be paired
start_offset int

prevents the first start_offset pairings from being yielded

pairing tuple: the desired pairings, followed by any unpaired elements