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

Method detectors

python/cudaq/kernel/kernel_builder.py:1308–1322  ·  view source on GitHub ↗

Define N detectors by pairing two measurement vectors element-wise. Standard form for cross-round detectors: each detector ``i`` is the parity of ``prev[i]`` and ``curr[i]``. Both arguments must be ``list[cudaq.measure_handle]`` handles (returned by ``kernel.mz`` on a

(self, prev, curr)

Source from the content-addressed store, hash-verified

1306 qec.ObservableOp(values, observableIndex=idxAttr)
1307
1308 def detectors(self, prev, curr):
1309 """Define N detectors by pairing two measurement vectors
1310 element-wise. Standard form for cross-round detectors: each
1311 detector ``i`` is the parity of ``prev[i]`` and ``curr[i]``.
1312 Both arguments must be ``list[cudaq.measure_handle]`` handles
1313 (returned by ``kernel.mz`` on a ``qvector``).
1314 """
1315 with self.ctx, self.insertPoint, self.loc:
1316 prevV = self.__qecOperandValue(prev, "detectors")
1317 currV = self.__qecOperandValue(curr, "detectors")
1318 for v in (prevV, currV):
1319 if not cc.StdvecType.isinstance(v.type):
1320 emitFatalError("kernel.detectors arguments must each be a "
1321 "list[cudaq.measure_handle]")
1322 qec.DetectorsOp(prevV, currV)
1323
1324 def adjoint(self, otherKernel, *target_arguments):
1325 """

Callers 8

kernel_pair_detectorsFunction · 0.45
test_b_pair_detectorsFunction · 0.45
test_make_kernel_builderFunction · 0.45
kFunction · 0.45
CUDAQ_TESTFunction · 0.45
memory_experimentFunction · 0.45
mainFunction · 0.45

Calls 2

__qecOperandValueMethod · 0.95
emitFatalErrorFunction · 0.70

Tested by 5

test_b_pair_detectorsFunction · 0.36
test_make_kernel_builderFunction · 0.36
kFunction · 0.36
CUDAQ_TESTFunction · 0.36