mindquantum.simulator.get_stabilizer_string

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

Get the string expression of a stabilizer.

Parameters

sim (Simulator) – A stabilizer simulator.

Examples

>>> from mindquantum.simulator import Simulator, get_stabilizer_string
>>> from mindquantum.core.circuit import Circuit
>>> stabilizer = Simulator('stabilizer', 2)
>>> stabilizer.apply_circuit(Circuit().h(0).x(1, 0))
>>> print(get_stabilizer_string(stabilizer))
destabilizer:
+IZ
+XI
stabilizer:
+XX
+ZZ