Swap the states of the provided qubits. ```python # Example: kernel = cudaq.make_kernel() # Allocate qubit/s to the `kernel`. qubits = kernel.qalloc(2) # Place the 0th qubit in the 1-state. kernel.x(qubits[0])
(self, qubitA, qubitB)
| 1086 | [qubitA.mlirValue, qubitB.mlirValue]) |
| 1087 | |
| 1088 | def swap(self, qubitA, qubitB): |
| 1089 | """ |
| 1090 | Swap the states of the provided qubits. |
| 1091 | |
| 1092 | ```python |
| 1093 | # Example: |
| 1094 | kernel = cudaq.make_kernel() |
| 1095 | # Allocate qubit/s to the `kernel`. |
| 1096 | qubits = kernel.qalloc(2) |
| 1097 | # Place the 0th qubit in the 1-state. |
| 1098 | kernel.x(qubits[0]) |
| 1099 | # Swap their states. |
| 1100 | kernel.swap(qubits[0], qubits[1])) |
| 1101 | ``` |
| 1102 | """ |
| 1103 | with self.insertPoint, self.loc: |
| 1104 | quake.SwapOp([], [], [], [qubitA.mlirValue, qubitB.mlirValue]) |
| 1105 | |
| 1106 | def reset(self, target): |
| 1107 | """ |
no outgoing calls