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

Update YYPhase_using_CX to have fewer U3 #966

Merged
merged 8 commits into from
Aug 14, 2023
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
3 changes: 2 additions & 1 deletion pytket/binders/circuit/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ void init_library(py::module &m) {
"Equivalent to YYPhase, using a TK2 gate");
library_m.def(
"_YYPhase_using_CX", &CircPool::YYPhase_using_CX,
"Equivalent to YYPhase, using CX, Rz and U3 gates");
"Equivalent to YYPhase, using two CX gates and one Ry, one Sdg and one S "
"gate.");
library_m.def(
"_ZZPhase_using_TK2", &CircPool::ZZPhase_using_TK2,
"Equivalent to ZZPhase, using a TK2 gate");
Expand Down
2 changes: 1 addition & 1 deletion pytket/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def package(self):
cmake.install()

def requirements(self):
self.requires("tket/1.2.31@tket/stable")
self.requires("tket/1.2.32@tket/stable")
self.requires("tklog/0.3.3@tket/stable")
self.requires("tkrng/0.3.3@tket/stable")
self.requires("tkassert/0.3.3@tket/stable")
Expand Down
2 changes: 1 addition & 1 deletion tket/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class TketConan(ConanFile):
name = "tket"
version = "1.2.31"
version = "1.2.32"
package_type = "library"
license = "Apache 2"
homepage = "https://github.com/CQCL/tket"
Expand Down
4 changes: 3 additions & 1 deletion tket/include/tket/Circuit/CircPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ Circuit XXPhase_using_CX(const Expr &alpha);
/** Equivalent to YYPhase, using a TK2 gate */
Circuit YYPhase_using_TK2(const Expr &alpha);

/** Equivalent to YYPhase, using CX, Rz and U3 gates */
/** Equivalent to YYPhase, using two CX gates and one Ry
* one Sdg and one S gate.
*/
Circuit YYPhase_using_CX(const Expr &alpha);

/** Equivalent to ZZPhase, using a TK2 gate */
Expand Down
12 changes: 5 additions & 7 deletions tket/src/Circuit/CircPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,13 +839,11 @@ Circuit YYPhase_using_TK2(const Expr &alpha) {

Circuit YYPhase_using_CX(const Expr &alpha) {
Circuit c(2);
c.add_op<unsigned>(OpType::U3, {0.5, -0.5, 0.5}, {0});
c.add_op<unsigned>(OpType::U3, {0.5, -0.5, 0.5}, {1});
c.add_op<unsigned>(OpType::CX, {0, 1});
c.add_op<unsigned>(OpType::Rz, alpha, {1});
c.add_op<unsigned>(OpType::CX, {0, 1});
c.add_op<unsigned>(OpType::U3, {-0.5, -0.5, 0.5}, {0});
c.add_op<unsigned>(OpType::U3, {-0.5, -0.5, 0.5}, {1});
c.add_op<unsigned>(OpType::Sdg, {0});
c.add_op<unsigned>(OpType::CX, {1, 0});
c.add_op<unsigned>(OpType::Ry, alpha, {1});
c.add_op<unsigned>(OpType::CX, {1, 0});
c.add_op<unsigned>(OpType::S, {0});
return c;
}

Expand Down
Loading