mindquantum.core.gates.PauliChannel

查看源文件
class mindquantum.core.gates.PauliChannel(px: float, py: float, pz: float, **kwargs)[源代码]

泡利信道。描述的噪声体现为:在量子比特上随机作用一个额外的泡利门,作用 XYZ 门对应概率分别为 PxPyPz ,或以概率 1PxPyPz 的概率保持不变(作用 I 门)。

泡利信道的数学表示如下:

ϵ(ρ)=(1PxPyPz)ρ+PxXρX+PyYρY+PzZρZ

其中, ρ 是密度矩阵形式的量子态; PxPyPz 是作用的泡利门为 XYZ 门的概率。

参数:
  • 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}
define_projectq_gate()[源代码]

定义对应的projectq门。

get_cpp_obj()[源代码]

返回量子门的c++对象。

matrix()[源代码]

返回该噪声信道的Kraus算符。

返回:

list,包含了该噪声信道的Kraus算符。