quantinuum-schemas 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: quantinuum-schemas
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shared data models for Quantinuum.
|
|
5
|
+
Author: Matthew Burke
|
|
6
|
+
Author-email: matthew.burke@quantinuum.com
|
|
7
|
+
Requires-Python: >=3.10,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Requires-Dist: pydantic (>=2.6.0,<3.0.0)
|
|
12
|
+
Requires-Dist: pytket (>=1.24.0,<2.0.0)
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# Quantinuum schemas
|
|
16
|
+
|
|
17
|
+
Shared data models for Quantinuum.
|
|
18
|
+
|
|
19
|
+
## Dependencies
|
|
20
|
+
|
|
21
|
+
We try to keep the dependencies minimal.
|
|
22
|
+
However we do need `pydantic` for validation and `pytket` for core (serialisable) models.
|
|
23
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "quantinuum-schemas"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Shared data models for Quantinuum."
|
|
5
|
+
authors = ["Matthew Burke <matthew.burke@quantinuum.com>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
|
|
8
|
+
[tool.poetry.dependencies]
|
|
9
|
+
python = "^3.10"
|
|
10
|
+
pytket = "^1.24.0"
|
|
11
|
+
pydantic = "^2.6.0"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
[tool.poetry.group.dev.dependencies]
|
|
15
|
+
black = "^24.1.1"
|
|
16
|
+
isort = "^5.13.2"
|
|
17
|
+
mypy = "^1.8.0"
|
|
18
|
+
pylint = "^3.0.3"
|
|
19
|
+
|
|
20
|
+
[build-system]
|
|
21
|
+
requires = ["poetry-core"]
|
|
22
|
+
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Preset pytket compilation passes for Qulacs."""
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
from pytket.circuit import OpType
|
|
6
|
+
from pytket.passes import (
|
|
7
|
+
DecomposeBoxes,
|
|
8
|
+
FlattenRegisters,
|
|
9
|
+
FullPeepholeOptimise,
|
|
10
|
+
SequencePass,
|
|
11
|
+
SynthesiseTket,
|
|
12
|
+
)
|
|
13
|
+
from pytket.passes.auto_rebase import auto_rebase_pass
|
|
14
|
+
|
|
15
|
+
_TWO_QUBIT_GATES = {OpType.CX, OpType.CZ, OpType.SWAP}
|
|
16
|
+
_ONE_QUBIT_GATES = {
|
|
17
|
+
OpType.X,
|
|
18
|
+
OpType.Y,
|
|
19
|
+
OpType.Z,
|
|
20
|
+
OpType.H,
|
|
21
|
+
OpType.S,
|
|
22
|
+
OpType.Sdg,
|
|
23
|
+
OpType.T,
|
|
24
|
+
OpType.Tdg,
|
|
25
|
+
}
|
|
26
|
+
_ONE_QUBIT_ROTATIONS = {OpType.Rx, OpType.Ry, OpType.Rz}
|
|
27
|
+
_MEASURE_GATES = {OpType.Measure}
|
|
28
|
+
_IBM_GATES = {OpType.U1, OpType.U2, OpType.U3}
|
|
29
|
+
_1Q_GATES = _ONE_QUBIT_ROTATIONS | _ONE_QUBIT_GATES | _MEASURE_GATES | _IBM_GATES
|
|
30
|
+
_ALL_GATES = _1Q_GATES | _TWO_QUBIT_GATES
|
|
31
|
+
_rebase_pass = auto_rebase_pass(_ALL_GATES)
|
|
32
|
+
|
|
33
|
+
QULACS_PASS_LEVEL_0 = SequencePass([DecomposeBoxes(), FlattenRegisters(), _rebase_pass])
|
|
34
|
+
QULACS_PASS_LEVEL_1 = SequencePass(
|
|
35
|
+
[DecomposeBoxes(), FlattenRegisters(), SynthesiseTket(), _rebase_pass]
|
|
36
|
+
)
|
|
37
|
+
QULACS_PASS_LEVEL_2 = SequencePass(
|
|
38
|
+
[DecomposeBoxes(), FlattenRegisters(), FullPeepholeOptimise(), _rebase_pass]
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class QulacsSimulateRequest(BaseModel):
|
|
43
|
+
"""Data required to instantiate a Qulacs backend and process_circuits.
|
|
44
|
+
|
|
45
|
+
This DTO should be kept in sync with the constructor of the Backend defined in pytket-qulacs.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
# Attributes required to instantiate the backend.
|
|
49
|
+
result_type: str = "state_vector"
|
|
50
|
+
|
|
51
|
+
# Additional kwarg to process_circuits.
|
|
52
|
+
seed: Optional[int] = None
|