mindquantum.core.circuit.GateSelector
- class mindquantum.core.circuit.GateSelector(gate: str)[source]
Select gate to add noise channel.
- Parameters
gate (str) – Gate you want to add channel. Could be one of ‘H’, ‘X’, ‘Y’, ‘Z’, ‘RX’, ‘RY’, ‘RZ’, ‘CX’, ‘CZ’, ‘SWAP’.
Examples
>>> from mindquantum.core.circuit import BitFlipAdder, GateSelector, Circuit, MixerAdder >>> circ = Circuit().h(0).x(1, 0) >>> circ ┏━━━┓ q0: ──┨ H ┠───■───── ┗━━━┛ ┃ ┏━┻━┓ q1: ────────┨╺╋╸┠─── ┗━━━┛ >>> adder = MixerAdder([BitFlipAdder(0.1), GateSelector('cx')]) >>> adder(circ) ┏━━━┓ ╔═════════════╗ q0: ──┨ H ┠───■───╢ BFC(p=1/10) ╟─── ┗━━━┛ ┃ ╚═════════════╝ ┏━┻━┓ ╔═════════════╗ q1: ────────┨╺╋╸┠─╢ BFC(p=1/10) ╟─── ┗━━━┛ ╚═════════════╝
- property supported_gate
Get supported gate for gate selector.