Add Makie extension for circuit visualization#5
Merged
Conversation
This PR introduces: 1. `affectedqubits` function (src/affectedqubits.jl) - Returns sorted list of qubit indices affected by operations - Uses Moshi pattern matching (@match) for clean ADT handling - Works on both individual operations and entire circuits 2. Makie extension (ext/PBCCompilerMakieExt/) - Provides `circuitplot`, `circuitplot!`, `circuitplot_axis` functions - Gates drawn as colored rectangles spanning affected qubits - Horizontal qubit wire lines in background - Measurement results marked with classical bit index - Conditional operations marked with dependency index - Configurable gate colors, dimensions, and wire appearance 3. Plotting scaffolding (src/plotting.jl) - Function stubs for extension to implement 4. Tests for affectedqubits function Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5 +/- ##
===========================================
+ Coverage 55.26% 78.60% +23.34%
===========================================
Files 2 4 +2
Lines 76 187 +111
===========================================
+ Hits 42 147 +105
- Misses 34 40 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Remove pattern matching mention from affectedqubits docstring - Remove implementation detail from CLAUDE.md affected qubits section - Add docstring guidelines to CLAUDE.md Development section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add CairoMakie to test dependencies - Create test_plotting.jl with tests for circuit visualization - Fix @match import (use Moshi.Match, not Moshi.Data) - Add *.png to .gitignore - Add Julia invocation instructions (-tauto) to CLAUDE.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
affectedqubitsfunction using Moshi pattern matching to query qubit indices affected by operationsPBCCompilerMakieExtpackage extension for circuit visualization when Makie is loadedcircuitplot,circuitplot!, andcircuitplot_axisfunctionsFeatures
Test plan
affectedqubitson all CircuitOp variantsaffectedqubits🤖 Generated with Claude Code