mindquantum.simulator.decompose_stabilizer

查看源文件
mindquantum.simulator.decompose_stabilizer(sim: Simulator | Stabilizer)[源代码]

将一个stabilizer分解为clifford量子线路。

参数:
  • sim (Simulator) - 一个stabilizer模拟器。

样例:

>>> from mindquantum.simulator import Simulator, decompose_stabilizer
>>> from mindquantum.core.circuit import Circuit
>>> stabilizer = Simulator('stabilizer', 2)
>>> stabilizer.apply_circuit(Circuit().h(0).x(1, 0))
>>> decompose_stabilizer(stabilizer)
      ┏━━━┓
q0: ──┨ H ┠───■─────
      ┗━━━┛   ┃
            ┏━┻━┓
q1: ────────┨╺╋╸┠───
            ┗━━━┛
>>> from mindquantum.algorithm.error_mitigation import query_single_qubit_clifford_elem
>>> decompose_stabilizer(query_single_qubit_clifford_elem(10))
      ┏━━━┓ ┏━━━┓ ┏━━━━┓
q0: ──┨╺╋╸┠─┨ Z ┠─┨ S† ┠───
      ┗━━━┛ ┗━━━┛ ┗━━━━┛