mindquantum.core.circuit.NoiseChannelAdder

View Source On Gitee
class mindquantum.core.circuit.NoiseChannelAdder(channel: NoiseGate, with_ctrl=True, focus_on: int = None, add_after: bool = True)[source]

Add single qubit quantum channel.

Parameters
  • channel (NoiseGate) – A single qubit quantum channel.

  • with_ctrl (bool) – Whether add quantum channel for control qubits. Default: True.

  • focus_on (int) – Only add this noise channel on focus_on qubit. If None, add to all qubits of selected quantum gate. Default: None.

  • 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 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) ╟───
            ┗━━━┛ ╚═════════════╝