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

Release/1.27.0 #146

Merged
merged 7 commits into from
Apr 17, 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 .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4.0.4
uses: actions/deploy-pages@v4.0.5
2 changes: 0 additions & 2 deletions .github/workflows/docs/build-docs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ def build_module_docs():
"-D",
f"project=pytket-{MODULE}",
"-D",
f"copyright={datetime.date.today().year} Cambridge Quantum Computing",
"-D",
f"version={'.'.join(v[:2])}",
"-D",
f"release={'.'.join(v)}",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Configuration file for the Sphinx documentation builder.
# See https://www.sphinx-doc.org/en/master/usage/configuration.html

author = "Cambridge Quantum Computing Ltd"
author = "Quantinuum"

extensions = [
"sphinx.ext.autodoc",
Expand Down
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.35.1"
__extension_version__ = "0.36.0"
__extension_name__ = "pytket-braket"
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
~~~~~~~~~

0.36.0 (April 2024)
-------------------

* Updated pytket version requirement to 1.27.
* Devices with full connectivity will use the `FullyConnected` class
to represent their architecture.

0.35.1 (March 2024)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion pytket/extensions/braket/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 Cambridge Quantum Computing
# Copyright 2020-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion pytket/extensions/braket/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 Cambridge Quantum Computing
# Copyright 2020-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
36 changes: 25 additions & 11 deletions pytket/extensions/braket/backends/braket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 Cambridge Quantum Computing
# Copyright 2020-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from itertools import permutations
import json
import warnings
from enum import Enum
Expand Down Expand Up @@ -82,7 +83,7 @@
NoSymbolsPredicate,
Predicate,
)
from pytket.architecture import Architecture
from pytket.architecture import Architecture, FullyConnected
from pytket.placement import NoiseAwarePlacement
from pytket.utils import prepare_circuit
from pytket.utils.operators import QubitPauliOperator
Expand Down Expand Up @@ -442,9 +443,8 @@ def __init__(
MaxNQubitsPredicate(n_qubits),
]

if (
self._device_type == _DeviceType.QPU
and not paradigm["connectivity"]["fullyConnected"]
if self._device_type == _DeviceType.QPU and not isinstance(
arch, FullyConnected
):
self._req_preds.append(ConnectivityPredicate(arch))

Expand Down Expand Up @@ -485,7 +485,7 @@ def _get_gate_set(
@staticmethod
def _get_arch_info(
device_properties: Dict[str, Any], device_type: _DeviceType
) -> Tuple[Architecture, List[int]]:
) -> Tuple[Architecture | FullyConnected, List[int]]:
# return the architecture, and all_qubits
paradigm = device_properties["paradigm"]
n_qubits = paradigm["qubitCount"]
Expand All @@ -510,17 +510,19 @@ def _get_arch_info(
else:
all_qubits = list(range(n_qubits))

arch: Architecture | FullyConnected
if connectivity_graph is None:
connectivity_graph = dict(
(k, [v for v in all_qubits if v != k]) for k in all_qubits
arch = FullyConnected(len(all_qubits))
else:
arch = Architecture(
[(k, v) for k, l in connectivity_graph.items() for v in l]
)
arch = Architecture([(k, v) for k, l in connectivity_graph.items() for v in l])
return arch, all_qubits

@classmethod
def _get_backend_info(
cls,
arch: Architecture,
arch: Architecture | FullyConnected,
device_name: str,
singleqs: Set[OpType],
multiqs: Set[OpType],
Expand Down Expand Up @@ -576,9 +578,21 @@ def _get_backend_info(
readout_errors = {
node: to_sym_mat(get_readout_error(node)) for node in arch.nodes
}

# Construct a fake coupling map if we have a FullyConnected architecture,
# otherwise use the coupling provided by the Architecture class.
coupling: list[tuple["Node", "Node"]]
if isinstance(arch, FullyConnected):
# cast is needed as mypy does not know that we passed a fixed
# integer to `permutations`.
coupling = cast(
list[tuple["Node", "Node"]], list(permutations(arch.nodes, 2))
)
else:
coupling = arch.coupling
link_errors = {
(n0, n1): {optype: get_link_error(n0, n1) for optype in multiqs}
for n0, n1 in arch.coupling
for n0, n1 in coupling
}

backend_info = BackendInfo(
Expand Down
2 changes: 1 addition & 1 deletion pytket/extensions/braket/braket_convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 Cambridge Quantum Computing
# Copyright 2020-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 Cambridge Quantum Computing
# Copyright 2020-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,7 +43,7 @@
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=[
"pytket ~= 1.26",
"pytket ~= 1.27",
"amazon-braket-sdk ~= 1.53",
"amazon-braket-schemas ~= 1.19",
"amazon-braket-default-simulator ~= 1.20",
Expand Down
8 changes: 3 additions & 5 deletions tests/backend_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2024 Cambridge Quantum Computing
# Copyright 2019-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,7 +20,7 @@
import numpy as np
import pytest
from pytket.extensions.braket import BraketBackend
from pytket.architecture import Architecture
from pytket.architecture import Architecture, FullyConnected
from pytket.circuit import Circuit, OpType, Qubit, Bit
from pytket.pauli import Pauli, QubitPauliString
from pytket.utils.expectations import (
Expand Down Expand Up @@ -160,9 +160,7 @@ def test_ionq(authenticated_braket_backend: BraketBackend) -> None:

# Device is fully connected
arch = b.backend_info.architecture
assert isinstance(arch, Architecture)
n = len(arch.nodes)
assert len(arch.coupling) == n * (n - 1)
assert isinstance(arch, FullyConnected)

chars = b.characterisation
assert chars is not None
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 Cambridge Quantum Computing
# Copyright 2020-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tests/convert_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024 Cambridge Quantum Computing
# Copyright 2020-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down