From 60553459c569fcb1d3298a16331116b11ffa02ec Mon Sep 17 00:00:00 2001 From: Justin Kalloor Date: Tue, 8 Oct 2024 09:03:22 -0700 Subject: [PATCH 1/7] Adding Gate Docstring --- bqskit/ir/gates/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bqskit/ir/gates/__init__.py b/bqskit/ir/gates/__init__.py index 183a6426..fb9affdb 100644 --- a/bqskit/ir/gates/__init__.py +++ b/bqskit/ir/gates/__init__.py @@ -72,6 +72,8 @@ CRZGate CUGate FSIMGate + MPRYGate + MPRZGate PauliGate PauliZGate PhasedXZGate From c486811bbaf16d60efa7d9274c344abad1862d8e Mon Sep 17 00:00:00 2001 From: Justin Kalloor Date: Tue, 8 Oct 2024 09:06:12 -0700 Subject: [PATCH 2/7] Updating pre-commit hooks --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5fd25af3..9c64255f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ ci: skip: [mypy] repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer From bf48f85b39e9219ae452123ad6fea03df4f06053 Mon Sep 17 00:00:00 2001 From: Justin Kalloor Date: Tue, 8 Oct 2024 11:29:36 -0700 Subject: [PATCH 3/7] Migrating/updating pre-commit hooks --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9c64255f..abdc7011 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -66,7 +66,7 @@ repos: args: - --in-place - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.1 + rev: v1.11.2 hooks: - id: mypy exclude: tests/qis/test_pauli.py From 883c5077bc5947ad5f8e7cc7768d2014361bd9a3 Mon Sep 17 00:00:00 2001 From: Justin Kalloor Date: Tue, 8 Oct 2024 12:17:51 -0700 Subject: [PATCH 4/7] Adding temporary fix to switch docformatter repo until issue is fixed --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index abdc7011..43ceec2a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,8 +20,8 @@ repos: - id: fix-byte-order-marker - id: fix-encoding-pragma args: ['--remove'] -- repo: https://github.com/PyCQA/docformatter - rev: v1.7.5 +- repo: https://github.com/s-weigand/docformatter + rev: 1ec30b7 hooks: - id: docformatter args: From d673f1306914836d5ac1826bfe9a007bb83ce9d6 Mon Sep 17 00:00:00 2001 From: Justin Kalloor Date: Tue, 8 Oct 2024 15:58:12 -0700 Subject: [PATCH 5/7] Trying to reorder imports to pass the docs --- tests/ir/gates/parameterized/test_mpry.py | 6 +++--- tests/ir/gates/parameterized/test_mprz.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/ir/gates/parameterized/test_mpry.py b/tests/ir/gates/parameterized/test_mpry.py index f16e6827..8d4b7aa5 100644 --- a/tests/ir/gates/parameterized/test_mpry.py +++ b/tests/ir/gates/parameterized/test_mpry.py @@ -2,11 +2,11 @@ from __future__ import annotations import numpy as np +import scipy.linalg as la from hypothesis import given from hypothesis.strategies import floats from hypothesis.strategies import integers from hypothesis.strategies import lists -from scipy.linalg import block_diag from bqskit.ir.gates.constant import PermutationGate from bqskit.ir.gates.parameterized import MPRYGate @@ -34,7 +34,7 @@ def test_get_unitary(thetas: list[float]) -> None: thetas = thetas[:2 ** (num_qudits - 1)] MPRy = MPRYGate(num_qudits=num_qudits) block_unitaries = [RYGate().get_unitary([theta]) for theta in thetas] - blocked_unitary = block_diag(*block_unitaries) + blocked_unitary = la.block_diag(*block_unitaries) dist = MPRy.get_unitary(thetas).get_distance_from(blocked_unitary) assert dist < 1e-7 @@ -50,7 +50,7 @@ def test_get_unitary_target_select(target_qubit: int) -> None: # Create the block diagonal matrix block_unitaries = [RYGate().get_unitary([theta]) for theta in thetas] - blocked_unitary = block_diag(*block_unitaries) + blocked_unitary = la.block_diag(*block_unitaries) # Apply a permutation transformation # to the block diagonal matrix diff --git a/tests/ir/gates/parameterized/test_mprz.py b/tests/ir/gates/parameterized/test_mprz.py index b19c5d92..0ba506e3 100644 --- a/tests/ir/gates/parameterized/test_mprz.py +++ b/tests/ir/gates/parameterized/test_mprz.py @@ -2,11 +2,11 @@ from __future__ import annotations import numpy as np +import scipy.linalg as la from hypothesis import given from hypothesis.strategies import floats from hypothesis.strategies import integers from hypothesis.strategies import lists -from scipy.linalg import block_diag from bqskit.ir.gates.constant import PermutationGate from bqskit.ir.gates.parameterized import MPRZGate @@ -34,7 +34,7 @@ def test_get_unitary(thetas: list[float]) -> None: thetas = thetas[:2 ** (num_qudits - 1)] MPRy = MPRZGate(num_qudits=num_qudits) block_unitaries = [RZGate().get_unitary([theta]) for theta in thetas] - blocked_unitary = block_diag(*block_unitaries) + blocked_unitary = la.block_diag(*block_unitaries) dist = MPRy.get_unitary(thetas).get_distance_from(blocked_unitary) assert dist < 1e-7 @@ -50,7 +50,7 @@ def test_get_unitary_target_select(target_qubit: int) -> None: # Create the block diagonal matrix block_unitaries = [RZGate().get_unitary([theta]) for theta in thetas] - blocked_unitary = block_diag(*block_unitaries) + blocked_unitary = la.block_diag(*block_unitaries) # Apply a permutation transformation # to the block diagonal matrix From 136e359df2ccb908ddb909e1a23b4547d1f40e5a Mon Sep 17 00:00:00 2001 From: alonkukl Date: Fri, 11 Oct 2024 09:41:04 -0700 Subject: [PATCH 6/7] Fixing a typo in a var name that caused a crash --- bqskit/runtime/detached.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bqskit/runtime/detached.py b/bqskit/runtime/detached.py index ea32afbd..616f9cf2 100644 --- a/bqskit/runtime/detached.py +++ b/bqskit/runtime/detached.py @@ -260,7 +260,7 @@ def handle_disconnect(self, conn: Connection) -> None: self.handle_cancel_comp_task(task_id) tasks_to_pop = [] - for (task, (tid, other_conn)) in self.tasks.items(): + for (task_id, (tid, other_connd)) in self.tasks.items(): if other_conn == conn: tasks_to_pop.append((task_id, tid)) From 6e5a1560aaa6dc8ac609ca81e3979ea5ab2e6603 Mon Sep 17 00:00:00 2001 From: alonkukl Date: Fri, 11 Oct 2024 09:47:55 -0700 Subject: [PATCH 7/7] typo fix --- bqskit/runtime/detached.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bqskit/runtime/detached.py b/bqskit/runtime/detached.py index 616f9cf2..51b805aa 100644 --- a/bqskit/runtime/detached.py +++ b/bqskit/runtime/detached.py @@ -260,7 +260,7 @@ def handle_disconnect(self, conn: Connection) -> None: self.handle_cancel_comp_task(task_id) tasks_to_pop = [] - for (task_id, (tid, other_connd)) in self.tasks.items(): + for (task_id, (tid, other_conn)) in self.tasks.items(): if other_conn == conn: tasks_to_pop.append((task_id, tid))