mindquantum.simulator.decompose_stabilizer

View Source On Gitee
mindquantum.simulator.decompose_stabilizer(sim: Simulator | Stabilizer)[source]

Decompose a stabilizer into clifford quantum circuit.

Parameters

sim (Simulator) – A stabilizer simulator.

Examples

>>> 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† ┠───
      ┗━━━┛ ┗━━━┛ ┗━━━━┛