Skip to content

Commit 7fe767d

Browse files
authored
Merge pull request #188 from UCL-CCS/update_qiskit
Update qiskit
2 parents ffc1d79 + d1d2d32 commit 7fe767d

File tree

6 files changed

+1243
-1226
lines changed

6 files changed

+1243
-1226
lines changed

poetry.lock

Lines changed: 1227 additions & 1212 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ license = "MIT"
88
[tool.poetry.dependencies]
99
python = "^3.8"
1010
openfermion = "^1.6.1"
11+
qiskit = "^1.2.4"
1112
cached-property = "^1.5.2"
12-
qiskit = "0.46"
1313
pydocstyle = "^6.1.1"
1414
isort = "^5.10.1"
1515
black = "^24.3.0"

symmer/evolution/variational_optimization.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from cached_property import cached_property
22
from qiskit.quantum_info import Statevector
3+
# from qiskit.opflow import CircuitStateFn # old qiskit function replaced by Statevector
34
from qiskit import QuantumCircuit
45
from symmer import process, QuantumState, PauliwordOp
56
from symmer.operators.utils import (
@@ -83,7 +84,7 @@ def get_state(self,
8384
if self.expectation_eval == 'observable_rotation':
8485
return list(zip(evolution_obj, -2*x))
8586
else:
86-
state = Statevector(evolution_obj.bind_parameters(x))
87+
state = Statevector(evolution_obj.bind_parameters(x)).data
8788
if self.expectation_eval == 'dense_array':
8889
return state.to_matrix().reshape([-1,1])
8990
elif self.expectation_eval == 'sparse_array':

symmer/operators/noncontextual_op.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def draw_graph_structure(self,
414414
weights = [G[u][v]['weight'] for u,v in edges]
415415
nx.draw(G, pos, edge_color=colors, width=weights,
416416
node_color=node_colour, node_size=node_size, ax=axis)
417-
417+
418418
def noncontextual_generators(self) -> None:
419419
"""
420420
Find an independent generating set for the noncontextual operator.

symmer/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from scipy.sparse import csr_matrix
88
from scipy.sparse import kron as sparse_kron
99
from symmer.operators.utils import _rref_binary
10-
import ray
10+
# import ray
11+
from ray import remote, get
1112
import os
1213
# from psutil import cpu_count
1314

@@ -286,20 +287,20 @@ def get_sparse_matrix_large_pauliwordop(P_op: PauliwordOp) -> csr_matrix:
286287
n_chunks = os.cpu_count()
287288
if (n_chunks<=1) or (P_op.n_terms<=1):
288289
# no multiprocessing possible
289-
mat = ray.get(_get_sparse_matrix_large_pauliwordop.remote(P_op))
290+
mat = get(_get_sparse_matrix_large_pauliwordop.remote(P_op))
290291
else:
291292
# plus one below due to indexing (actual number of chunks ignores this value)
292293
n_chunks += 1
293294
P_op_chunks_inds = np.rint(np.linspace(0, P_op.n_terms, min(n_chunks, P_op.n_terms+1))).astype(set).astype(int)
294295
P_op_chunks = [P_op[P_op_chunks_inds[ind_i]: P_op_chunks_inds[ind_i + 1]] for ind_i, _ in
295296
enumerate(P_op_chunks_inds[1:])]
296-
tracker = np.array(ray.get(
297+
tracker = np.array(get(
297298
[_get_sparse_matrix_large_pauliwordop.remote(op) for op in P_op_chunks]))
298299
mat = reduce(lambda x, y: x + y, tracker)
299300

300301
return mat
301302

302-
@ray.remote(num_cpus=os.cpu_count(),
303+
@remote(num_cpus=os.cpu_count(),
303304
runtime_env={
304305
"env_vars": {
305306
"NUMBA_NUM_THREADS": os.getenv("NUMBA_NUM_THREADS"),

tests/test_approximate/test_approximate_tensor_network.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ def test_from_dictionary(
6666
# Testing QUIMB dmrg sovler #
6767
############################################
6868

69-
def test_find_groundsate_quimb(
70-
pauli_list_1,
71-
coeff_vec_1
72-
):
73-
MPO = MPOOp(pauli_list_1, coeff_vec_1)
69+
# def test_find_groundsate_quimb(
70+
# pauli_list_1,
71+
# coeff_vec_1
72+
# ):
73+
# MPO = MPOOp(pauli_list_1, coeff_vec_1)
7474

75-
mpostate = find_groundstate_quimb(MPO)
75+
# mpostate = find_groundstate_quimb(MPO)
7676

77-
assert(type(mpostate) == QuantumState)
77+
# assert(type(mpostate) == QuantumState)

0 commit comments

Comments
 (0)