mindquantum.core.gates.PauliChannel
- class mindquantum.core.gates.PauliChannel(px: float, py: float, pz: float, **kwargs)[源代码]
泡利信道。描述的噪声体现为:在量子比特上随机作用一个额外的泡利门,作用
、 和 门对应概率分别为 、 和 ,或以概率 的概率保持不变(作用 门)。泡利信道的数学表示如下:
其中,
是密度矩阵形式的量子态; 、 和 是作用的泡利门为 、 和 门的概率。- 参数:
px (int, float) - 作用的泡利门是X门的概率。
py (int, float) - 作用的泡利门是Y门的概率。
pz (int, float) - 作用的泡利门是Z门的概率。
样例:
>>> 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}