-
Notifications
You must be signed in to change notification settings - Fork 47
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
Modify and fix CliffordResynthesis
pass
#1476
Conversation
Repeat substituting the best found subcircuit as long as the two-qubit gate count is decreasing. "Best" means the one that reduces the two- qubit gate count the most.
687ab31
to
9547488
Compare
static bool resynthesise_cliffords( | ||
Circuit &circ, | ||
std::optional<std::function<Circuit(const Circuit &)>> transform = nullptr, | ||
bool allow_swaps = true) { | ||
bool changed = false; | ||
for (const VertexSet &verts : | ||
circ.get_subcircuits([](Op_ptr op) { return op->is_clifford(); })) { | ||
while (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this maybe better contain the break condition in the while line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a matter of preference. That would mean introducing an extra boolean variable outside the loop to control it, and modifying the variable inside the loop, whereas this way we don't need to do that. On balance I think the function is sufficiently small that the logic is apparent.
Description
Modify the promise made by, and the logic used in, the
CliffordResynthesis()
pass, to avoid the issue described in #1468 .Related issues
Fixes #1468 .
Checklist