Skip to content

Optionally reuse flows for anti-commuting covers#37

Open
inmzhang wants to merge 4 commits into
mainfrom
reuse-flow-for-cover
Open

Optionally reuse flows for anti-commuting covers#37
inmzhang wants to merge 4 commits into
mainfrom
reuse-flow-for-cover

Conversation

@inmzhang
Copy link
Copy Markdown
Contributor

@inmzhang inmzhang commented Dec 3, 2025

This issue is found by one of my colleagues (Weiping Lin).

For the following circuit:

QUBIT_COORDS(0, 0) 0
QUBIT_COORDS(1, 0) 1
QUBIT_COORDS(2, 0) 2
R 0 1 2
TICK
CX 1 0
TICK
CX 1 2
TICK
MX 1
TICK
M 0 2

There should be two detectors DETECTOR rec[-1] and DETECTOR rec[-2]. However, annotate_detectors_automatically returns a single detector DETECTOR rec[-1] rec[-2]. This is because in

tqecd/src/tqecd/flow.py

Lines 90 to 93 in 7e47c39

# Update the flows by removing the entries related to stabilizers that
# will be merged and re-compute the anti-commuting stabilizers and map.
for i in sorted(flows_indices_of_stabilizers_to_merge, reverse=True):
flows.pop(i)
Every used flow is immediately removed and cannot be used anymore.

This PR adds an option to reuse the flows for further anticommuting cover opportunities. It's achieved by removing a single flow instead of all the flows each time. Note that it will significantly increase the runtime when this option is on but it enables more opportunities to find complete detectors.

@inmzhang inmzhang self-assigned this Dec 3, 2025
@inmzhang inmzhang added the enhancement New feature or request label Dec 3, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 3, 2025

Code Coverage

Package Line Rate Complexity Health
src.tqecd 93% 0
src.tqecd.match_utils 91% 0
Summary 93% (787 / 847) 0

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 3, 2025

A preview of e50278f is uploaded and can be seen here:

https://tqec.github.io/tqecd/pull/37/

Changes may take a few minutes to propagate.

Copy link
Copy Markdown
Collaborator

@HaoTy HaoTy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will try to review this PR over the weekend. Once we make the performance improvements to cover finding and the Pauli string, the overhead should be largely mitigated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants