mindquantum.core.circuit.DepolarizingChannelAdder#
- class mindquantum.core.circuit.DepolarizingChannelAdder(p: float, n_qubits: int, add_after: bool = True)#
Add DepolarizingChannel.
- Parameters:
p (float) – probability of occurred depolarizing error.
n_qubits (int) – the qubit number of depolarizing channel.
add_after (bool) – Whether add this channel after quantum gate or not. If
False, the channel will add before quantum gate. Default:True.
Examples
>>> 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: ────────┨╺╋╸┠─╢ ╟─── ┗━━━┛ ╚════════════╝