mindquantum.core.circuit.MeasureAccepter

查看源文件
class mindquantum.core.circuit.MeasureAccepter[源代码]

选取测量门。

样例:

>>> from mindquantum.core.circuit import MeasureAccepter, BitFlipAdder, MixerAdder
>>> from mindquantum.core.circuit import Circuit
>>> circ = Circuit().rx('a', 0).h(0).measure_all()
>>> only_measure = MixerAdder([BitFlipAdder(0.1), MeasureAccepter()], add_after=False)
>>> only_measure(circ)
      ┏━━━━━━━┓ ┏━━━┓ ╔═════════════╗ ┍━━━━━━┑
q0: ──┨ RX(a) ┠─┨ H ┠─╢ BFC(p=1/10) ╟─┤ M q0 ├───
      ┗━━━━━━━┛ ┗━━━┛ ╚═════════════╝ ┕━━━━━━┙