diff --git a/pyproject.toml b/pyproject.toml index 509d80f..3ac71e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" name = "quantum-evolution-kernel" description = "A Python library designed for the machine learning community to help users design quantum-driven similarity metrics for graphs and to use them inside kernel-based machine learning algorithms for graph data.ide the right environment to explore new ideas - both in terms of methodologies and data domain - while always interacting with a simple and intuitive QPU interface." readme = "README.md" -version = "0.3.2" +version = "0.3.3" requires-python = ">=3.10,<3.13" license = { text = "MIT-derived" } keywords = ["quantum"] @@ -31,13 +31,13 @@ classifiers = [ dependencies = [ "networkx", "numpy", - "pulser==1.1.1", + "pulser==1.5.3", "rdkit", "scikit-learn", "torch", "torch_geometric", "matplotlib", - "emu-mps~=1.2.0", + "emu-mps~=2.2.0", "pasqal-cloud", ] diff --git a/qek/data/extractors.py b/qek/data/extractors.py index 1fc1221..9a617d1 100644 --- a/qek/data/extractors.py +++ b/qek/data/extractors.py @@ -9,7 +9,6 @@ import itertools import json import logging -from math import ceil from uuid import UUID import time from typing import Any, Callable, Generator, Generic, Sequence, TypeVar, cast @@ -498,7 +497,6 @@ def run(self, max_qubits: int = 10, dt: int = 10) -> BaseExtracted: logger.warning("No sequences to run, did you forget to call compile()?") return SyncExtracted(raw_data=[], targets=[], sequences=[], states=[]) - backend = emu_mps.MPSBackend() raw_data = [] targets: list[int] = [] sequences = [] @@ -516,12 +514,12 @@ def run(self, max_qubits: int = 10, dt: int = 10) -> BaseExtracted: logger.debug("Executing compiled graph # %s", id) # Configure observable. - cutoff_duration = int(ceil(compiled.sequence.get_duration() / dt) * dt) - observable = emu_mps.BitStrings(evaluation_times={cutoff_duration}) + observable = emu_mps.BitStrings(evaluation_times=[1.0]) config = emu_mps.MPSConfig(observables=[observable], dt=dt) - counter: dict[str, Any] = backend.run(compiled.sequence, config)[observable.name][ - cutoff_duration - ] + + # And run. + backend = emu_mps.MPSBackend(sequence=compiled.sequence, config=config) + counter: dict[str, Any] = backend.run().get_result(observable=observable, time=1.0) logger.debug("Execution of compiled graph # %s complete", id) raw_data.append(compiled.graph) if compiled.graph.target is not None: diff --git a/qek/target/backends.py b/qek/target/backends.py index 560d78f..b8889cf 100644 --- a/qek/target/backends.py +++ b/qek/target/backends.py @@ -4,7 +4,6 @@ import abc import asyncio -from math import ceil from typing import Counter, cast import os @@ -244,11 +243,10 @@ async def run( self, register: targets.Register, pulse: targets.Pulse, dt: int = 10 ) -> Counter[str]: sequence = self._make_sequence(register=register, pulse=pulse) - backend = emu_mps.MPSBackend() # Configure observable. - cutoff_duration = int(ceil(sequence.get_duration() / dt) * dt) - observable = emu_mps.BitStrings(evaluation_times={cutoff_duration}) + observable = emu_mps.BitStrings(evaluation_times=[1.0]) config = emu_mps.MPSConfig(observables=[observable], dt=dt) - counter: Counter[str] = backend.run(sequence, config)[observable.name][cutoff_duration] + backend = emu_mps.MPSBackend(sequence=sequence, config=config) + counter: Counter[str] = backend.run().get_result(observable=observable, time=1.0) return counter