mindquantum.core.circuit.ReverseAdder
- class mindquantum.core.circuit.ReverseAdder(adder: ChannelAdderBase)[源代码]
翻转给定信道添加器的接受和拒绝规则。
- 参数:
adder (
ChannelAdderBase
) - 一个信道添加器。
样例:
>>> from mindquantum.core.circuit import ReverseAdder, MeasureAccepter, BitFlipAdder, MixerAdder >>> from mindquantum.core.circuit import Circuit >>> circ = Circuit().rx('a', 0).measure_all() >>> only_measure = MixerAdder([BitFlipAdder(0.1), MeasureAccepter()]) >>> only_measure(circ) ┏━━━━━━━┓ ┍━━━━━━┑ ╔═════════════╗ q0: ──┨ RX(a) ┠─┤ M q0 ├─╢ BFC(p=1/10) ╟─── ┗━━━━━━━┛ ┕━━━━━━┙ ╚═════════════╝ >>> no_measure = ReverseAdder(only_measure) >>> no_measure(circ) ┏━━━━━━━┓ ╔═════════════╗ ┍━━━━━━┑ q0: ──┨ RX(a) ┠─╢ BFC(p=1/10) ╟─┤ M q0 ├─── ┗━━━━━━━┛ ╚═════════════╝ ┕━━━━━━┙