mindquantum.core.circuit.NoiseExcluder

查看源文件
class mindquantum.core.circuit.NoiseExcluder(add_after=True)[源代码]

排除噪声门。

参数:
  • add_after (bool) - 在量子门前面或者后面添加量子信道。默认值: True

样例:

>>> from mindquantum.core.circuit import Circuit, NoiseExcluder, BitFlipAdder, MixerAdder
>>> from mindquantum.core.gates import DepolarizingChannel
>>> circ = Circuit().x(0)
>>> circ += DepolarizingChannel(0.1).on(0)
>>> circ
      ┏━━━┓ ╔════════════╗
q0: ──┨╺╋╸┠─╢ DC(p=1/10) ╟───
      ┗━━━┛ ╚════════════╝
>>> BitFlipAdder(0.1)(circ)
      ┏━━━┓ ╔═════════════╗ ╔════════════╗ ╔═════════════╗
q0: ──┨╺╋╸┠─╢ BFC(p=1/10) ╟─╢ DC(p=1/10) ╟─╢ BFC(p=1/10) ╟───
      ┗━━━┛ ╚═════════════╝ ╚════════════╝ ╚═════════════╝
>>> adder = MixerAdder([NoiseExcluder(), BitFlipAdder(0.1)])
>>> adder(circ)
      ┏━━━┓ ╔═════════════╗ ╔════════════╗
q0: ──┨╺╋╸┠─╢ BFC(p=1/10) ╟─╢ DC(p=1/10) ╟───
      ┗━━━┛ ╚═════════════╝ ╚════════════╝