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

Method my

python/cudaq/kernel/kernel_builder.py:1209–1240  ·  view source on GitHub ↗

Measure the given qubit or qubits in the Y-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

1207 return self.__measure(quake.MxOp, target, regName)
1208
1209 def my(self, target, regName=None):
1210 """
1211 Measure the given qubit or qubits in the Y-basis. The optional
1212 `register_name` may be used to retrieve results of this measurement
1213 after execution on the QPU. If the measurement call is saved as a
1214 variable, it will return a :class:`QuakeValue` handle to the measurement
1215 instruction.
1216
1217 Args:
1218 target (:class:`QuakeValue`): The qubit or qubits to measure.
1219 register_name (Optional[:obj:`str`]): The optional name to provide the
1220 results of the measurement. Defaults to ``None``, in which case
1221 no register name is attached to the measurement op.
1222
1223 Returns:
1224 :class:`QuakeValue`: A handle to this measurement operation in the MLIR.
1225
1226 Note:
1227 Measurements may be applied both mid-circuit and at the end of
1228 the circuit. Conditional logic on mid-circuit measurements is no longer
1229 supported.
1230
1231 ```python
1232 # Example:
1233 kernel = cudaq.make_kernel()
1234 # Allocate qubit/s to measure.
1235 qubit = kernel.qalloc()
1236 # Measure the qubit/s in the Y-basis.
1237 kernel.my(qubit))
1238 ```
1239 """
1240 return self.__measure(quake.MyOp, target, regName)
1241
1242 def __qecOperandValue(self, qv, opName):
1243 """Normalize a builder-side QEC operand: must be a

Calls 1

__measureMethod · 0.95