def transpile_gate(qiskit_circuit: QuantumCircuit, shor_layer: _Layer): symbol = to_qiskit_symbol(shor_layer) if isinstance(shor_layer, _Operation): if symbol == "measure": if len(shor_layer.qbits) == len( shor_layer.bits) == qiskit_circuit.size(): qiskit_circuit.measure_active() else: for qbit, bit in zip(shor_layer.qbits, shor_layer.bits): qiskit_circuit.measure(qbit, bit) return args = [] kwargs = {} if symbol in ["crx", "cry", "crz", "cu1", "rx", "ry", "rz", "u1"]: args.append(shor_layer.angle) if symbol in ["u", "u3"]: args.append(shor_layer.theta) if symbol in ["u", "u2", "u3"]: args.append(shor_layer.phi) args.append(shor_layer.lam) args.extend(shor_layer.qbits) qiskit_circuit.__getattribute__(symbol)(*args, **kwargs)