-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #33 Adding a more broad analog backend for prototyping, testing and fully using `pulser` functionalities. Additionally, it includes an abstract base analog backend (`_base_analog`) to be used for `pulser`-based backends (in current case, `fresnel1` and `analog`). It also addresses the points to make the code prototypes on `qadence2-core` tests to be successfully executed. --------- Signed-off-by: Doomsk <[email protected]>
- Loading branch information
Showing
31 changed files
with
1,404 additions
and
627 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,32 +6,30 @@ build-backend = "hatchling.build" | |
name = "qadence2-platforms" | ||
description = "Platform-dependent engines and model to execute compiled expressions with common set of methods." | ||
readme = "README.md" | ||
version = "0.1.2" | ||
requires-python = ">=3.10" | ||
version = "0.2.0" | ||
requires-python = ">=3.10,<3.12" | ||
license = {text = "Proprietary"} | ||
keywords = ["quantum"] | ||
authors = [ | ||
{ name = "Eduardo Maschio", email = "[email protected]" }, | ||
{ name = "Kaonan Micadei", email = "[email protected]" }, | ||
{ name = "Dominik Seitz", email = "[email protected]" }, | ||
{ name = "Pim Venderbosch", email= "[email protected]" }, | ||
{ name = "Dominik Seitz", email = "[email protected]" } | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
] | ||
|
||
# always specify a version for each package | ||
# to maintain consistency | ||
dependencies = [ | ||
"qadence2-ir~=0.1", | ||
"pulser~=1.1", | ||
"pyqtorch~=1.4", | ||
"qadence2-ir>=0.2", | ||
"pulser>=1.1", | ||
"pyqtorch", | ||
] | ||
|
||
[tool.hatch.metadata] | ||
|
@@ -98,7 +96,7 @@ serve = "mkdocs serve --dev-addr localhost:8000" | |
test = "mkdocs build --clean --strict" | ||
|
||
[[tool.hatch.envs.test.matrix]] | ||
python = ["310", "311", "312"] | ||
python = ["310", "311"] | ||
|
||
[tool.hatch.build.targets.sdist] | ||
exclude = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
This backend is not intended to be used directly, but rather using as the abstract | ||
module when building Pulser-based backends. | ||
""" | ||
|
||
from __future__ import annotations |
66 changes: 66 additions & 0 deletions
66
qadence2_platforms/backends/_base_analog/device_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from __future__ import annotations | ||
|
||
from abc import ABC | ||
|
||
from pulser.devices import Device | ||
|
||
|
||
class DeviceSettings(ABC): | ||
""" | ||
Device settings to ease the building of sequence, register and interface logic | ||
name (str): the name of the device, ex: `Analog Device` | ||
name_short (str): a shorter name version, ex: `analog` | ||
device (pulser.devices.Device): the pulser device | ||
grid_scale_range (tuple[float, float]): a tuple of min and max values for the | ||
grid scale, ex: `(1.0, 1.0)` (should not scale), `(1.0, 10.0)` (up to | ||
10.0, included) | ||
available_grid_types (tuple[str]): a tuple of all the possible grid types | ||
for the device, ex: `("triangular",)`, `("linear", "square")` | ||
available_directives (tuple[str], optional): a tuple of available directives, | ||
ex: `("enable_digital_analog")` | ||
""" | ||
|
||
_name: str | ||
_name_short: str | ||
_device: Device | ||
_grid_scale_range: tuple[float, float] | ||
_available_grid_types: tuple[str, ...] | ||
_available_directives: tuple[str, ...] | tuple | None | ||
|
||
@property | ||
def name(self) -> str: | ||
return self._name | ||
|
||
@property | ||
def name_short(self) -> str: | ||
return self._name_short | ||
|
||
@property | ||
def device(self) -> Device: | ||
return self._device | ||
|
||
@property | ||
def grid_scale_range(self) -> tuple[float, float]: | ||
return self._grid_scale_range | ||
|
||
@property | ||
def available_grid_types(self) -> tuple[str, ...]: | ||
return self._available_grid_types | ||
|
||
@property | ||
def available_directives(self) -> tuple[str, ...] | tuple | None: | ||
return self._available_directives | ||
|
||
def scale_in_range(self, grid_scale: float) -> bool: | ||
""" | ||
Check whether the grid scale is within device's range. | ||
Args: | ||
grid_scale (float): the grid scale. For a normal grid, the scale is 1.0 | ||
Returns: | ||
A boolean to whether the grid scale is within device's range. | ||
""" | ||
|
||
return self._grid_scale_range[0] <= grid_scale <= self._grid_scale_range[1] |
Oops, something went wrong.