mindquantum.core.circuit.ReverseAdder
- class mindquantum.core.circuit.ReverseAdder(adder: ChannelAdderBase)[source]
Reverse the accepter and excluder rules.
- Parameters
adder (
ChannelAdderBase
) – A channel adder.
Examples
>>> 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 ├─── ┗━━━━━━━┛ ╚═════════════╝ ┕━━━━━━┙