Skip to content

Commit cba5796

Browse files
committed
Add Clifford Labels to interalgates.py
Added labels for all 24 single qubit Clifford gates to internalgates.py. The labels show the decomposition of each Clifford gate into the gates {I, X, Y, Z, H, P, Pdag}.
1 parent 4f2a270 commit cba5796

File tree

1 file changed

+50
-55
lines changed

1 file changed

+50
-55
lines changed

pygsti/tools/internalgates.py

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,31 @@ def internal_gate_unitaries():
7373
std_unitaries['HP'] = _np.dot(std_unitaries['H'], std_unitaries['P'])
7474
std_unitaries['PH'] = _np.dot(std_unitaries['P'], std_unitaries['H'])
7575
std_unitaries['HPH'] = _np.dot(std_unitaries['H'], _np.dot(std_unitaries['P'], std_unitaries['H']))
76-
# The 1-qubit Clifford group. The labelling is the same as in the the 1-qubit Clifford group generated
77-
# in pygsti.extras.rb.group, with the mapping 'Ci' - > 'Gci'. (we keep with the convention here of not have
78-
# hard-coded unitaries starting with a 'G'.)
79-
std_unitaries['C0'] = _np.array([[1, 0], [0, 1]], complex)
80-
std_unitaries['C1'] = _np.array([[1, -1j], [1, 1j]], complex) / _np.sqrt(2)
81-
std_unitaries['C2'] = _np.array([[1, 1], [1j, -1j]], complex) / _np.sqrt(2)
82-
std_unitaries['C3'] = _np.array([[0, 1], [1, 0]], complex)
83-
std_unitaries['C4'] = _np.array([[-1, -1j], [1, -1j]], complex) / _np.sqrt(2)
84-
std_unitaries['C5'] = _np.array([[1, 1], [-1j, 1j]], complex) / _np.sqrt(2)
85-
std_unitaries['C6'] = _np.array([[0, -1j], [1j, 0]], complex)
86-
std_unitaries['C7'] = _np.array([[1j, 1], [-1j, 1]], complex) / _np.sqrt(2)
87-
std_unitaries['C8'] = _np.array([[1j, -1j], [1, 1]], complex) / _np.sqrt(2)
88-
std_unitaries['C9'] = _np.array([[1, 0], [0, -1]], complex)
89-
std_unitaries['C10'] = _np.array([[1, 1j], [1, -1j]], complex) / _np.sqrt(2)
90-
std_unitaries['C11'] = _np.array([[1, -1], [1j, 1j]], complex) / _np.sqrt(2)
91-
std_unitaries['C12'] = _np.array([[1, 1], [1, -1]], complex) / _np.sqrt(2)
92-
std_unitaries['C13'] = _np.array([[0.5 - 0.5j, 0.5 + 0.5j], [0.5 + 0.5j, 0.5 - 0.5j]], complex)
93-
std_unitaries['C14'] = _np.array([[1, 0], [0, 1j]], complex)
94-
std_unitaries['C15'] = _np.array([[1, 1], [-1, 1]], complex) / _np.sqrt(2)
95-
std_unitaries['C16'] = _np.array([[0.5 + 0.5j, 0.5 - 0.5j], [0.5 - 0.5j, 0.5 + 0.5j]], complex)
96-
std_unitaries['C17'] = _np.array([[0, 1], [1j, 0]], complex)
97-
std_unitaries['C18'] = _np.array([[1j, -1j], [-1j, -1j]], complex) / _np.sqrt(2)
98-
std_unitaries['C19'] = _np.array([[0.5 + 0.5j, -0.5 + 0.5j], [0.5 - 0.5j, -0.5 - 0.5j]], complex)
99-
std_unitaries['C20'] = _np.array([[0, -1j], [-1, 0]], complex)
100-
std_unitaries['C21'] = _np.array([[1, -1], [1, 1]], complex) / _np.sqrt(2)
101-
std_unitaries['C22'] = _np.array([[0.5 + 0.5j, 0.5 - 0.5j], [-0.5 + 0.5j, -0.5 - 0.5j]], complex)
102-
std_unitaries['C23'] = _np.array([[1, 0], [0, -1j]], complex)
76+
# The 1-qubit Clifford group.
77+
std_unitaries['C0'] = _np.array([[1, 0], [0, 1]], complex) # This is Gi
78+
std_unitaries['C1'] = _np.array([[1, -1j], [1, 1j]], complex) / _np.sqrt(2) # This is H Pdag
79+
std_unitaries['C2'] = _np.array([[1, 1], [1j, -1j]], complex) / _np.sqrt(2) # This is P H
80+
std_unitaries['C3'] = _np.array([[0, 1], [1, 0]], complex) # This is Gxpi (up to phase)
81+
std_unitaries['C4'] = _np.array([[-1, -1j], [1, -1j]], complex) / _np.sqrt(2) # This is H Pdag X
82+
std_unitaries['C5'] = _np.array([[1, 1], [-1j, 1j]], complex) / _np.sqrt(2) # This is Pdag H
83+
std_unitaries['C6'] = _np.array([[0, -1j], [1j, 0]], complex) # This is Gypi (up to phase)
84+
std_unitaries['C7'] = _np.array([[1j, 1], [-1j, 1]], complex) / _np.sqrt(2) # This is H P X
85+
std_unitaries['C8'] = _np.array([[1j, -1j], [1, 1]], complex) / _np.sqrt(2) # This is Pdag X H
86+
std_unitaries['C9'] = _np.array([[1, 0], [0, -1]], complex) # This is Gzpi
87+
std_unitaries['C10'] = _np.array([[1, 1j], [1, -1j]], complex) / _np.sqrt(2) # This is H P
88+
std_unitaries['C11'] = _np.array([[1, -1], [1j, 1j]], complex) / _np.sqrt(2) # This is P X H
89+
std_unitaries['C12'] = _np.array([[1, 1], [1, -1]], complex) / _np.sqrt(2) # This is Gh
90+
std_unitaries['C13'] = _np.array([[0.5 - 0.5j, 0.5 + 0.5j], [0.5 + 0.5j, 0.5 - 0.5j]], complex) # This is Gxmpi2 (up to phase)
91+
std_unitaries['C14'] = _np.array([[1, 0], [0, 1j]], complex) # This is Gzpi2 / Gp (up to phase)
92+
std_unitaries['C15'] = _np.array([[1, 1], [-1, 1]], complex) / _np.sqrt(2) # This is Gympi2 (up to phase)
93+
std_unitaries['C16'] = _np.array([[0.5 + 0.5j, 0.5 - 0.5j], [0.5 - 0.5j, 0.5 + 0.5j]], complex) # This is Gxpi2 (up to phase)
94+
std_unitaries['C17'] = _np.array([[0, 1], [1j, 0]], complex) # This is P X
95+
std_unitaries['C18'] = _np.array([[1j, -1j], [-1j, -1j]], complex) / _np.sqrt(2) # This is Y H
96+
std_unitaries['C19'] = _np.array([[0.5 + 0.5j, -0.5 + 0.5j], [0.5 - 0.5j, -0.5 - 0.5j]], complex) # This is Pdag H P
97+
std_unitaries['C20'] = _np.array([[0, -1j], [-1, 0]], complex) # This is Pdag X
98+
std_unitaries['C21'] = _np.array([[1, -1], [1, 1]], complex) / _np.sqrt(2) # This is Gypi2 (up to phase)
99+
std_unitaries['C22'] = _np.array([[0.5 + 0.5j, 0.5 - 0.5j], [-0.5 + 0.5j, -0.5 - 0.5j]], complex) # This is P H Pdag
100+
std_unitaries['C23'] = _np.array([[1, 0], [0, -1j]], complex) # This is Gzmpi2 / Gpdag (up to phase)
103101
# Standard 2-qubit gates.
104102
std_unitaries['CPHASE'] = _np.array([[1., 0., 0., 0.], [0., 1., 0., 0.], [
105103
0., 0., 1., 0.], [0., 0., 0., -1.]], complex)
@@ -256,34 +254,31 @@ def u_op(exp):
256254
#native gate in some spin qubit systems.
257255
std_unitaries['Gn'] = _spl.expm(-1j*(_np.pi/4)*((_np.sqrt(3)/2)*sigmax - (.5)*sigmaz))
258256

