diff --git a/pytket/binders/passes.cpp b/pytket/binders/passes.cpp index 5258f14325..ef398f8a0d 100644 --- a/pytket/binders/passes.cpp +++ b/pytket/binders/passes.cpp @@ -540,7 +540,7 @@ PYBIND11_MODULE(passes, m) { m.def( "RebaseTket", &RebaseTket, "Converts all gates to CX, TK1 and Phase. " - "(Any Measure, Reset and Collapse operations are left untouched; " + "(Any Measure and Reset operations are left untouched; " "Conditional gates are also allowed.)"); m.def( "RemoveRedundancies", &RemoveRedundancies, @@ -650,7 +650,7 @@ PYBIND11_MODULE(passes, m) { ":math:`(a,b,c)` to generate replacement circuits." "\n\n" ":param gateset: the allowed operations in the rebased circuit " - "(in addition, Measure, Reset and Collapse operations are always allowed " + "(in addition, Measure and Reset operations are always allowed " "and are left alone; conditional operations may be present; and Phase " "gates may also be introduced by the rebase)" "\n:param cx_replacement: the equivalent circuit to replace a CX gate " @@ -660,8 +660,7 @@ PYBIND11_MODULE(passes, m) { "Rz(a)Rx(b)Rz(c) triple, returns an equivalent circuit in the desired " "basis" "\n:return: a pass that rebases to the given gate set (possibly " - "including conditional and phase operations, and Measure, Reset and " - "Collapse)", + "including conditional and phase operations, and Measure and Reset", py::arg("gateset"), py::arg("cx_replacement"), py::arg("tk1_replacement")); @@ -679,7 +678,7 @@ PYBIND11_MODULE(passes, m) { "to each TK1(a,b,c)." "\n\n" ":param gateset: the allowed operations in the rebased circuit " - "(in addition, Measure, Reset and Collapse operations are always allowed " + "(in addition, Measure and Reset always allowed " "and are left alone; conditional operations may be present; and Phase " "gates may also be introduced by the rebase)\n" ":param tk2_replacement: a function which, given the parameters (a,b,c) " @@ -689,7 +688,7 @@ PYBIND11_MODULE(passes, m) { "of an Rz(a)Rx(b)Rz(c) triple, returns an equivalent circuit in the " "desired basis\n" ":return: a pass that rebases to the given gate set (possibly including " - "conditional and phase operations, and Measure, Reset and Collapse)", + "conditional and phase operations, and Measure and Reset)", py::arg("gateset"), py::arg("tk2_replacement"), py::arg("tk1_replacement")); m.def( @@ -701,7 +700,7 @@ PYBIND11_MODULE(passes, m) { "Raises an error if no known decompositions can be found, in which case " "try using :py:class:`RebaseCustom` with your own decompositions.\n\n" ":param gateset: Set of supported OpTypes, target gate set. " - "(in addition, Measure, Reset and Collapse operations are always allowed " + "(in addition, Measure and Reset operations are always allowed " "and are left alone; conditional operations may be present; and Phase " "gates may also be introduced by the rebase)\n" ":param allow_swaps: Whether to allow implicit wire swaps. Default to " diff --git a/pytket/conanfile.py b/pytket/conanfile.py index 86c6f590b0..9b76b1cb1a 100644 --- a/pytket/conanfile.py +++ b/pytket/conanfile.py @@ -38,7 +38,7 @@ def requirements(self): self.requires("pybind11_json/0.2.14") self.requires("symengine/0.13.0") self.requires("tkassert/0.3.4@tket/stable") - self.requires("tket/1.3.49@tket/stable") + self.requires("tket/1.3.47@tket/stable") self.requires("tklog/0.3.3@tket/stable") self.requires("tkrng/0.3.3@tket/stable") self.requires("tktokenswap/0.3.9@tket/stable") diff --git a/pytket/docs/changelog.rst b/pytket/docs/changelog.rst index 0771c2691b..388211ff4a 100644 --- a/pytket/docs/changelog.rst +++ b/pytket/docs/changelog.rst @@ -21,6 +21,7 @@ Features: * Extend `DecomposeClassicalExp` to handle `ClExprOp` as well as `ClassicalExpBox`. * Add convenience method `Circuit.add_clecpr_from_logicexp()`. +* Remove `OpType::Collapse` from the `GateSetPredicate` of `gen_auto_rebase_pass`. Deprecations: diff --git a/pytket/pytket/_tket/passes.pyi b/pytket/pytket/_tket/passes.pyi index eee4dc965c..2010322d09 100644 --- a/pytket/pytket/_tket/passes.pyi +++ b/pytket/pytket/_tket/passes.pyi @@ -249,7 +249,7 @@ def AutoRebase(gateset: set[pytket._tket.circuit.OpType], allow_swaps: bool = Fa Attempt to generate a rebase pass automatically for the given target gateset. Checks if there are known existing decompositions to target gateset and TK1 to target gateset and uses those to construct a custom rebase. Raises an error if no known decompositions can be found, in which case try using :py:class:`RebaseCustom` with your own decompositions. - :param gateset: Set of supported OpTypes, target gate set. (in addition, Measure, Reset and Collapse operations are always allowed and are left alone; conditional operations may be present; and Phase gates may also be introduced by the rebase) + :param gateset: Set of supported OpTypes, target gate set. (in addition, Measure and Reset operations are always allowed and are left alone; conditional operations may be present; and Phase gates may also be introduced by the rebase) :param allow_swaps: Whether to allow implicit wire swaps. Default to False. """ def AutoSquash(singleqs: set[pytket._tket.circuit.OpType]) -> BasePass: @@ -565,10 +565,10 @@ def RebaseCustom(gateset: set[pytket._tket.circuit.OpType], cx_replacement: pytk 3. converts any single-qubit gates not in the gate type set to the form :math:`\\mathrm{Rz}(a)\\mathrm{Rx}(b)\\mathrm{Rz}(c)` (in matrix-multiplication order, i.e. reverse order in the circuit); 4. applies the `tk1_replacement` function to each of these triples :math:`(a,b,c)` to generate replacement circuits. - :param gateset: the allowed operations in the rebased circuit (in addition, Measure, Reset and Collapse operations are always allowed and are left alone; conditional operations may be present; and Phase gates may also be introduced by the rebase) + :param gateset: the allowed operations in the rebased circuit (in addition, Measure and Reset operations are always allowed and are left alone; conditional operations may be present; and Phase gates may also be introduced by the rebase) :param cx_replacement: the equivalent circuit to replace a CX gate using two qubit gates from the desired basis (can use any single qubit OpTypes) :param tk1_replacement: a function which, given the parameters of an Rz(a)Rx(b)Rz(c) triple, returns an equivalent circuit in the desired basis - :return: a pass that rebases to the given gate set (possibly including conditional and phase operations, and Measure, Reset and Collapse) + :return: a pass that rebases to the given gate set (possibly including conditional and phase operations, and Measure and Reset """ @typing.overload def RebaseCustom(gateset: set[pytket._tket.circuit.OpType], tk2_replacement: typing.Callable[[sympy.Expr | float, sympy.Expr | float, sympy.Expr | float], pytket._tket.circuit.Circuit], tk1_replacement: typing.Callable[[sympy.Expr | float, sympy.Expr | float, sympy.Expr | float], pytket._tket.circuit.Circuit]) -> BasePass: @@ -580,14 +580,14 @@ def RebaseCustom(gateset: set[pytket._tket.circuit.OpType], tk2_replacement: typ 3. converts any single-qubit gates not in the gate type set to TK1; 4. if TK2 is not in `gateset`. applies the `tk1_replacement` function to each TK1(a,b,c). - :param gateset: the allowed operations in the rebased circuit (in addition, Measure, Reset and Collapse operations are always allowed and are left alone; conditional operations may be present; and Phase gates may also be introduced by the rebase) + :param gateset: the allowed operations in the rebased circuit (in addition, Measure and Reset always allowed and are left alone; conditional operations may be present; and Phase gates may also be introduced by the rebase) :param tk2_replacement: a function which, given the parameters (a,b,c) of an XXPhase(a)YYPhase(b)ZZPhase(c) triple, returns an equivalent circuit in the desired basis :param tk1_replacement: a function which, given the parameters (a,b,c) of an Rz(a)Rx(b)Rz(c) triple, returns an equivalent circuit in the desired basis - :return: a pass that rebases to the given gate set (possibly including conditional and phase operations, and Measure, Reset and Collapse) + :return: a pass that rebases to the given gate set (possibly including conditional and phase operations, and Measure and Reset) """ def RebaseTket() -> BasePass: """ - Converts all gates to CX, TK1 and Phase. (Any Measure, Reset and Collapse operations are left untouched; Conditional gates are also allowed.) + Converts all gates to CX, TK1 and Phase. (Any Measure and Reset operations are left untouched; Conditional gates are also allowed.) """ def RemoveBarriers() -> BasePass: """ diff --git a/pytket/pytket/passes/auto_rebase.py b/pytket/pytket/passes/auto_rebase.py index be241b653b..37e5d22d1c 100644 --- a/pytket/pytket/passes/auto_rebase.py +++ b/pytket/pytket/passes/auto_rebase.py @@ -44,8 +44,8 @@ def auto_rebase_pass(gateset: set[OpType], allow_swaps: bool = False) -> BasePas Raises an error if no known decompositions can be found, in which case try using RebaseCustom with your own decompositions. - In addition to the gate types in ``gateset``, any ``Measure``, ``Reset`` and - ``Collapse`` operations in the original circuit are retained. Conditional + In addition to the gate types in ``gateset``, any ``Measure`` and ``Reset`` + operations in the original circuit are retained. Conditional operations are also allowed. ``Phase`` gates may also be introduced. :param gateset: Set of supported OpTypes, target gate set. diff --git a/tket/conanfile.py b/tket/conanfile.py index 01a68205a5..c479bca357 100644 --- a/tket/conanfile.py +++ b/tket/conanfile.py @@ -23,7 +23,7 @@ class TketConan(ConanFile): name = "tket" - version = "1.3.49" + version = "1.3.47" package_type = "library" license = "Apache 2" homepage = "https://github.com/CQCL/tket" diff --git a/tket/src/Predicates/PassGenerators.cpp b/tket/src/Predicates/PassGenerators.cpp index 0b2137264f..88766bbb2e 100644 --- a/tket/src/Predicates/PassGenerators.cpp +++ b/tket/src/Predicates/PassGenerators.cpp @@ -244,7 +244,6 @@ PassPtr gen_auto_rebase_pass(const OpTypeSet& allowed_gates, bool allow_swaps) { PredicatePtrMap precons; OpTypeSet all_types(allowed_gates); all_types.insert(OpType::Measure); - all_types.insert(OpType::Collapse); all_types.insert(OpType::Reset); PredicatePtr postcon1 = std::make_shared(all_types); PredicatePtr postcon2 = std::make_shared();