@@ -34,7 +34,10 @@ function prepend_inv! end
3434
3535
3636# FAST versions of prepend! and prepend_inv! for CliffordOperator - TODO
37- prepend! (l:: CliffordOperator , r; phases) = prepend! (l, CliffordOperator (r, nqubits (l)); phases= phases)
37+ function prepend! (l:: CliffordOperator , r; phases)
38+ @warn " Slow prepend! operation"
39+ prepend! (l, CliffordOperator (r, nqubits (l)); phases= phases)
40+ end
3841
3942function prepend! (l:: CliffordOperator , r:: CliffordOperator ; phases= false )
4043 nqubits (l)== nqubits (r) || throw (DimensionMismatch (" The tableau and the Clifford operator need to act on the same number of qubits. Consider specifying an array of indices as a third argument to the `apply!` function to avoid this error." ))
7174 new_lrow
7275end
7376
77+
78+ function prepend_inv! (l:: CliffordOperator , r; phases= false )
79+ @warn " Slow prepend_inv! operation"
80+ prepend! (l, inv (CliffordOperator (r, nqubits (l))); phases= phases)
81+ end
7482function prepend_inv! (l:: CliffordOperator , r:: CliffordOperator ; phases= false )
7583 prepend! (l, inv (r); phases= phases)
7684end
7785
78- # SLOW
79- function prepend_inv! (l:: CliffordOperator , r; phases= false )
80- prepend! (l, inv (CliffordOperator (r, nqubits (l))); phases= phases)
86+ # Symbolic
87+ function prepend! (l:: CliffordOperator , r:: sX ; phases= false )
88+ tab (l). phases[nqubits (l)+ r. q] ⊻= 0x02
89+ return l
8190end
91+ function prepend! (l:: CliffordOperator , r:: sY ; phases= false )
92+ tab (l). phases[r. q] ⊻= 0x02
93+ tab (l). phases[nqubits (l)+ r. q] ⊻= 0x02
94+ return l
95+ end
96+ function prepend! (l:: CliffordOperator , r:: sZ ; phases= false )
97+ tab (l). phases[r. q] ⊻= 0x02
98+ return l
99+ end
100+
101+ function prepend_inv! (l:: CliffordOperator , r:: sX ; phases= false )
102+ tab (l). phases[nqubits (l)+ r. q] ⊻= 0x02
103+ return l
104+ end
105+ function prepend_inv! (l:: CliffordOperator , r:: sY ; phases= false )
106+ error (" Not implemented: prepend_inv!(l, r::sY)" )
107+ return l
108+ end
109+ function prepend_inv! (l:: CliffordOperator , r:: sZ ; phases= false )
110+ tab (l). phases[r. q] ⊻= 0x02
111+ return l
112+ end
113+
82114
83115"""
84116Simulates measurement results of a Clifford circuit acting on an `n`-qubit |0⟩^⊗n state using the stabilizer tableau backtracking method,
0 commit comments