Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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",
]

Expand Down
12 changes: 5 additions & 7 deletions qek/data/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = []
Expand All @@ -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:
Expand Down
8 changes: 3 additions & 5 deletions qek/target/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import abc
import asyncio
from math import ceil
from typing import Counter, cast

import os
Expand Down Expand Up @@ -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
Loading