Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Melf/fix max n qubits #434

Merged
merged 6 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.61.0"
__extension_version__ = "0.62.0"
__extension_name__ = "pytket-qiskit"
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

# Changelog

## unreleased

- AerBackend now reject circuits with too many qubits

## 0.61.0 (December 2024)

- Restrict qiskit version to ~= 1.2.4, to avoid breaking changes in 1.3.0
Expand Down
2 changes: 2 additions & 0 deletions pytket/extensions/qiskit/backends/aer.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
ConnectivityPredicate,
DefaultRegisterPredicate,
GateSetPredicate,
MaxNQubitsPredicate,
NoBarriersPredicate,
NoClassicalControlPredicate,
NoFastFeedforwardPredicate,
Expand Down Expand Up @@ -695,6 +696,7 @@ def __init__(
self._required_predicates = [
NoSymbolsPredicate(),
GateSetPredicate(self._backend_info.gate_set),
MaxNQubitsPredicate(n_qubits),
]
if self._crosstalk_params is not None:
self._required_predicates.extend(
Expand Down
10 changes: 10 additions & 0 deletions tests/qiskit_backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from qiskit_aer import Aer # type: ignore

from pytket.architecture import Architecture, FullyConnected
from pytket.circuit import Circuit
from pytket.extensions.qiskit import (
AerBackend,
AerStateBackend,
Expand Down Expand Up @@ -59,6 +60,15 @@ def test_samples() -> None:
assert all((r[0] == "1" and r[1] == r[2]) for r in counts)


def test_maxnqubits() -> None:
backend = AerBackend(n_qubits=1)
with pytest.raises(Exception):
backend.run_circuit(
circuit=Circuit(2).CX(0, 1).measure_all(),
n_shots=1,
)


def test_state() -> None:
qc = circuit_gen()
b = AerStateBackend()
Expand Down
Loading