mindquantum.core.circuit.ReverseAdder

查看源文件
class mindquantum.core.circuit.ReverseAdder(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 ├───
      ┗━━━━━━━┛ ╚═════════════╝ ┕━━━━━━┙