@@ -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