openfermion.circuits.state_swap_eigen_component

The +/- eigen-component of the operation that swaps states x and y.

For example, state_swap_eigen_component('01', '10', ±1) with angle θ returns ┌ ┐ │0, 0, 0, 0│ │0, 0.5, ±0.5 e^{-iθ}, 0│ │0, ±0.5 e^{iθ}, 0.5, 0│ │0, 0, 0, 0│ └ ┘

x The first state to swap, as a bitstring.
y The second state to swap, as a bitstring. Must have high index than x.
sign The sign of the off-diagonal elements (indicated by +/-1).
angle The phase of the complex off-diagonal elements. Defaults to 0.

Returns: The eigen-component.

ValueError

  • x and y have different lengths
  • x or y contains a character other than '0' and '1'
  • x and y are the same
  • sign is not -1 or 1
TypeError x or y is not a string