From da4588dc10f7ba79d667cd8162dab17fd9f669e0 Mon Sep 17 00:00:00 2001 From: robotAstray Date: Wed, 30 Aug 2023 10:02:16 +0100 Subject: [PATCH 1/5] substitute `alltrue` with `all` in `test_fermion_circuit_solver.py` --- test/test_fermion_circuit_solver.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/test_fermion_circuit_solver.py b/test/test_fermion_circuit_solver.py index d906ffb..5554d6a 100644 --- a/test/test_fermion_circuit_solver.py +++ b/test/test_fermion_circuit_solver.py @@ -63,7 +63,7 @@ def test_get_initial_state(self): self.solver2.preprocess_circuit(circ) init_state = self.solver2.get_initial_state(circ) target = np.array([0, 0, 1, 0]) - self.assertTrue(np.alltrue(init_state.toarray().T == target)) + self.assertTrue(np.all(init_state.toarray().T == target)) def test_embed_operator(self): """test embedding of an operator""" @@ -149,7 +149,7 @@ def test_operator_to_mat(self): ] ) test_op = self.solver2.operator_to_mat(Hop(num_modes=4, j=[0.5]).generator) - self.assertTrue(np.alltrue(test_op.toarray() == target)) + self.assertTrue(np.all(test_op.toarray() == target)) def test_draw_shots(self): """test drawing of the shots from a measurement distribution""" @@ -171,7 +171,6 @@ def test_draw_shots(self): self.solver2.draw_shots(np.ones(3) / 3) with self.subTest("formatting of measurement outcomes"): - self.solver2.seed = 40 outcomes = self.solver2.draw_shots(np.ones(4) / 4) self.assertEqual(outcomes, ["0110", "0101", "1010", "0110", "0110"]) From 0829f5f32eb7481af6a2765fb2bcf0d637fe214e Mon Sep 17 00:00:00 2001 From: robotAstray Date: Wed, 30 Aug 2023 10:03:56 +0100 Subject: [PATCH 2/5] substitute `alltrue` with `all` in `test_spin_circuit_solver.py` --- test/test_spin_circuit_solver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_spin_circuit_solver.py b/test/test_spin_circuit_solver.py index 5ef4838..cfe0ac0 100644 --- a/test/test_spin_circuit_solver.py +++ b/test/test_spin_circuit_solver.py @@ -39,7 +39,7 @@ def test_get_initial_state(self): circ = QuantumCircuit(1) init_state = self.solver.get_initial_state(circ) target = np.array([1, 0, 0, 0]) - self.assertTrue(np.alltrue(init_state.toarray().T == target)) + self.assertTrue(np.all(init_state.toarray().T == target)) def test_embed_operator(self): """test embedding of an operator""" From cb25af34c78769936f96e7de913bea9152552288 Mon Sep 17 00:00:00 2001 From: robotAstray Date: Wed, 30 Aug 2023 19:30:32 +0100 Subject: [PATCH 3/5] unpin `numpy` version in requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3516b0d..ede5f94 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -numpy>=1.17 +numpy scipy>=1.4 requests>=2.25.1 qiskit-terra>= 0.17.1 From 2ca271fa1a6496ecccc1879f40ca4e8b483756b2 Mon Sep 17 00:00:00 2001 From: robotAstray Date: Wed, 30 Aug 2023 19:32:52 +0100 Subject: [PATCH 4/5] add release notes for PR #76 --- .../notes/replace-numpy-alltrue-a6fbe0478678c9b7.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 releasenotes/notes/replace-numpy-alltrue-a6fbe0478678c9b7.yaml diff --git a/releasenotes/notes/replace-numpy-alltrue-a6fbe0478678c9b7.yaml b/releasenotes/notes/replace-numpy-alltrue-a6fbe0478678c9b7.yaml new file mode 100644 index 0000000..97b2053 --- /dev/null +++ b/releasenotes/notes/replace-numpy-alltrue-a6fbe0478678c9b7.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Replaced usage of `numpy.alltrue` with `numpy.all` throughout the codebase, + to be specific in: `test/test_fermion_circuit_solver.py`, `test/test_spin_circuit_solver.py` From a0302e8b7d7229708e4e8c30b66dabc8d4d0068d Mon Sep 17 00:00:00 2001 From: robotAstray Date: Wed, 30 Aug 2023 19:44:52 +0100 Subject: [PATCH 5/5] revert to `numpy>=1.17` in requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ede5f94..3516b0d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -numpy +numpy>=1.17 scipy>=1.4 requests>=2.25.1 qiskit-terra>= 0.17.1