def _decompose_(self): boolean_exprs = [ sympy_parser.parse_expr(boolean_str) for boolean_str in self._boolean_strs ] hamiltonian_polynomial_list = [ PauliSum.from_boolean_expression(boolean_expr, self._qubit_map) for boolean_expr in boolean_exprs ] return _get_gates_from_hamiltonians(hamiltonian_polynomial_list, self._qubit_map, self._theta)
def _decompose_(self, qubits: Sequence['cirq.Qid']) -> 'cirq.OP_TREE': qubit_map = dict(zip(self._parameter_names, qubits)) boolean_exprs = [ sympy_parser.parse_expr(boolean_str) for boolean_str in self._boolean_strs ] hamiltonian_polynomial_list = [ PauliSum.from_boolean_expression(boolean_expr, qubit_map) for boolean_expr in boolean_exprs ] return _get_gates_from_hamiltonians(hamiltonian_polynomial_list, qubit_map, self._theta)
def __sub__(self, other): from cirq.ops.linear_combinations import PauliSum return PauliSum.from_pauli_strings(self).__sub__(other)