Skip to content

Commit

Permalink
Merge pull request #123 from CQCL/release/0.15.0
Browse files Browse the repository at this point in the history
Release/0.15.0
  • Loading branch information
cqc-melf authored Apr 5, 2023
2 parents 6ebcdc0 + 6b15c89 commit 7f24de0
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 34 deletions.
File renamed without changes
Binary file added .github/workflows/docs/Quantinuum_logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions .github/workflows/docs/build-docs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def build_module_docs():
mod_docs = MODULES_DIR / "docs"
mod_build = mod_docs / "build"
conf_copy = mod_docs / "conf.py"
logo_copy = mod_docs / "Quantinuum_logo.png"
logo_copy_black = mod_docs / "Quantinuum_logo_black.png"
logo_copy_white = mod_docs / "Quantinuum_logo_white.png"
shutil.copy(DOCS_DIR / "conf.py", conf_copy)
shutil.copy(DOCS_DIR / "Quantinuum_logo.png", logo_copy)
shutil.copy(DOCS_DIR / "Quantinuum_logo_black.png", logo_copy_black)
shutil.copy(DOCS_DIR / "Quantinuum_logo_white.png", logo_copy_white)
remove_dir(mod_build)
index_rst = mod_docs / "index.rst"
with open(mod_docs / "intro.txt", "r") as f:
Expand Down Expand Up @@ -81,7 +83,8 @@ def build_module_docs():
fix_links(htmlfile)
fix_links(mod_build / "searchindex.js")
conf_copy.unlink()
logo_copy.unlink()
logo_copy_black.unlink()
logo_copy_white.unlink()
index_rst.unlink()


Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
"repository_url": "https://github.com/CQCL/pytket-quantinuum",
"use_repository_button": True,
"use_issues_button": True,
"logo": {
"image_light": "Quantinuum_logo_black.png",
"image_dark": "Quantinuum_logo_white.png",
},
}

html_static_path = ["_static"]

html_css_files = ["custom.css"]

html_logo = "Quantinuum_logo.png"

# -- Extension configuration -------------------------------------------------

pytketdoc_base = "https://cqcl.github.io/tket/pytket/api/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx ~= 4.3.2
sphinx_book_theme ~= 0.3.3
sphinx_book_theme >= 1.0.1, <2.0
sphinx-copybutton
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.14.0"
__extension_version__ = "0.15.0"
__extension_name__ = "pytket-quantinuum"
13 changes: 2 additions & 11 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
background-color: #d9d9d9;
}

.caption-text {
color: #000000;
}

.btn-link:visited,
.btn-link,
a:visited,
Expand All @@ -30,13 +26,8 @@ a:visited,
.wy-menu-vertical ul,
.span.pre,
.sig-param,
.std.std-ref,
a {
color: #544d4d;
}

:root {
--pst-color-inline-code: 199, 37, 78 !important;
html[data-theme=light] {
--pst-color-inline-code: rgb(199, 37, 78) !important;
}

.sig-name {
Expand Down
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.15.0 (April 2023)
-------------------

* Darkmode added to the documentation
* Updated pytket version requirement to 1.13.2
* Default compilation passes update to correctly track initial and final maps during compilation

0.14.0 (March 2023)
-------------------

Expand Down
7 changes: 5 additions & 2 deletions docs/intro.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The passes applied by different levels of optimisation are specified in the tabl
* - self.rebase_pass [2]
- `SynthesiseTket <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.SynthesiseTket>`_
- `FullPeepholeOptimise [3] <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.FullPeepholeOptimise>`_
* -
* - `FlattenRelabelRegistersPass <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.FlattenRelabelRegistersPass>`_
- `NormaliseTK2 <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.NormaliseTK2>`_
- `NormaliseTK2 <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.NormaliseTK2>`_
* -
Expand All @@ -95,7 +95,10 @@ The passes applied by different levels of optimisation are specified in the tabl
- `SimplifyInitial [5] <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.SimplifyInitial>`_
* -
- `SimplifyInitial [5] <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.SimplifyInitial>`_
-
- `FlattenRelabelRegistersPass <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.FlattenRelabelRegistersPass>`_
* -
- `FlattenRelabelRegistersPass <https://cqcl.github.io/tket/pytket/api/passes.html#pytket.passes.FlattenRelabelRegistersPass>`_
-

* [1] If no value is specified then ``optimisation_level`` defaults to a value of 2.

Expand Down
13 changes: 4 additions & 9 deletions pytket/extensions/quantinuum/backends/quantinuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from pytket.backends.backendinfo import BackendInfo
from pytket.backends.backendresult import BackendResult
from pytket.backends.backend_exceptions import CircuitNotRunError
from pytket.circuit import Circuit, OpType, Bit, Node # type: ignore
from pytket.circuit import Circuit, OpType, Bit # type: ignore
from pytket._tket.circuit import _TEMP_BIT_NAME # type: ignore
from pytket.extensions.quantinuum._metadata import __extension_version__
from pytket.qasm import circuit_to_qasm_str
Expand All @@ -46,6 +46,7 @@
SimplifyInitial,
ZZPhaseToRz,
CustomPass,
FlattenRelabelRegistersPass,
auto_rebase_pass,
auto_squash_pass,
)
Expand Down Expand Up @@ -102,12 +103,6 @@ def _get_gateset(gates: List[str]) -> Set[OpType]:
return gs


def _flatten_registers(c: "Circuit") -> "Circuit":
c.remove_blank_wires()
c.rename_units({qb: Node(i) for i, qb in enumerate(c.qubits)})
return c


def scratch_reg_resize_pass(max_size: int = MAX_C_REG_WIDTH) -> CustomPass:
"""Given a max scratch register width, return a compiler pass that
breaks up the internal scratch bit registers into smaller registers
Expand Down Expand Up @@ -271,7 +266,7 @@ def _dict_to_backendinfo(cls, dct: Dict[str, Any]) -> BackendInfo:
name=cls.__name__,
device_name=name,
version=__extension_version__,
architecture=FullyConnected(n_qubits),
architecture=FullyConnected(n_qubits, "node"),
gate_set=_get_gateset(gate_set),
supports_fast_feedforward=True,
supports_midcircuit_measurement=True,
Expand Down Expand Up @@ -431,7 +426,7 @@ def default_compilation_pass(self, optimisation_level: int = 2) -> BasePass:
# of qubits actually used in the Circuit.
# The Circuit qubits attribute is iterated through, with the ith
# qubit being assigned to the ith qubit of a new "node" register
passlist.append(CustomPass(_flatten_registers))
passlist.append(FlattenRelabelRegistersPass("node"))
return SequencePass(passlist)

@property
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
packages=find_namespace_packages(include=["pytket.*"]),
include_package_data=True,
install_requires=[
"pytket ~= 1.13",
"pytket >= 1.13.2, <2.0",
"requests >= 2.2",
"types-requests",
"websockets >= 7.0",
Expand Down
4 changes: 3 additions & 1 deletion tests/api1_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ def test_available_devices(
backinfo = devices[0]

assert backinfo.device_name == mock_machine_info["name"]
assert backinfo.architecture == FullyConnected(mock_machine_info["n_qubits"])
assert backinfo.architecture == FullyConnected(
mock_machine_info["n_qubits"], "node"
)
assert backinfo.version == __extension_version__
assert backinfo.supports_fast_feedforward == True
assert backinfo.supports_midcircuit_measurement == True
Expand Down
13 changes: 10 additions & 3 deletions tests/backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
FullPeepholeOptimise,
OptimisePhaseGadgets,
)
from pytket.predicates import CompilationUnit # type: ignore


from pytket.circuit import ( # type: ignore
Expand Down Expand Up @@ -229,11 +230,17 @@ def test_default_pass(
c.ZZPhase(0.84, 2, 0)
c.measure_all()
c.add_qubit(q1)
comp_pass.apply(c)
cu = CompilationUnit(c)
comp_pass.apply(cu)
# 5 qubits added to Circuit, one is removed when flattening registers
assert c.qubits == [Node(0), Node(1), Node(2), Node(3)]
assert cu.circuit.qubits == [Node(0), Node(1), Node(2), Node(3)]
assert cu.initial_map[Qubit(0)] == Node(0)
assert cu.initial_map[Qubit(1)] == Node(1)
assert cu.initial_map[Qubit(2)] == Node(2)
assert cu.initial_map[q0] == Node(3)
assert cu.initial_map[q1] == q1
for pred in b.required_predicates:
assert pred.verify(c)
assert pred.verify(cu.circuit)


@pytest.mark.skipif(skip_remote_tests, reason=REASON)
Expand Down

0 comments on commit 7f24de0

Please sign in to comment.