feat: Add quantum circuit visualization and 6 tutorial examples#2
Open
FlagQuantum wants to merge 7 commits into
Open
feat: Add quantum circuit visualization and 6 tutorial examples#2FlagQuantum wants to merge 7 commits into
FlagQuantum wants to merge 7 commits into
Conversation
OpHistoryVisualizer for parsing qdev.op_history Text mode: Unicode circuit diagrams MPL mode: Publication-quality figures with professional color scheme Supports all gate types: H/X/Y/Z, RX/RY/RZ, CNOT/CY/CZ, SWAP, CPhase, CRX/CRY/CRZ, RXX/RYY/RZZ, Toffoli, CSWAP... 6 tutorial notebooks from basic gates to QML training visualization
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.
🎯 Overview
This PR adds professional quantum circuit visualization capabilities to FlagQuantum,
along with 6 tutorial examples to help users get started quickly.
✨ New Features
Circuit Visualization
OpHistoryVisualizer: Parseqdev.op_historyto generate circuit diagramsdraw_text): Unicode-based circuit representation (PennyLane style)╭╰├│grouping symbols for multi-qubit gatesmax_lengthparameterdraw_mpl): Matplotlib-based publication-quality figures#7B9EC2#E15759#DDA0DD#76B7B2#F28E2B#FFB6C1(box layout, no control points)#76B7B2|0⟩) and measurement symbolsTutorial Examples (6 notebooks)
📁 File Changes
New Files
flagquantum/drawer/__init__.py- Visualization submoduleflagquantum/drawer/text_drawer.py- Text-based circuit drawerflagquantum/drawer/mpl_drawer.py- Matplotlib circuit drawerflagquantum/drawer/style.py- Plotting style managementexamples/tutorials/00_understanding_states.ipynbexamples/tutorials/01_basic_operations.ipynbexamples/tutorials/02_measurement.ipynbexamples/tutorials/03_parameterized_gates.ipynbexamples/tutorials/04_quantum_circuit_builder.ipynbexamples/tutorials/05_quantum_machine_learning.ipynbModified Files
flagquantum/__init__.py- Export visualization functions🚀 Usage