mindquantum.core.circuit.NoiseChannelAdder
- class mindquantum.core.circuit.NoiseChannelAdder(channel: NoiseGate, with_ctrl=True, focus_on: int = None, add_after: bool = True)[源代码]
添加一个单比特量子信道。
- 参数:
channel (
NoiseGate
) - 一个单比特量子信道。with_ctrl (bool) - 是否在控制为上添加比特。默认值:
True
。focus_on (int) - 只讲该噪声信道作用在
focus_on
比特上。如果为None
,则作用在量子门的所有比特上。默认值:None
。add_after (bool) - 是否在量子门后面添加信道。如果为
False
,信道将会加在量子门前面。默认值:True
。
样例:
>>> from mindquantum.core.circuit import NoiseChannelAdder, Circuit >>> from mindquantum.core.gates import AmplitudeDampingChannel >>> circ = Circuit().h(0).x(1, 0) >>> channel = AmplitudeDampingChannel(0.3) >>> adder1 = NoiseChannelAdder(channel, with_ctrl=True, add_after=True) >>> adder1(circ) ┏━━━┓ ╔═════════════╗ ╔═════════════╗ q0: ──┨ H ┠─╢ ADC(γ=3/10) ╟───■───╢ ADC(γ=3/10) ╟─── ┗━━━┛ ╚═════════════╝ ┃ ╚═════════════╝ ┏━┻━┓ ╔═════════════╗ q1: ────────────────────────┨╺╋╸┠─╢ ADC(γ=3/10) ╟─── ┗━━━┛ ╚═════════════╝ >>> adder2 = NoiseChannelAdder(channel, with_ctrl=True, focus_on=1, add_after=True) >>> adder2(circ) ┏━━━┓ q0: ──┨ H ┠───■───────────────────── ┗━━━┛ ┃ ┏━┻━┓ ╔═════════════╗ q1: ────────┨╺╋╸┠─╢ ADC(γ=3/10) ╟─── ┗━━━┛ ╚═════════════╝