Skip to content

Commit

Permalink
Merge branch 'main' into ae/clexprle
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec authored Nov 19, 2024
2 parents 09e2fc4 + 6c23c79 commit 87604dc
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
13 changes: 12 additions & 1 deletion pytket/binders/passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,16 @@ PYBIND11_MODULE(passes, m) {
"DecomposeMultiQubitsCX", &DecomposeMultiQubitsCX,
"Converts all multi-qubit gates into CX and single-qubit gates.");
m.def(
"GlobalisePhasedX", &GlobalisePhasedX,
"GlobalisePhasedX",
[](bool squash) {
PyErr_WarnEx(
PyExc_DeprecationWarning,
"The GlobalisePhasedX pass is unreliable and deprecated. It will "
"be removed no earlier that three months after the pytket 1.35 "
"release.",
1);
return GlobalisePhasedX(squash);
},
"Turns all PhasedX and NPhasedX gates into global gates\n\n"
"Replaces any PhasedX gates with global NPhasedX gates. "
"By default, this transform will squash all single-qubit gates "
Expand All @@ -499,6 +508,8 @@ PYBIND11_MODULE(passes, m) {
"performance. If squashing is disabled, each non-global PhasedX gate "
"will be replaced with two global NPhasedX, but any other gates will "
"be left untouched."
"\n\nDEPRECATED: This pass will be removed no earlier than three months "
"after the pytket 1.35 release."
"\n\n:param squash: Whether to squash the circuit in pre-processing "
"(default: true)."
"\n\nIf squash=true (default), the `GlobalisePhasedX` transform's "
Expand Down
13 changes: 12 additions & 1 deletion pytket/binders/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,16 @@ PYBIND11_MODULE(transform, m) {
"DecomposeNPhasedX", &Transforms::decompose_NPhasedX,
"Decompose NPhasedX gates into single-qubit PhasedX gates.")
.def_static(
"GlobalisePhasedX", &Transforms::globalise_PhasedX,
"GlobalisePhasedX",
[](bool squash) {
PyErr_WarnEx(
PyExc_DeprecationWarning,
"The GlobalisePhasedX transform is unreliable and deprecated. "
"It will be removed no earlier than three months after the "
"pytket 1.35 release.",
1);
return Transforms::globalise_PhasedX(squash);
},
"Turns all PhasedX and NPhasedX gates into global gates\n\n"
"Replaces any PhasedX gates with global NPhasedX gates. "
"By default, this transform will squash all single-qubit gates "
Expand All @@ -396,6 +405,8 @@ PYBIND11_MODULE(transform, m) {
"performance. If squashing is disabled, each non-global PhasedX gate "
"will be replaced with two global NPhasedX, but any other gates will "
"be left untouched."
"\n\nDEPRECATED: This transform will be removed no earlier than "
"three months after the pytket 1.35 release."
"\n\n:param squash: Whether to squash the circuit in pre-processing "
"(default: true)."
"\n\nIf squash=true (default), the `GlobalisePhasedX` transform's "
Expand Down
1 change: 1 addition & 0 deletions pytket/docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Features:
Deprecations:

* Deprecate `ClassicalExpBox` and related methods, in favour of `ClExprOp`.
* Deprecate `GlobalisePhasedX` pass and transform.

Fixes:

Expand Down
2 changes: 2 additions & 0 deletions pytket/pytket/_tket/passes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@ def GlobalisePhasedX(squash: bool = True) -> BasePass:
Replaces any PhasedX gates with global NPhasedX gates. By default, this transform will squash all single-qubit gates to PhasedX and Rz gates before proceeding further. Existing non-global NPhasedX will not be preserved. This is the recommended setting for best performance. If squashing is disabled, each non-global PhasedX gate will be replaced with two global NPhasedX, but any other gates will be left untouched.
DEPRECATED: This pass will be removed no earlier than three months after the pytket 1.35 release.
:param squash: Whether to squash the circuit in pre-processing (default: true).
If squash=true (default), the `GlobalisePhasedX` transform's `apply` method will always return true. For squash=false, `apply()` will return true if the circuit was changed and false otherwise.
Expand Down
2 changes: 2 additions & 0 deletions pytket/pytket/_tket/transform.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class Transform:
Replaces any PhasedX gates with global NPhasedX gates. By default, this transform will squash all single-qubit gates to PhasedX and Rz gates before proceeding further. Existing non-global NPhasedX will not be preserved. This is the recommended setting for best performance. If squashing is disabled, each non-global PhasedX gate will be replaced with two global NPhasedX, but any other gates will be left untouched.
DEPRECATED: This transform will be removed no earlier than three months after the pytket 1.35 release.
:param squash: Whether to squash the circuit in pre-processing (default: true).
If squash=true (default), the `GlobalisePhasedX` transform's `apply` method will always return true. For squash=false, `apply()` will return true if the circuit was changed and false otherwise.
Expand Down

0 comments on commit 87604dc

Please sign in to comment.