Skip to content

Commit

Permalink
Merge branch 'main' of github.com:jkalloor3/bqskit into justink/qsd_d…
Browse files Browse the repository at this point in the history
…ecomp
  • Loading branch information
jkalloor3 committed Oct 15, 2024
2 parents e812db7 + 059cff6 commit 02811af
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions bqskit/ir/gates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
CRZGate
CUGate
FSIMGate
MPRYGate
MPRZGate
PauliGate
PauliZGate
PhasedXZGate
Expand Down
2 changes: 1 addition & 1 deletion bqskit/runtime/detached.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_conn)) in self.tasks.items():
if other_conn == conn:
tasks_to_pop.append((task_id, tid))

Expand Down
6 changes: 3 additions & 3 deletions tests/ir/gates/parameterized/test_mpry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/ir/gates/parameterized/test_mprz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 02811af

Please sign in to comment.