Skip to content

transpile_swaps for Circuit and InstructionVisitor#450

Merged
thierry-martinez merged 4 commits intoTeamGraphix:masterfrom
thierry-martinez:eliminate_swaps
Feb 27, 2026
Merged

transpile_swaps for Circuit and InstructionVisitor#450
thierry-martinez merged 4 commits intoTeamGraphix:masterfrom
thierry-martinez:eliminate_swaps

Conversation

@thierry-martinez
Copy link
Copy Markdown
Collaborator

This commit implements a function transpile_swaps that returns a new circuit equivalent to the original one but without SWAP gates.

This commit also introduces a class InstructionVisitor for rewriting circuit instructions. Visitors are used in transpile_swaps and map_angle, which is now rewritten without using the type-unsafe dataclasses.replace.

This commit implements a function `transpile_swaps` that returns a new
circuit equivalent to the original one but without SWAP gates.

This commit also introduces a class `InstructionVisitor` for
rewriting circuit instructions. Visitors are used in
`transpile_swaps` and `map_angle`, which is now rewritten without
using the type-unsafe `dataclasses.replace`.
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.29%. Comparing base (c7d462a) to head (4ec8ef6).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #450      +/-   ##
==========================================
+ Coverage   88.09%   88.29%   +0.20%     
==========================================
  Files          44       44              
  Lines        6449     6535      +86     
==========================================
+ Hits         5681     5770      +89     
+ Misses        768      765       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@emlynsg emlynsg left a comment

Choose a reason for hiding this comment

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

I had to look up this Visitor construction, since it seems like a bit of boilerplate, but I'm convinced now it's a good way to do things.

Copy link
Copy Markdown
Contributor

@matulni matulni left a comment

Choose a reason for hiding this comment

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

Nothing to add, thanks!

@thierry-martinez thierry-martinez merged commit 5f413e2 into TeamGraphix:master Feb 27, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants