Skip to content

Commit

Permalink
Remove deprecated auto_rebase_pass and auto_squash_pass. (#1693)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec authored Nov 22, 2024
1 parent 88c0481 commit 22e791a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 118 deletions.
7 changes: 7 additions & 0 deletions pytket/docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

Unreleased
----------

API changes:

* Remove the deprecated methods `auto_rebase_pass()` and `auto_squash_pass()`.

1.35.0 (November 2024)
----------------------

Expand Down
4 changes: 2 additions & 2 deletions pytket/docs/faqs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Q: Can I convert a pytket :py:class:`Circuit` to a gateset of my choice?
A: Yes, this can be done in many cases provided the target gateset is a set of one and two qubit pytket :py:class:`OpType` s.
There are two types of rebase

1) :py:meth:`auto_rebase_pass` - this uses a set of hardcoded decompositions to convert between gatesets. This can be used quickly when the gateset is one widely used on quantum hardware e.g. IBM's {X, SX, Rz, CX} gateset.
1) :py:meth:`AutoRebase` - this uses a set of hardcoded decompositions to convert between gatesets. This can be used quickly when the gateset is one widely used on quantum hardware e.g. IBM's {X, SX, Rz, CX} gateset.

2) :py:class:`RebaseCustom` - This can be used instead of `auto_rebase_pass` in cases where there is no hardcoded conversion available.
2) :py:class:`RebaseCustom` - This can be used instead of `AutoRebase` in cases where there is no hardcoded conversion available.
In this case the user will have to specify how to implement TKET's {TK1, CX} or {TK1, TK2} operations in terms of the target :py:class:`OpType` s.

See the manual section on `rebases <https://docs.quantinuum.com/tket/user-guide/manual/manual_compiler.html#rebases>`_ for examples.
Expand Down
7 changes: 1 addition & 6 deletions pytket/docs/passes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ There are passes such as `FullPeepholeOptimise <https://docs.quantinuum.com/tket

Also there are special purpose passes such as `OptimisePhaseGadgets <https://docs.quantinuum.com/tket/api-docs/passes.html#pytket.passes.OptimisePhaseGadgets>`_ and `PauliSimp <https://docs.quantinuum.com/tket/api-docs/passes.html#pytket.passes.PauliSimp>`_ which perform optimisation by targeting phase gadget and Pauli gadget structures within circuits. For more on these optimisation techniques see the `corresponding publication <https://arxiv.org/abs/1906.01734>`_.

Rebase passes can be used to convert a circuit to a desired gateset. See `RebaseCustom <https://docs.quantinuum.com/tket/api-docs/passes.html#pytket.passes.RebaseCustom>`_ and `auto_rebase_pass <https://docs.quantinuum.com/tket/api-docs/passes.html#pytket.passes.auto_rebase.auto_rebase_pass>`_.
Rebase passes can be used to convert a circuit to a desired gateset. See `RebaseCustom <https://docs.quantinuum.com/tket/api-docs/passes.html#pytket.passes.RebaseCustom>`_ and `AutoRebase <https://docs.quantinuum.com/tket/api-docs/passes.html#pytket._tket.passes.AutoRebase>`_.

For more on pytket passes see the `compilation <https://docs.quantinuum.com/tket/user-guide/manual/manual_compiler.html>`_ section of the user manual or the `notebook tutorials <https://docs.quantinuum.com/tket/examples>`_

Expand All @@ -25,8 +25,3 @@ pytket.passes.script

.. automodule:: pytket.passes.script
:members: compilation_pass_from_script, compilation_pass_grammar

pytket.passes.auto_rebase
~~~~~~~~~~~~~~~~~~~~~~~~~
.. automodule:: pytket.passes.auto_rebase
:members: auto_rebase_pass, auto_squash_pass
1 change: 0 additions & 1 deletion pytket/pytket/passes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from pytket._tket.passes import *

from .auto_rebase import auto_rebase_pass, auto_squash_pass
from .passselector import PassSelector
from .resizeregpass import scratch_reg_resize_pass
from .script import compilation_pass_from_script, compilation_pass_grammar
93 changes: 0 additions & 93 deletions pytket/pytket/passes/auto_rebase.py

This file was deleted.

15 changes: 0 additions & 15 deletions pytket/tests/predicates_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@
ThreeQubitSquash,
ZXGraphlikeOptimisation,
ZZPhaseToRz,
auto_rebase_pass,
auto_squash_pass,
)
from pytket.pauli import Pauli
from pytket.placement import GraphPlacement, Placement
Expand Down Expand Up @@ -1094,19 +1092,6 @@ def test_greedy_pauli_synth() -> None:
assert GreedyPauliSimp().apply(c)


def test_auto_rebase_deprecation(recwarn: Any) -> None:
_ = auto_rebase_pass({OpType.TK1, OpType.CX})
assert len(recwarn) == 1
w = recwarn.pop(DeprecationWarning)
assert issubclass(w.category, DeprecationWarning)
assert "deprecated" in str(w.message)
_ = auto_squash_pass({OpType.TK1})
assert len(recwarn) == 1
w = recwarn.pop(DeprecationWarning)
assert issubclass(w.category, DeprecationWarning)
assert "deprecated" in str(w.message)


if __name__ == "__main__":
test_predicate_generation()
test_compilation_unit_generation()
Expand Down
2 changes: 1 addition & 1 deletion pytket/tests/zx_diagram_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from math import isclose, pow
from math import isclose
from typing import Tuple

import numpy as np
Expand Down

0 comments on commit 22e791a

Please sign in to comment.