mindquantum.core.gates.PauliChannel
- class mindquantum.core.gates.PauliChannel(px: float, py: float, pz: float, **kwargs)[source]
A pauli channel.
Pauli channel express error that randomly applies an additional
, or gate on qubits with different probabilities , and , or do noting (applies gate) with probability .Pauli channel applies noise as:
where
is quantum state as density matrix type; , and is the probability of applying an additional , and gate.- Parameters
Examples
>>> from mindquantum.core.gates import PauliChannel >>> from mindquantum.core.circuit import Circuit >>> circ = Circuit() >>> circ += PauliChannel(0.8, 0.1, 0.1).on(0) >>> circ.measure_all() >>> print(circ) ╔══════════════════════════════╗ ┍━━━━━━┑ q0: ──╢ PC(px=4/5, py=1/10, pz=1/10) ╟─┤ M q0 ├─── ╚══════════════════════════════╝ ┕━━━━━━┙ >>> from mindquantum.simulator import Simulator >>> sim = Simulator('mqvector', 1) >>> sim.sampling(circ, shots=1000, seed=42) shots: 1000 Keys: q0│0.00 0.2 0.4 0.6 0.8 1.0 ────────┼───────────┴───────────┴───────────┴───────────┴───────────┴ 0│▒▒▒▒▒▒▒ │ 1│▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ │ {'0': 101, '1': 899}