View source on GitHub |
Linear code that reorders orbitals from even-odd to up-then-down.
openfermion.transforms.interleaved_code(
modes: int
) -> openfermion.ops.BinaryCode
In up-then-down convention, one can append two instances of the same code 'c' in order to have two symmetric subcodes that are symmetric for spin-up and -down modes: ' c + c '. In even-odd, one can concatenate with the interleaved_code to have the same result:' interleaved_code * (c + c)'. This code changes the order of modes from (0, 1 , 2, ... , modes-1 ) to (0, modes/2, 1 modes/2+1, ... , modes-1, modes/2 - 1). n_qubits = n_modes.
Args: modes (int): number of modes, must be even
Returns (BinaryCode): code that interleaves orbitals