def fermion_generator(self) -> 'openfermion.FermionOperator': """The FermionOperator G such that the gate's unitary is exp(-i t G) with exponent t using the Jordan-Wigner transformation.""" half_generator = sum( (w * G for w, G in zip(self.weights, self.fermion_generator_components()) ), ops.FermionOperator()) return half_generator + hermitian_conjugated(half_generator)
def fermion_generator_components(): return ( ops.FermionOperator(((0, 1), (1, 0), (2, 0), (3, 1)), -1), ops.FermionOperator(((0, 1), (1, 0), (2, 1), (3, 0))), ops.FermionOperator(((0, 1), (1, 1), (2, 0), (3, 0)), -1), )
def fermion_generator_components(): return ( ops.FermionOperator(((0, 1), (1, 0))), ops.FermionOperator(((0, 1), (0, 0), (1, 1), (1, 0)), 0.5), )