mindquantum.core.circuit.MeasureAccepter

View Source On Gitee
class mindquantum.core.circuit.MeasureAccepter[source]

Select measurement gate.

Examples

>>> 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 ├───
      ┗━━━━━━━┛ ┗━━━┛ ╚═════════════╝ ┕━━━━━━┙