mindquantum.core.circuit.DepolarizingChannelAdder
- class mindquantum.core.circuit.DepolarizingChannelAdder(p: float, n_qubits: int, add_after: bool = True)[源代码]
去极化信道添加器。
- 参数:
p (float) - 去极化信道概率。
n_qubits (int) - 去极化信道的比特数。
add_after (bool) - 在量子门前面或者后面添加量子信道。默认值:
True
。
样例:
>>> from mindquantum.core.circuit import MixerAdder, DepolarizingChannelAdder, GateSelector >>> from mindquantum.core.circuit import Circuit >>> circ = Circuit().h(0).x(1, 0) >>> adder = MixerAdder([GateSelector('cx'), DepolarizingChannelAdder(0.1, 2)]) >>> adder(circ) ┏━━━┓ ╔════════════╗ q0: ──┨ H ┠───■───╢ ╟─── ┗━━━┛ ┃ ║ ║ ┏━┻━┓ ║ DC(p=1/10) ║ q1: ────────┨╺╋╸┠─╢ ╟─── ┗━━━┛ ╚════════════╝