MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / mx

Method mx

python/cudaq/kernel/kernel_builder.py:1177–1207  ·  view source on GitHub ↗

Measure the given qubit or qubits in the X-basis. The optional `register_name` may be used to retrieve results of this measurement after execution on the QPU. If the measurement call is saved as a variable, it will return a :class:`QuakeValue` handle to the measureme

(self, target, regName=None)

Source from the content-addressed store, hash-verified

1175 return self.__measure(quake.MzOp, target, regName)
1176
1177 def mx(self, target, regName=None):
1178 """
1179 Measure the given qubit or qubits in the X-basis. The optional
1180 `register_name` may be used to retrieve results of this measurement
1181 after execution on the QPU. If the measurement call is saved as a
1182 variable, it will return a :class:`QuakeValue` handle to the measurement
1183 instruction.
1184
1185 Args:
1186 target (:class:`QuakeValue`): The qubit or qubits to measure.
1187 register_name (Optional[:obj:`str`]): The optional name to provide the
1188 results of the measurement. Defaults to ``None``, in which case
1189 no register name is attached to the measurement op.
1190
1191 Returns:
1192 :class:`QuakeValue`: A handle to this measurement operation in the MLIR.
1193
1194 Note:
1195 Measurements may be applied both mid-circuit and at the end of
1196 the circuit. Conditional logic on mid-circuit measurements is no longer
1197 supported.
1198
1199 ```python
1200 kernel = cudaq.make_kernel()
1201 # Allocate qubit/s to measure.
1202 qubit = kernel.qalloc()
1203 # Measure the qubit/s in the X-basis.
1204 kernel.mx(qubit))
1205 ```
1206 """
1207 return self.__measure(quake.MxOp, target, regName)
1208
1209 def my(self, target, regName=None):
1210 """

Calls 1

__measureMethod · 0.95