View source on GitHub |
up then down reordering, given the operator has the default even-odd ordering.
openfermion.utils.up_then_down(
mode_idx, num_modes
)
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.
Args | |
---|---|
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.