SymbolicCliffordOptimization
QuICT.qcda.optimization.symbolic_clifford_optimization.SymbolicCliffordOptimization ¶
Bases: object
Implement the Clifford circuit optimization process described in Reference, which consists of the following 4 steps: 1. Partition the circuit into compute and Pauli stages 2. Apply template matching to the compute stage 3. Apply symbolic peephole optimization to the compute stage 4. Optimize the 1-qubit gate count
Reference
Clifford Circuit Optimization with Templates and Symbolic Pauli Gates
https://arxiv.org/abs/2105.02291
Examples:
>>> from QuICT.qcda.optimization import SymbolicCliffordOptimization
>>> SCO = SymbolicCliffordOptimization()
>>> circ_opt = SCO.execute(circ)
Parameters:
-
control_sets(list, default:None) –containing several control_set, which is list of qubit, CX coupling control_set and the complement would be decoupled
Source code in QuICT/qcda/optimization/symbolic_clifford_optimization/symbolic_clifford_optimization.py
cx_reverse ¶
For CX in the CompositeGate, if its target qubit is in the control_set while its control qubit is not, the control and target qubit will be reversed by adding H gates.
Source code in QuICT/qcda/optimization/symbolic_clifford_optimization/symbolic_clifford_optimization.py
execute ¶
Parameters:
-
gates(Union[Circuit, CompositeGate]) –the Clifford Circuit/CompositeGate to be optimized
Returns:
-
CompositeGate(CompositeGate) –the Clifford CompositeGate after optimization
Source code in QuICT/qcda/optimization/symbolic_clifford_optimization/symbolic_clifford_optimization.py
local_symbolic_optimization
classmethod
¶
Inner method for symbolic peephole optimization
Source code in QuICT/qcda/optimization/symbolic_clifford_optimization/symbolic_clifford_optimization.py
partition
staticmethod
¶
Partition the CompositeGate into compute and Pauli stages, where compute stage contains only CX, H, S, Sdg gates and Pauli stage contains only Pauli gates.
Parameters:
-
gates(CompositeGate) –Clifford CompositeGate
-
width(int, default:None) –width of the CompositeGate
Returns:
-
Tuple[CompositeGate, PauliOperator]–Tuple[CompositeGate, PauliOperator]: compute stage and Pauli stage
Source code in QuICT/qcda/optimization/symbolic_clifford_optimization/symbolic_clifford_optimization.py
reorder ¶
For CompositeGate with CX, H, S only, reorder gates so that S appears as late as possible
Source code in QuICT/qcda/optimization/symbolic_clifford_optimization/symbolic_clifford_optimization.py
symbolic_peephole_optimization
classmethod
¶
Symbolic Pauli gate gives another expression for controlled Pauli gates. By definition, a controlled-U gate CU means: if the control qubit is \(|1 \rangle\), do nothing; if the control qubit is \(|0 \rangle\), apply U to the target qubit. In general, \(CU = ∑_v |v \rangle \langle v| \otimes U^v\), where U^v is called a symbolic gate.
Here we focus only on symbolic Pauli gates and symbolic phase. By decoupling CNOT gates with projectors and symbolic Pauli gates, optimization rules of 1-qubit gates could be used to optimize Clifford circuits.
Parameters:
-
gates(CompositeGate) –CompositeGate with CX, H, S gates only where the CX coupling control_set and the complement must have the control qubit in control_set
-
control_set(list) –list of qubit, CX coupling control_set and the complement would be decoupled
Returns:
-
CompositeGate(CompositeGate) –CompositeGate after optimization