Learn more about our quantum error correction milestone

openfermion.utils.up_then_down

up then down reordering, given the operator has the default even-odd

ordering. Otherwise this function will reorder indices where all even indices now come before odd indices.

Example: 0,1,2,3,4,5 -> 0,2,4,1,3,5

The function takes in the index of the mode that will be relabeled and the total number modes.

mode_idx (int): the mode index that is being reordered num_modes (int): the total number of modes of the operator.

Returns (int): reordered index of the mode.