Skip to content

Commit 73ccb34

Browse files
committed
remove unnecessary imports
1 parent 6a8dbb4 commit 73ccb34

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

src/grouptableaux.jl

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using Graphs
2-
using LinearAlgebra
3-
41
"""
52
Return the full stabilizer group represented by the input generating set (a [`Stabilizer`](@ref)).
63
@@ -15,8 +12,8 @@ julia> groupify(S"XZ ZX")
1512
```
1613
"""
1714
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
2017
# create all 2ⁿ unique elements in the group generated by s, then return the `Tableau`.
2118
n = length(s)::Int
2219
group = zero(Tableau, 2^n, nqubits(s))
@@ -27,7 +24,7 @@ function groupify(s::Stabilizer)
2724
end
2825
end
2926
end
30-
return group
27+
return group
3128
end
3229

3330

@@ -44,8 +41,8 @@ julia> minimal_generating_set(S"__ XZ ZX YY")
4441
```
4542
"""
4643
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
4946
# identity operator if one is contained in s, and the positive identity operator otherwise.
5047
s, _, r = canonicalize!(copy(s), ranks=true)
5148
if r == 0
@@ -60,7 +57,7 @@ function minimal_generating_set(s::Stabilizer)
6057
end
6158

6259
"""
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,
6461
but can be included by setting `phases=true`.
6562
6663
```jldoctest
@@ -131,8 +128,8 @@ julia> normalizer(T"X")
131128
```
132129
"""
133130
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
136133
# converted to `Tableau`.
137134
n = nqubits(t)
138135
pgroup = pauligroup(n, phases=false)
@@ -161,7 +158,7 @@ julia> centralizer(T"XX ZZ _Z")
161158
+ ZZ
162159
```
163160
"""
164-
function centralizer(t::Tableau)
161+
function centralizer(t::Tableau)
165162
center = typeof(t[1])[]
166163
for P in t
167164
commutes = 0
@@ -175,15 +172,15 @@ function centralizer(t::Tableau)
175172
push!(center, P)
176173
end
177174
end
178-
if length(center) == 0
175+
if length(center) == 0
179176
return Tableau(zeros(Bool, 1,1))
180177
end
181178
c = Tableau(center)
182179
return c
183180
end
184181

185182
"""
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
187184
the given subset, without the entries corresponding to subset.
188185
189186
```jldoctest
@@ -196,9 +193,9 @@ function contractor(s::Stabilizer, subset)
196193
for p in s
197194
contractable = true
198195
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
202199
end
203200
end
204201
if contractable push!(result, p[setdiff(1:length(p), subset)]) end
@@ -208,4 +205,4 @@ function contractor(s::Stabilizer, subset)
208205
else
209206
return Tableau(zeros(Bool, 1,1))
210207
end
211-
end
208+
end

test/test_group_tableaux.jl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
@testitem "Classical" begin
1+
@testitem "group theory routines" begin
22
using Test
3-
43
using Random
54
using QuantumClifford
65

76
# Including sizes that would test off-by-one errors in the bit encoding.
8-
test_sizes = [1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17]
7+
test_sizes = [1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17]
98
# Zero function(in groupify) slows down around 2^30(n=30),eventually breaks
109
small_test_sizes = [1, 2, 3, 4, 5, 7] # Pauligroup slows around n = 8
1110

@@ -45,7 +44,7 @@
4544
end
4645
end
4746
#Test pauligroup
48-
for n in [1, small_test_sizes...]
47+
for n in [1, small_test_sizes...]
4948
@test length(QuantumClifford.pauligroup(n, phases=false)) == 4^n
5049
@test length(QuantumClifford.pauligroup(n, phases=true)) == 4^(n+1)
5150
end
@@ -98,7 +97,7 @@
9897
end
9998
c = contractor(s, subset)
10099
count = 0
101-
for stabilizer in s
100+
for stabilizer in s
102101
contractable = true
103102
for i in subset
104103
if stabilizer[i] != (false, false) contractable = false end
@@ -111,9 +110,9 @@
111110
p = zero(PauliOperator, nqubits(s))
112111
index = 0
113112
for i in 1:nqubits(s)
114-
if !(i in subset)
115-
index+=1
116-
p[i] = contracted[index]
113+
if !(i in subset)
114+
index+=1
115+
p[i] = contracted[index]
117116
end
118117
end
119118
@test p in s || -1* p in s || 1im * p in s || -1im * p in s
@@ -123,4 +122,4 @@
123122
end
124123
end
125124
end
126-
end
125+
end

0 commit comments

Comments
 (0)