259-
# The 1-qubit Clifford group. The labelling is the same as in the the 1-qubit Clifford group generated
260-
# in pygsti.extras.rb.group, and also in the internal standard unitary (but with 'Gci' -> 'Ci')
261-
std_unitaries['Gc0'] = _np.array([[1, 0], [0, 1]], complex) # This is Gi
262-
std_unitaries['Gc1'] = _np.array([[1, -1j], [1, 1j]], complex) / _np.sqrt(2)
263-
std_unitaries['Gc2'] = _np.array([[1, 1], [1j, -1j]], complex) / _np.sqrt(2)
264-
std_unitaries['Gc3'] = _np.array([[0, 1], [1, 0]], complex) # This is Gxpi (up to phase)
265-
std_unitaries['Gc4'] = _np.array([[-1, -1j], [1, -1j]], complex) / _np.sqrt(2)
266-
std_unitaries['Gc5'] = _np.array([[1, 1], [-1j, 1j]], complex) / _np.sqrt(2)
267-
std_unitaries['Gc6'] = _np.array([[0, -1j], [1j, 0]], complex) # This is Gypi (up to phase)
268-
std_unitaries['Gc7'] = _np.array([[1j, 1], [-1j, 1]], complex) / _np.sqrt(2)
269-
std_unitaries['Gc8'] = _np.array([[1j, -1j], [1, 1]], complex) / _np.sqrt(2)
270-
std_unitaries['Gc9'] = _np.array([[1, 0], [0, -1]], complex) # This is Gzpi
271-
std_unitaries['Gc10'] = _np.array([[1, 1j], [1, -1j]], complex) / _np.sqrt(2)
272-
std_unitaries['Gc11'] = _np.array([[1, -1], [1j, 1j]], complex) / _np.sqrt(2)
273-
std_unitaries['Gc12'] = _np.array([[1, 1], [1, -1]], complex) / _np.sqrt(2) # This is Gh
274-
std_unitaries['Gc13'] = _np.array([[0.5 - 0.5j, 0.5 + 0.5j], [0.5 + 0.5j, 0.5 - 0.5j]],
275-
complex) # This is Gxmpi2 (up to phase)
276-
std_unitaries['Gc14'] = _np.array([[1, 0], [0, 1j]], complex) # THis is Gzpi2 / Gp (up to phase)
277-
std_unitaries['Gc15'] = _np.array([[1, 1], [-1, 1]], complex) / _np.sqrt(2) # This is Gympi2 (up to phase)
278-
std_unitaries['Gc16'] = _np.array([[0.5 + 0.5j, 0.5 - 0.5j], [0.5 - 0.5j, 0.5 + 0.5j]],
279-
complex) # This is Gxpi2 (up to phase)
280-
std_unitaries['Gc17'] = _np.array([[0, 1], [1j, 0]], complex)
281-
std_unitaries['Gc18'] = _np.array([[1j, -1j], [-1j, -1j]], complex) / _np.sqrt(2)
282-
std_unitaries['Gc19'] = _np.array([[0.5 + 0.5j, -0.5 + 0.5j], [0.5 - 0.5j, -0.5 - 0.5j]], complex)
283-
std_unitaries['Gc20'] = _np.array([[0, -1j], [-1, 0]], complex)
284-
std_unitaries['Gc21'] = _np.array([[1, -1], [1, 1]], complex) / _np.sqrt(2) # This is Gypi2 (up to phase)
285-
std_unitaries['Gc22'] = _np.array([[0.5 + 0.5j, 0.5 - 0.5j], [-0.5 + 0.5j, -0.5 - 0.5j]], complex)
286-
std_unitaries['Gc23'] = _np.array([[1, 0], [0, -1j]], complex) # This is Gzmpi2 / Gpdag (up to phase)
257+
# The 1-qubit Clifford group.
258+
std_unitaries['Gc0'] = _np.array([[1, 0], [0, 1]], complex) # This is Gi
259+
std_unitaries['Gc1'] = _np.array([[1, -1j], [1, 1j]], complex) / _np.sqrt(2) # This is H Pdag
260+
std_unitaries['Gc2'] = _np.array([[1, 1], [1j, -1j]], complex) / _np.sqrt(2) # This is P H
261+
std_unitaries['Gc3'] = _np.array([[0, 1], [1, 0]], complex) # This is Gxpi (up to phase)
262+
std_unitaries['Gc4'] = _np.array([[-1, -1j], [1, -1j]], complex) / _np.sqrt(2) # This is H Pdag X
263+
std_unitaries['Gc5'] = _np.array([[1, 1], [-1j, 1j]], complex) / _np.sqrt(2) # This is Pdag H
264+
std_unitaries['Gc6'] = _np.array([[0, -1j], [1j, 0]], complex) # This is Gypi (up to phase)
265+
std_unitaries['Gc7'] = _np.array([[1j, 1], [-1j, 1]], complex) / _np.sqrt(2) # This is H P X
266+
std_unitaries['Gc8'] = _np.array([[1j, -1j], [1, 1]], complex) / _np.sqrt(2) # This is Pdag X H
267+
std_unitaries['Gc9'] = _np.array([[1, 0], [0, -1]], complex) # This is Gzpi
268+
std_unitaries['Gc10'] = _np.array([[1, 1j], [1, -1j]], complex) / _np.sqrt(2) # This is H P
269+
std_unitaries['Gc11'] = _np.array([[1, -1], [1j, 1j]], complex) / _np.sqrt(2) # This is P X H
270+
std_unitaries['Gc12'] = _np.array([[1, 1], [1, -1]], complex) / _np.sqrt(2) # This is Gh
271+
std_unitaries['Gc13'] = _np.array([[0.5 - 0.5j, 0.5 + 0.5j], [0.5 + 0.5j, 0.5 - 0.5j]], complex) # This is Gxmpi2 (up to phase)
272+
std_unitaries['Gc14'] = _np.array([[1, 0], [0, 1j]], complex) # This is Gzpi2 / Gp (up to phase)
273+
std_unitaries['Gc15'] = _np.array([[1, 1], [-1, 1]], complex) / _np.sqrt(2) # This is Gympi2 (up to phase)
274+
std_unitaries['Gc16'] = _np.array([[0.5 + 0.5j, 0.5 - 0.5j], [0.5 - 0.5j, 0.5 + 0.5j]], complex) # This is Gxpi2 (up to phase)
275+
std_unitaries['Gc17'] = _np.array([[0, 1], [1j, 0]], complex) # This is P X
276+
std_unitaries['Gc18'] = _np.array([[1j, -1j], [-1j, -1j]], complex) / _np.sqrt(2) # This is Y H
277+
std_unitaries['Gc19'] = _np.array([[0.5 + 0.5j, -0.5 + 0.5j], [0.5 - 0.5j, -0.5 - 0.5j]], complex) # This is Pdag H P
278+
std_unitaries['Gc20'] = _np.array([[0, -1j], [-1, 0]], complex) # This is Pdag X
279+
std_unitaries['Gc21'] = _np.array([[1, -1], [1, 1]], complex) / _np.sqrt(2) # This is Gypi2 (up to phase)
280+
std_unitaries['Gc22'] = _np.array([[0.5 + 0.5j, 0.5 - 0.5j], [-0.5 + 0.5j, -0.5 - 0.5j]], complex) # This is P H Pdag
281+
std_unitaries['Gc23'] = _np.array([[1, 0], [0, -1j]], complex) # This is Gzmpi2 / Gpdag (up to phase)
287282

288283
# Two-qubit gates
289284
std_unitaries['Gcphase'] = _np.array([[1., 0., 0., 0.], [0., 1., 0., 0.], [

0 commit comments

Comments
 (0)