Skip to content

Commit 3a82ff7

Browse files
tbabejmarkf94
authored andcommitted
style: Minor PEP8 fixes
1 parent 8e424a5 commit 3a82ff7

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

docs/ising_qaoa.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ we set the following biases on \\( \\sigma_{0} \\) and \\( \\sigma_{1}\\):
227227
228228
qvm_connection = api.QVMConnection()
229229
230-
J = {(0,1,2): -3}
230+
J = {(0, 1, 2): -3}
231231
h = {0: 1, 1: -1}
232232
233233
We can now run the algorithm ten times with step size 2 to collect statistics (this might take a couple of minutes):

grove/tests/ising/test_ising.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def test_energy_value():
1313

1414
assert(np.isclose(ener_ising, -9.9))
1515

16-
J = {(0, 1, 2): 1.2, (0, 1, 2, 3): 2.5 , (0, 2, 3): 0.5, (1, 3): 3.1}
17-
h = {0: -2.4, 1: 5.2 , 3: -0.3}
16+
J = {(0, 1, 2): 1.2, (0, 1, 2, 3): 2.5, (0, 2, 3): 0.5, (1, 3): 3.1}
17+
h = {0: -2.4, 1: 5.2, 3: -0.3}
1818
sol = [1, -1, -1, 1]
1919
ener_ising = energy_value(h, J, sol)
2020

@@ -42,7 +42,7 @@ def test_ising_mock():
4242
with patch("pyquil.api.QVMConnection") as cxn:
4343
# Mock the response
4444
cxn.run_and_measure.return_value = [[1, 0, 1, 0]]
45-
cxn.expectation.return_value = [0, 0, 0, 0] # dummy
45+
cxn.expectation.return_value = [0, 0, 0, 0] # dummy
4646

4747
# checkerboard with couplings
4848
J = {(0, 1): 1, (0, 2): 1, (1, 3): 1, (2, 3): 1}
@@ -56,7 +56,7 @@ def test_ising_mock():
5656
with patch("pyquil.api.QVMConnection") as cxn:
5757
# Mock the response
5858
cxn.run_and_measure.return_value = [[1, 0, 1, 0]]
59-
cxn.expectation.return_value = [0, 0, 0, 0] # dummy
59+
cxn.expectation.return_value = [0, 0, 0, 0] # dummy
6060

6161
# checkerboard with biases
6262
J = {}
@@ -70,7 +70,7 @@ def test_ising_mock():
7070
with patch("pyquil.api.QVMConnection") as cxn:
7171
# Mock the response
7272
cxn.run_and_measure.return_value = [[1, 0, 1, 0, 1]]
73-
cxn.expectation.return_value = [0, 0, 0, 0, 0] # dummy
73+
cxn.expectation.return_value = [0, 0, 0, 0, 0] # dummy
7474

7575
J = {(0, 4): -1}
7676
h = {0: 1, 1: -1, 2: 1, 3: -1}
@@ -83,10 +83,10 @@ def test_ising_mock():
8383
with patch("pyquil.api.QVMConnection") as cxn:
8484
# Mock the response
8585
cxn.run_and_measure.return_value = [[0, 1, 1, 0]]
86-
cxn.expectation.return_value = [0, 0, 0, 0, 0, 0, 0] # dummy
86+
cxn.expectation.return_value = [0, 0, 0, 0, 0, 0, 0] # dummy
8787

88-
J = {(0, 1, 2): 1.2, (0, 1, 2, 3): 2.5 , (0, 2, 3): 0.5, (1, 3): 3.1}
89-
h = {0: -2.4, 1: 5.2 , 3: -0.3}
88+
J = {(0, 1, 2): 1.2, (0, 1, 2, 3): 2.5, (0, 2, 3): 0.5, (1, 3): 3.1}
89+
h = {0: -2.4, 1: 5.2, 3: -0.3}
9090
p = 1
9191
most_freq_string_ising, energy_ising, circuit = ising_qaoa(h, J, num_steps=p, vqe_option=None, connection=cxn)
9292

@@ -96,7 +96,7 @@ def test_ising_mock():
9696
with patch("pyquil.api.QVMConnection") as cxn:
9797
# Mock the response
9898
cxn.run_and_measure.return_value = [[0, 1, 1, 0]]
99-
cxn.expectation.return_value = [0, 0, 0, 0, 0, 0, 0] # dummy
99+
cxn.expectation.return_value = [0, 0, 0, 0, 0, 0, 0] # dummy
100100

101101
swap_mixer = []
102102
for i in range(4):
@@ -105,8 +105,8 @@ def test_ising_mock():
105105
swap_mixer.append(PauliSum([PauliTerm("X", i, 0.5) * PauliTerm("X", j, 1.0)]))
106106
swap_mixer.append(PauliSum([PauliTerm("Y", i, 0.5) * PauliTerm("Y", j, 1.0)]))
107107

108-
J = {(0, 1, 2): 1.2, (0, 1, 2, 3): 2.5 , (0, 2, 3): 0.5, (1, 3): 3.1}
109-
h = {0: -2.4, 1: 5.2 , 3: -0.3}
108+
J = {(0, 1, 2): 1.2, (0, 1, 2, 3): 2.5, (0, 2, 3): 0.5, (1, 3): 3.1}
109+
h = {0: -2.4, 1: 5.2, 3: -0.3}
110110
p = 1
111111
most_freq_string_ising, energy_ising, circuit = ising_qaoa(h, J, driver_operators=swap_mixer, num_steps=p, vqe_option=None, connection=cxn)
112112

0 commit comments

Comments
 (0)