1
- using Graphs
2
- using LinearAlgebra
3
-
4
1
"""
5
2
Return the full stabilizer group represented by the input generating set (a [`Stabilizer`](@ref)).
6
3
@@ -15,8 +12,8 @@ julia> groupify(S"XZ ZX")
15
12
```
16
13
"""
17
14
function groupify (s:: Stabilizer )
18
- # Create a `Tableau` of 2ⁿ n-qubit identity Pauli operators(where n is the size of
19
- # `Stabilizer` s), then multiply each one by a different subset of the elements in s to
15
+ # Create a `Tableau` of 2ⁿ n-qubit identity Pauli operators(where n is the size of
16
+ # `Stabilizer` s), then multiply each one by a different subset of the elements in s to
20
17
# create all 2ⁿ unique elements in the group generated by s, then return the `Tableau`.
21
18
n = length (s):: Int
22
19
group = zero (Tableau, 2 ^ n, nqubits (s))
@@ -27,7 +24,7 @@ function groupify(s::Stabilizer)
27
24
end
28
25
end
29
26
end
30
- return group
27
+ return group
31
28
end
32
29
33
30
@@ -44,8 +41,8 @@ julia> minimal_generating_set(S"__ XZ ZX YY")
44
41
```
45
42
"""
46
43
function minimal_generating_set (s:: Stabilizer )
47
- # Canonicalize `Stabilizer` s, then return a `Stabilizer` with all non-identity Pauli operators
48
- # in the result. If s consists of only identity operators, return the negative
44
+ # Canonicalize `Stabilizer` s, then return a `Stabilizer` with all non-identity Pauli operators
45
+ # in the result. If s consists of only identity operators, return the negative
49
46
# identity operator if one is contained in s, and the positive identity operator otherwise.
50
47
s, _, r = canonicalize! (copy (s), ranks= true )
51
48
if r == 0
@@ -60,7 +57,7 @@ function minimal_generating_set(s::Stabilizer)
60
57
end
61
58
62
59
"""
63
- Return the full Pauli group of a given length. Phases are ignored by default,
60
+ Return the full Pauli group of a given length. Phases are ignored by default,
64
61
but can be included by setting `phases=true`.
65
62
66
63
```jldoctest
@@ -131,8 +128,8 @@ julia> normalizer(T"X")
131
128
```
132
129
"""
133
130
function normalizer (t:: Tableau )
134
- # For each `PauliOperator` p in the with same number of qubits as the `Stabilizer` s, iterate through s and check each
135
- # operator's commutivity with p. If they all commute, add p a vector of `PauliOperators`. Return the vector
131
+ # For each `PauliOperator` p in the with same number of qubits as the `Stabilizer` s, iterate through s and check each
132
+ # operator's commutivity with p. If they all commute, add p a vector of `PauliOperators`. Return the vector
136
133
# converted to `Tableau`.
137
134
n = nqubits (t)
138
135
pgroup = pauligroup (n, phases= false )
@@ -161,7 +158,7 @@ julia> centralizer(T"XX ZZ _Z")
161
158
+ ZZ
162
159
```
163
160
"""
164
- function centralizer (t:: Tableau )
161
+ function centralizer (t:: Tableau )
165
162
center = typeof (t[1 ])[]
166
163
for P in t
167
164
commutes = 0
@@ -175,15 +172,15 @@ function centralizer(t::Tableau)
175
172
push! (center, P)
176
173
end
177
174
end
178
- if length (center) == 0
175
+ if length (center) == 0
179
176
return Tableau (zeros (Bool, 1 ,1 ))
180
177
end
181
178
c = Tableau (center)
182
179
return c
183
180
end
184
181
185
182
"""
186
- Return the subset of Paulis in a Stabilizer that have identity operators on all qubits corresponding to
183
+ Return the subset of Paulis in a Stabilizer that have identity operators on all qubits corresponding to
187
184
the given subset, without the entries corresponding to subset.
188
185
189
186
```jldoctest
@@ -196,9 +193,9 @@ function contractor(s::Stabilizer, subset)
196
193
for p in s
197
194
contractable = true
198
195
for i in subset
199
- if p[i] != (false , false )
200
- contractable = false
201
- break
196
+ if p[i] != (false , false )
197
+ contractable = false
198
+ break
202
199
end
203
200
end
204
201
if contractable push! (result, p[setdiff (1 : length (p), subset)]) end
@@ -208,4 +205,4 @@ function contractor(s::Stabilizer, subset)
208
205
else
209
206
return Tableau (zeros (Bool, 1 ,1 ))
210
207
end
211
- end
208
+ end
0 commit comments