def cx(self, circuit, control_qubit, target_qubit, control, target):
if target in self.__coupling_map[control]:
logger.log(logging.VERBOSE, 'cx() - cnot: (%s, %s)', str(control), str(target))
circuit.cx(control_qubit, target_qubit)
elif control in self.__coupling_map[target]:
logger.log(logging.VERBOSE, 'cx() - inverse-cnot: (%s, %s)', str(control), str(target))
circuit.h(control_qubit)
circuit.h(target_qubit)
circuit.cx(target_qubit, control_qubit)
circuit.h(control_qubit)
circuit.h(target_qubit)
else:
logger.critical('cx() - Cannot connect qubit %s to qubit %s', str(control), str(target))
exit(3)
# place cnot gates based on the path created in create_path method
评论列表
文章目录