Skip to content

Commit

Permalink
Release 0.45.0 compatible with pytket 2 (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec authored Mar 3, 2025
1 parent 07a4367 commit 65dfaeb
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 24 deletions.
2 changes: 1 addition & 1 deletion _metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__extension_version__ = "0.44.0"
__extension_version__ = "0.45.0"
__extension_name__ = "pytket-quantinuum"
6 changes: 5 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@

# Changelog

## Unreleased
## 0.45.0 (March 2025)

- Add CliffordCircuitPredicate for circuit compilation and processing
when using the stabilizer simulator.
- Update pytket version requirement to 2.0.1.
- Update pytket-qir version requirement to 0.21.
- Update pytket-pecos version requirement to 0.2.0.


## 0.44.0 (February 2025)

Expand Down
1 change: 0 additions & 1 deletion pytket/extensions/quantinuum/backends/quantinuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
OpType.ExplicitModifier,
OpType.SetBits,
OpType.CopyBits,
OpType.ClassicalExpBox,
OpType.ClExpr,
OpType.WASM,
}
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=[
"pytket >= 1.40.0, < 2",
"pytket-qir >= 0.20, < 0.21",
"pytket >= 2.0.1",
"pytket-qir >= 0.21, < 0.22",
"requests >= 2.32.2",
"types-requests",
"websockets >= 13.1",
Expand All @@ -56,7 +56,7 @@
"numpy >= 1.26.4",
],
extras_require={
"pecos": ["pytket-pecos ~= 0.1.32"],
"pecos": ["pytket-pecos ~= 0.2.0"],
"calendar": ["matplotlib >= 3.8.3,< 3.11.0", "pandas ~= 2.2.1"],
},
classifiers=[
Expand Down
15 changes: 10 additions & 5 deletions tests/integration/backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
reg_lt,
reg_neq,
)
from pytket.circuit.clexpr import wired_clexpr_from_logic_exp
from pytket.extensions.quantinuum import (
Language,
QuantinuumBackend,
Expand Down Expand Up @@ -412,10 +413,10 @@ def test_classical(
c.add_c_setreg(23, a)
c.add_c_copyreg(a, b)

c.add_classicalexpbox_register(a + b, d.to_list())
c.add_classicalexpbox_register(a - b, d.to_list())
c.add_classicalexpbox_register(a << 1, a.to_list())
c.add_classicalexpbox_register(a >> 1, b.to_list())
c.add_clexpr(*wired_clexpr_from_logic_exp(a + b, d.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a - b, d.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a << 1, a.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a >> 1, b.to_list()))

c.X(0, condition=reg_eq(a ^ b, 1))
c.X(0, condition=(a[0] ^ b[0]))
Expand All @@ -431,6 +432,8 @@ def test_classical(
c.X(0, condition=reg_leq(a, 1))
c.Phase(0, condition=a[0])

c.measure_all()

backend = authenticated_quum_backend_qa

c = backend.get_compiled_circuit(c)
Expand Down Expand Up @@ -465,7 +468,7 @@ def test_division(

c.add_c_setbits([False, True] + [False] * 6, a) # type: ignore
c.add_c_setbits([True, True] + [False] * 8, b) # type: ignore
c.add_classicalexpbox_register(a * b // d, d.to_list())
c.add_clexpr(*wired_clexpr_from_logic_exp(a * b // d, d.to_list()))

backend = authenticated_quum_backend_qa

Expand Down Expand Up @@ -792,6 +795,7 @@ def test_wasm_qa(
c.name = "test_wasm"
a = c.add_c_register("a", 8)
c.add_wasm_to_reg("add_one", wasfile, [a], [a])
c.measure_all()

b = authenticated_quum_backend_qa

Expand Down Expand Up @@ -861,6 +865,7 @@ def test_wasm_costs(
c.name = "test_wasm"
a = c.add_c_register("a", 8)
c.add_wasm_to_reg("add_one", wasfile, [a], [a])
c.measure_all()

b = authenticated_quum_backend_qa

Expand Down
27 changes: 14 additions & 13 deletions tests/integration/local_emulator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
reg_lt,
reg_neq,
)
from pytket.circuit.clexpr import wired_clexpr_from_logic_exp
from pytket.extensions.quantinuum import QuantinuumBackend, have_pecos
from pytket.wasm import WasmFileHandler

Expand Down Expand Up @@ -169,11 +170,11 @@ def test_classical_0(authenticated_quum_backend_prod: QuantinuumBackend) -> None
c.add_c_setreg(23, a)
c.add_c_copyreg(a, b)

c.add_classicalexpbox_register(a + b, d.to_list())
c.add_classicalexpbox_register(a - b, d.to_list())
c.add_classicalexpbox_register(a * b * d, d.to_list())
c.add_classicalexpbox_register(a << 1, a.to_list())
c.add_classicalexpbox_register(a >> 1, b.to_list())
c.add_clexpr(*wired_clexpr_from_logic_exp(a + b, d.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a - b, d.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a * b * d, d.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a << 1, a.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a >> 1, b.to_list()))

c.X(0, condition=reg_eq(a ^ b, 1))
c.X(0, condition=reg_eq(a & b, 1))
Expand Down Expand Up @@ -216,11 +217,11 @@ def test_classical_1(authenticated_quum_backend_prod: QuantinuumBackend) -> None
c.add_c_setreg(23, a)
c.add_c_copyreg(a, b)

c.add_classicalexpbox_register(a + b, d.to_list())
c.add_classicalexpbox_register(a - b, d.to_list())
c.add_classicalexpbox_register(a * b * d, d.to_list())
c.add_classicalexpbox_register(a << 1, a.to_list())
c.add_classicalexpbox_register(a >> 1, b.to_list())
c.add_clexpr(*wired_clexpr_from_logic_exp(a + b, d.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a - b, d.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a * b * d, d.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a << 1, a.to_list()))
c.add_clexpr(*wired_clexpr_from_logic_exp(a >> 1, b.to_list()))

c.X(0, condition=reg_eq(a ^ b, 1))
c.Measure(Qubit(0), d[0])
Expand All @@ -245,7 +246,7 @@ def test_classical_2(authenticated_quum_backend_prod: QuantinuumBackend) -> None
b = circ.add_c_register("b", 2)
c = circ.add_c_register("c", 1)
expr = a[0] ^ b[0]
circ.add_classicalexpbox_bit(expr, [c[0]])
circ.add_clexpr(*wired_clexpr_from_logic_exp(expr, [c[0]]))
circ.X(0)
circ.Measure(Qubit(0), a[1])
backend = authenticated_quum_backend_prod
Expand All @@ -270,8 +271,8 @@ def test_classical_3(authenticated_quum_backend_prod: QuantinuumBackend) -> None
circ.add_c_setreg(3, a)
circ.add_c_copyreg(a, b)

circ.add_classicalexpbox_register(a - b, c.to_list())
circ.add_classicalexpbox_register(a << 1, a.to_list())
circ.add_clexpr(*wired_clexpr_from_logic_exp(a - b, c.to_list()))
circ.add_clexpr(*wired_clexpr_from_logic_exp(a << 1, a.to_list()))

circ.X(0)
circ.Measure(Qubit(0), a[3])
Expand Down

0 comments on commit 65dfaeb

Please sign in to comment.