Skip to content

Commit 396bef6

Browse files
authored
Merge pull request #1774 from qiboteam/decompositions
Add `_base_decompose` method to missing gate classes
2 parents 8ec7509 + caf6dc5 commit 396bef6

File tree

6 files changed

+1233
-876
lines changed

6 files changed

+1233
-876
lines changed

poetry.lock

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

pyproject.toml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,17 @@ nbsphinx = "^0.8.12"
5959
qulacs = { version = "^0.6.4", python = "<3.13" }
6060
seaborn = "^0.13.2"
6161
ipykernel = "^6.29.4"
62-
qibojit = { git = "https://github.com/qiboteam/qibojit.git" , branch="backends" }
62+
qibojit = { git = "https://github.com/qiboteam/qibojit.git" }
6363

6464
[tool.poetry.group.tests]
6565
optional = true
6666

6767
[tool.poetry.group.tests.dependencies]
6868
pytest = "^7.2.1"
69-
# cirq = "^1.4.1"
7069
pytest-cov = "^4.0.0"
7170
pylint = "^3.3.5"
7271
matplotlib = "^3.7.0"
73-
qibojit = { git = "https://github.com/qiboteam/qibojit.git" , branch="backends" }
74-
# qibotn = { git = "https://github.com/qiboteam/qibotn.git" }
75-
# qiboml = { git = "https://github.com/qiboteam/qiboml.git" }
72+
qibojit = { git = "https://github.com/qiboteam/qibojit.git" }
7673
stim = "^1.12.0"
7774
qulacs = { version = "^0.6.4", python = "<3.13" }
7875
qiskit = "^2.2.3"
@@ -93,8 +90,7 @@ optional = true
9390
[tool.poetry.group.cuda11.dependencies]
9491
cupy-cuda11x = "^13.1.0"
9592
cuquantum-python-cu11 = "^24.1.0"
96-
qibojit = { git = "https://github.com/qiboteam/qibojit.git" , branch="backends" }
97-
# qibotn = { git = "https://github.com/qiboteam/qibotn.git" }
93+
qibojit = { git = "https://github.com/qiboteam/qibojit.git" }
9894

9995

10096
[tool.poetry.group.cuda12]
@@ -103,8 +99,7 @@ optional = true
10399
[tool.poetry.group.cuda12.dependencies]
104100
cupy-cuda12x = "^13.1.0"
105101
cuquantum-python-cu12 = "^24.1.0"
106-
qibojit = { git = "https://github.com/qiboteam/qibojit.git" , branch="backends" }
107-
# qibotn = { git = "https://github.com/qiboteam/qibotn.git" }
102+
qibojit = { git = "https://github.com/qiboteam/qibojit.git" }
108103

109104
[tool.poetry.extras]
110105
qinfo = ["stim"]

src/qibo/gates/abstract.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,14 @@ def _base_decompose(self, *free, use_toffolis=True, **kwargs) -> List["Gate"]:
420420
Returns:
421421
list: Synthesis of the original gate in another gate set.
422422
"""
423-
return [self.__class__(*self.init_args, **self.init_kwargs)]
423+
try:
424+
from qibo.transpiler.decompositions import ( # pylint: disable=C0415
425+
standard_decompositions,
426+
)
427+
428+
return standard_decompositions(self)
429+
except KeyError:
430+
return [self.__class__(*self.init_args, **self.init_kwargs)]
424431

425432
@staticmethod
426433
def _gates_cancel(g1, g2):

0 commit comments

Comments
 (0)