quantum-debugger 0.1.1__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. quantum_debugger-0.2.0/PKG-INFO +237 -0
  2. quantum_debugger-0.2.0/README.md +185 -0
  3. quantum_debugger-0.2.0/examples/qiskit_integration_demo.py +161 -0
  4. quantum_debugger-0.2.0/quantum_debugger/__init__.py +42 -0
  5. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/core/circuit.py +4 -0
  6. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/core/gates.py +50 -62
  7. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/debugger/debugger.py +12 -0
  8. quantum_debugger-0.2.0/quantum_debugger/integrations/__init__.py +9 -0
  9. quantum_debugger-0.2.0/quantum_debugger/integrations/qiskit_adapter.py +176 -0
  10. quantum_debugger-0.2.0/quantum_debugger.egg-info/PKG-INFO +237 -0
  11. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger.egg-info/SOURCES.txt +3 -0
  12. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/setup.py +1 -1
  13. quantum_debugger-0.1.1/PKG-INFO +0 -176
  14. quantum_debugger-0.1.1/README.md +0 -124
  15. quantum_debugger-0.1.1/quantum_debugger/__init__.py +0 -22
  16. quantum_debugger-0.1.1/quantum_debugger.egg-info/PKG-INFO +0 -176
  17. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/CHANGELOG.md +0 -0
  18. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/LICENSE +0 -0
  19. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/MANIFEST.in +0 -0
  20. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/examples/bell_state_debug.py +0 -0
  21. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/examples/grover_profiling.py +0 -0
  22. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/examples/interactive_demo.py +0 -0
  23. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/core/__init__.py +0 -0
  24. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/core/quantum_state.py +0 -0
  25. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/debugger/__init__.py +0 -0
  26. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/debugger/breakpoints.py +0 -0
  27. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/debugger/inspector.py +0 -0
  28. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/profiler/__init__.py +0 -0
  29. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/profiler/metrics.py +0 -0
  30. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/profiler/profiler.py +0 -0
  31. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/visualization/__init__.py +0 -0
  32. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/visualization/bloch_sphere.py +0 -0
  33. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger/visualization/state_viz.py +0 -0
  34. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger.egg-info/dependency_links.txt +0 -0
  35. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger.egg-info/requires.txt +0 -0
  36. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/quantum_debugger.egg-info/top_level.txt +0 -0
  37. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/requirements.txt +0 -0
  38. {quantum_debugger-0.1.1 → quantum_debugger-0.2.0}/setup.cfg +0 -0
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantum-debugger
3
+ Version: 0.2.0
4
+ Summary: Interactive debugger and profiler for quantum circuits
5
+ Home-page: https://github.com/yourusername/quantum-debugger
6
+ Author: warlord9004
7
+ Author-email: your.email@example.com
8
+ Project-URL: Bug Reports, https://github.com/yourusername/quantum-debugger/issues
9
+ Project-URL: Source, https://github.com/yourusername/quantum-debugger
10
+ Project-URL: Documentation, https://quantum-debugger.readthedocs.io
11
+ Keywords: quantum computing debugging profiling quantum-circuit visualization
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Classifier: Topic :: Software Development :: Debuggers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: numpy>=1.21.0
27
+ Requires-Dist: matplotlib>=3.5.0
28
+ Requires-Dist: scipy>=1.7.0
29
+ Provides-Extra: qiskit
30
+ Requires-Dist: qiskit>=0.39.0; extra == "qiskit"
31
+ Provides-Extra: cirq
32
+ Requires-Dist: cirq>=1.0.0; extra == "cirq"
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
35
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
36
+ Requires-Dist: black>=22.0.0; extra == "dev"
37
+ Requires-Dist: flake8>=4.0.0; extra == "dev"
38
+ Requires-Dist: sphinx>=4.5.0; extra == "dev"
39
+ Dynamic: author
40
+ Dynamic: author-email
41
+ Dynamic: classifier
42
+ Dynamic: description
43
+ Dynamic: description-content-type
44
+ Dynamic: home-page
45
+ Dynamic: keywords
46
+ Dynamic: license-file
47
+ Dynamic: project-url
48
+ Dynamic: provides-extra
49
+ Dynamic: requires-dist
50
+ Dynamic: requires-python
51
+ Dynamic: summary
52
+
53
+ # QuantumDebugger
54
+
55
+ **Interactive debugger and profiler for quantum circuits with Qiskit integration**
56
+
57
+ [![PyPI version](https://badge.fury.io/py/quantum-debugger.svg)](https://pypi.org/project/quantum-debugger/)
58
+ [![Tests](https://img.shields.io/badge/tests-88%2F88%20passing-brightgreen)]()
59
+ [![Python](https://img.shields.io/badge/python-3.8%2B-blue)]()
60
+ [![License](https://img.shields.io/badge/license-MIT-green)]()
61
+
62
+ A powerful Python library for step-through debugging, state inspection, and performance analysis of quantum circuits. Now with **production-grade Qiskit integration**!
63
+
64
+ ## ✨ Features
65
+
66
+ - 🐛 **Step-through Debugging** - Execute circuits gate-by-gate with breakpoints
67
+ - 🔍 **State Inspection** - Analyze quantum states at any point
68
+ - 📊 **Circuit Profiling** - Depth analysis, gate statistics, optimization suggestions
69
+ - 🎨 **Visualization** - State vectors, Bloch spheres, and more
70
+ - 🔗 **Qiskit Integration** - Import/export circuits from Qiskit (NEW in v0.2.0!)
71
+ - ✅ **100% Tested** - 88 comprehensive tests, production-ready
72
+
73
+ ## 🚀 Quick Start
74
+
75
+ ### Installation
76
+
77
+ ```bash
78
+ pip install quantum-debugger
79
+ ```
80
+
81
+ ### Basic Usage
82
+
83
+ ```python
84
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
85
+
86
+ # Create a Bell state
87
+ qc = QuantumCircuit(2)
88
+ qc.h(0)
89
+ qc.cnot(0, 1)
90
+
91
+ # Debug step-by-step
92
+ debugger = QuantumDebugger(qc)
93
+ debugger.step() # Execute first gate
94
+ print(debugger.get_current_state())
95
+ debugger.step() # Execute second gate
96
+ print(debugger.get_current_state())
97
+ ```
98
+
99
+ ### Qiskit Integration (NEW!)
100
+
101
+ ```python
102
+ from qiskit import QuantumCircuit as QiskitCircuit
103
+ from quantum_debugger.integrations.qiskit_adapter import QiskitAdapter
104
+
105
+ # Import from Qiskit
106
+ qc_qiskit = QiskitCircuit(2)
107
+ qc_qiskit.h(0)
108
+ qc_qiskit.cx(0, 1)
109
+
110
+ qc_qd = QiskitAdapter.from_qiskit(qc_qiskit)
111
+
112
+ # Debug with our tools
113
+ debugger = QuantumDebugger(qc_qd)
114
+ debugger.add_breakpoint_at_gate(1)
115
+ debugger.continue_execution()
116
+
117
+ # Export back to Qiskit
118
+ qc_back = QiskitAdapter.to_qiskit(qc_qd)
119
+ ```
120
+
121
+ ## 📚 Core Features
122
+
123
+ ### Supported Gates
124
+
125
+ **Single-qubit**: H, X, Y, Z, S, T, RX, RY, RZ, PHASE
126
+ **Two-qubit**: CNOT, CZ, CP (controlled-phase), SWAP
127
+ **Three-qubit**: Toffoli (CCNOT)
128
+
129
+ ### Debugging Features
130
+
131
+ - ✅ Forward/backward stepping
132
+ - ✅ Breakpoints (gate-based & conditional)
133
+ - ✅ Execution history tracking
134
+ - ✅ State comparison
135
+ - ✅ Circuit profiling
136
+
137
+ ### Validated Algorithms
138
+
139
+ Grover's Search • Deutsch-Jozsa • Shor's Period Finding • Quantum Phase Estimation • VQE • Quantum Teleportation • QAOA • Error Correction
140
+
141
+ ## 🎯 Examples
142
+
143
+ ### Debugging Grover's Algorithm
144
+
145
+ ```python
146
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
147
+
148
+ # 2-qubit Grover's
149
+ qc = QuantumCircuit(2)
150
+ qc.h(0).h(1) # Superposition
151
+ qc.cz(0, 1) # Oracle
152
+ qc.h(0).h(1) # Diffusion
153
+ qc.z(0).z(1)
154
+ qc.cz(0, 1)
155
+ qc.h(0).h(1)
156
+
157
+ # Debug with breakpoints
158
+ debugger = QuantumDebugger(qc)
159
+ debugger.add_breakpoint_at_gate(2) # Break after oracle
160
+ debugger.continue_execution()
161
+ print(f"After oracle: {debugger.get_current_state()}")
162
+ ```
163
+
164
+ ### Circuit Profiling
165
+
166
+ ```python
167
+ from quantum_debugger import QuantumCircuit, CircuitProfiler
168
+
169
+ qc = QuantumCircuit(3)
170
+ for i in range(10):
171
+ qc.h(i % 3)
172
+ qc.cnot(i % 3, (i + 1) % 3)
173
+
174
+ profiler = CircuitProfiler(qc)
175
+ metrics = profiler.analyze()
176
+
177
+ print(f"Depth: {metrics.depth}")
178
+ print(f"Gates: {metrics.total_gates}")
179
+ print("Optimization suggestions:")
180
+ for suggestion in profiler.get_optimization_suggestions():
181
+ print(f" • {suggestion}")
182
+ ```
183
+
184
+ ## 📊 Testing & Quality
185
+
186
+ - **88/88 tests passing** (100%)
187
+ - Validated up to **12 qubits** (4,096-D state space)
188
+ - **100+ gate circuits** tested
189
+ - Perfect Qiskit integration fidelity
190
+ - Numerical precision < 1e-10
191
+
192
+ See [TEST_SUMMARY.md](TEST_SUMMARY.md) for details.
193
+
194
+ ## 🔧 Requirements
195
+
196
+ - Python 3.8+
197
+ - NumPy >= 1.21.0
198
+ - SciPy >= 1.7.0
199
+ - Matplotlib >= 3.5.0
200
+ - Qiskit >= 2.0 (optional, for integration features)
201
+
202
+ ## 📖 Documentation
203
+
204
+ - [Examples](examples/) - Interactive demos
205
+ - [Test Summary](TEST_SUMMARY.md) - Complete test coverage
206
+ - [Changelog](CHANGELOG.md) - Version history
207
+ - [Roadmap](ROADMAP.md) - Future features
208
+
209
+ ## 🤝 Contributing
210
+
211
+ Contributions welcome! See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
212
+
213
+ ## 📄 License
214
+
215
+ MIT License - see [LICENSE](LICENSE) file.
216
+
217
+ ## 🌟 What's New in v0.2.0
218
+
219
+ - ✨ **Qiskit Integration** - Bidirectional circuit conversion
220
+ - ✨ **CP Gate** - Controlled-phase gate support
221
+ - ✨ **19 New Tests** - Qiskit integration fully validated
222
+ - ✨ **12-Qubit Support** - Tested on extreme-scale circuits
223
+ - 🐛 **Bug Fixes** - Improved debugger API compatibility
224
+
225
+ ## 🚀 Roadmap
226
+
227
+ - [ ] Noise simulation
228
+ - [ ] Web-based debugger UI
229
+ - [ ] Cirq integration
230
+ - [ ] Hardware backend support
231
+ - [ ] Quantum machine learning tools
232
+
233
+ ---
234
+
235
+ **PyPI**: https://pypi.org/project/quantum-debugger/
236
+ **Author**: warlord9004
237
+ **Version**: 0.2.0
@@ -0,0 +1,185 @@
1
+ # QuantumDebugger
2
+
3
+ **Interactive debugger and profiler for quantum circuits with Qiskit integration**
4
+
5
+ [![PyPI version](https://badge.fury.io/py/quantum-debugger.svg)](https://pypi.org/project/quantum-debugger/)
6
+ [![Tests](https://img.shields.io/badge/tests-88%2F88%20passing-brightgreen)]()
7
+ [![Python](https://img.shields.io/badge/python-3.8%2B-blue)]()
8
+ [![License](https://img.shields.io/badge/license-MIT-green)]()
9
+
10
+ A powerful Python library for step-through debugging, state inspection, and performance analysis of quantum circuits. Now with **production-grade Qiskit integration**!
11
+
12
+ ## ✨ Features
13
+
14
+ - 🐛 **Step-through Debugging** - Execute circuits gate-by-gate with breakpoints
15
+ - 🔍 **State Inspection** - Analyze quantum states at any point
16
+ - 📊 **Circuit Profiling** - Depth analysis, gate statistics, optimization suggestions
17
+ - 🎨 **Visualization** - State vectors, Bloch spheres, and more
18
+ - 🔗 **Qiskit Integration** - Import/export circuits from Qiskit (NEW in v0.2.0!)
19
+ - ✅ **100% Tested** - 88 comprehensive tests, production-ready
20
+
21
+ ## 🚀 Quick Start
22
+
23
+ ### Installation
24
+
25
+ ```bash
26
+ pip install quantum-debugger
27
+ ```
28
+
29
+ ### Basic Usage
30
+
31
+ ```python
32
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
33
+
34
+ # Create a Bell state
35
+ qc = QuantumCircuit(2)
36
+ qc.h(0)
37
+ qc.cnot(0, 1)
38
+
39
+ # Debug step-by-step
40
+ debugger = QuantumDebugger(qc)
41
+ debugger.step() # Execute first gate
42
+ print(debugger.get_current_state())
43
+ debugger.step() # Execute second gate
44
+ print(debugger.get_current_state())
45
+ ```
46
+
47
+ ### Qiskit Integration (NEW!)
48
+
49
+ ```python
50
+ from qiskit import QuantumCircuit as QiskitCircuit
51
+ from quantum_debugger.integrations.qiskit_adapter import QiskitAdapter
52
+
53
+ # Import from Qiskit
54
+ qc_qiskit = QiskitCircuit(2)
55
+ qc_qiskit.h(0)
56
+ qc_qiskit.cx(0, 1)
57
+
58
+ qc_qd = QiskitAdapter.from_qiskit(qc_qiskit)
59
+
60
+ # Debug with our tools
61
+ debugger = QuantumDebugger(qc_qd)
62
+ debugger.add_breakpoint_at_gate(1)
63
+ debugger.continue_execution()
64
+
65
+ # Export back to Qiskit
66
+ qc_back = QiskitAdapter.to_qiskit(qc_qd)
67
+ ```
68
+
69
+ ## 📚 Core Features
70
+
71
+ ### Supported Gates
72
+
73
+ **Single-qubit**: H, X, Y, Z, S, T, RX, RY, RZ, PHASE
74
+ **Two-qubit**: CNOT, CZ, CP (controlled-phase), SWAP
75
+ **Three-qubit**: Toffoli (CCNOT)
76
+
77
+ ### Debugging Features
78
+
79
+ - ✅ Forward/backward stepping
80
+ - ✅ Breakpoints (gate-based & conditional)
81
+ - ✅ Execution history tracking
82
+ - ✅ State comparison
83
+ - ✅ Circuit profiling
84
+
85
+ ### Validated Algorithms
86
+
87
+ Grover's Search • Deutsch-Jozsa • Shor's Period Finding • Quantum Phase Estimation • VQE • Quantum Teleportation • QAOA • Error Correction
88
+
89
+ ## 🎯 Examples
90
+
91
+ ### Debugging Grover's Algorithm
92
+
93
+ ```python
94
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
95
+
96
+ # 2-qubit Grover's
97
+ qc = QuantumCircuit(2)
98
+ qc.h(0).h(1) # Superposition
99
+ qc.cz(0, 1) # Oracle
100
+ qc.h(0).h(1) # Diffusion
101
+ qc.z(0).z(1)
102
+ qc.cz(0, 1)
103
+ qc.h(0).h(1)
104
+
105
+ # Debug with breakpoints
106
+ debugger = QuantumDebugger(qc)
107
+ debugger.add_breakpoint_at_gate(2) # Break after oracle
108
+ debugger.continue_execution()
109
+ print(f"After oracle: {debugger.get_current_state()}")
110
+ ```
111
+
112
+ ### Circuit Profiling
113
+
114
+ ```python
115
+ from quantum_debugger import QuantumCircuit, CircuitProfiler
116
+
117
+ qc = QuantumCircuit(3)
118
+ for i in range(10):
119
+ qc.h(i % 3)
120
+ qc.cnot(i % 3, (i + 1) % 3)
121
+
122
+ profiler = CircuitProfiler(qc)
123
+ metrics = profiler.analyze()
124
+
125
+ print(f"Depth: {metrics.depth}")
126
+ print(f"Gates: {metrics.total_gates}")
127
+ print("Optimization suggestions:")
128
+ for suggestion in profiler.get_optimization_suggestions():
129
+ print(f" • {suggestion}")
130
+ ```
131
+
132
+ ## 📊 Testing & Quality
133
+
134
+ - **88/88 tests passing** (100%)
135
+ - Validated up to **12 qubits** (4,096-D state space)
136
+ - **100+ gate circuits** tested
137
+ - Perfect Qiskit integration fidelity
138
+ - Numerical precision < 1e-10
139
+
140
+ See [TEST_SUMMARY.md](TEST_SUMMARY.md) for details.
141
+
142
+ ## 🔧 Requirements
143
+
144
+ - Python 3.8+
145
+ - NumPy >= 1.21.0
146
+ - SciPy >= 1.7.0
147
+ - Matplotlib >= 3.5.0
148
+ - Qiskit >= 2.0 (optional, for integration features)
149
+
150
+ ## 📖 Documentation
151
+
152
+ - [Examples](examples/) - Interactive demos
153
+ - [Test Summary](TEST_SUMMARY.md) - Complete test coverage
154
+ - [Changelog](CHANGELOG.md) - Version history
155
+ - [Roadmap](ROADMAP.md) - Future features
156
+
157
+ ## 🤝 Contributing
158
+
159
+ Contributions welcome! See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
160
+
161
+ ## 📄 License
162
+
163
+ MIT License - see [LICENSE](LICENSE) file.
164
+
165
+ ## 🌟 What's New in v0.2.0
166
+
167
+ - ✨ **Qiskit Integration** - Bidirectional circuit conversion
168
+ - ✨ **CP Gate** - Controlled-phase gate support
169
+ - ✨ **19 New Tests** - Qiskit integration fully validated
170
+ - ✨ **12-Qubit Support** - Tested on extreme-scale circuits
171
+ - 🐛 **Bug Fixes** - Improved debugger API compatibility
172
+
173
+ ## 🚀 Roadmap
174
+
175
+ - [ ] Noise simulation
176
+ - [ ] Web-based debugger UI
177
+ - [ ] Cirq integration
178
+ - [ ] Hardware backend support
179
+ - [ ] Quantum machine learning tools
180
+
181
+ ---
182
+
183
+ **PyPI**: https://pypi.org/project/quantum-debugger/
184
+ **Author**: warlord9004
185
+ **Version**: 0.2.0
@@ -0,0 +1,161 @@
1
+ """
2
+ Qiskit Integration Example
3
+
4
+ Demonstrates how to use QuantumDebugger with Qiskit circuits.
5
+ """
6
+
7
+ from qiskit import QuantumCircuit as QiskitCircuit
8
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
9
+ from quantum_debugger.integrations import QiskitAdapter
10
+
11
+
12
+ def example_1_import_qiskit():
13
+ """Example 1: Import a Qiskit circuit into QuantumDebugger"""
14
+ print("\n" + "="*70)
15
+ print("Example 1: Import Qiskit Circuit")
16
+ print("="*70)
17
+
18
+ # Create a Qiskit circuit (Grover's algorithm for 2 qubits)
19
+ qc_qiskit = QiskitCircuit(2)
20
+ qc_qiskit.h(0)
21
+ qc_qiskit.h(1)
22
+ qc_qiskit.cz(0, 1)
23
+ qc_qiskit.h(0)
24
+ qc_qiskit.h(1)
25
+
26
+ print("\n✓ Created Qiskit circuit (Grover iteration)")
27
+ print(f" Qiskit gates: {len(qc_qiskit.data)}")
28
+
29
+ # Convert to QuantumDebugger
30
+ qc_qd = QiskitAdapter.from_qiskit(qc_qiskit)
31
+
32
+ print(f"\n✓ Imported into QuantumDebugger")
33
+ print(f" QuantumDebugger gates: {len(qc_qd.gates)}")
34
+
35
+ # Now use QuantumDebugger features!
36
+ debugger = QuantumDebugger(qc_qd)
37
+
38
+ print(f"\n✓ Debugging with QuantumDebugger:")
39
+ for i in range(3):
40
+ debugger.step()
41
+ state = debugger.get_current_state()
42
+ print(f" Step {i+1}: {state}")
43
+
44
+
45
+ def example_2_export_to_qiskit():
46
+ """Example 2: Create in QuantumDebugger, export to Qiskit"""
47
+ print("\n" + "="*70)
48
+ print("Example 2: Export to Qiskit")
49
+ print("="*70)
50
+
51
+ # Create circuit in QuantumDebugger
52
+ qc_qd = QuantumCircuit(3)
53
+ qc_qd.h(0)
54
+ qc_qd.cnot(0, 1)
55
+ qc_qd.cnot(1, 2)
56
+
57
+ print("\n✓ Created GHZ state in QuantumDebugger")
58
+ print(f" Gates: {len(qc_qd.gates)}")
59
+
60
+ # Convert to Qiskit
61
+ qc_qiskit = QiskitAdapter.to_qiskit(qc_qd)
62
+
63
+ print(f"\n✓ Exported to Qiskit")
64
+ print(f" Qiskit gates: {len(qc_qiskit.data)}")
65
+
66
+ # Now you can use Qiskit features (simulators, hardware, etc.)
67
+ print("\n✓ Can now use with Qiskit ecosystem:")
68
+ print(" - Run on IBM Quantum hardware")
69
+ print(" - Use Qiskit simulators")
70
+ print(" - Transpile for specific backends")
71
+
72
+
73
+ def example_3_debug_qiskit_algorithm():
74
+ """Example 3: Debug a Qiskit algorithm step-by-step"""
75
+ print("\n" + "="*70)
76
+ print("Example 3: Debug Qiskit Algorithm")
77
+ print("="*70)
78
+
79
+ # Create a parameterized Qiskit circuit (VQE ansatz)
80
+ import numpy as np
81
+ qc_qiskit = QiskitCircuit(2)
82
+ qc_qiskit.ry(np.pi/4, 0)
83
+ qc_qiskit.ry(np.pi/3, 1)
84
+ qc_qiskit.cx(0, 1)
85
+ qc_qiskit.rz(np.pi/2, 1)
86
+
87
+ print("\n✓ Created parameterized Qiskit circuit (VQE ansatz)")
88
+
89
+ # Import to QuantumDebugger
90
+ qc_qd = QiskitAdapter.from_qiskit(qc_qiskit)
91
+
92
+ # Set up debugger with breakpoint
93
+ debugger = QuantumDebugger(qc_qd)
94
+ debugger.add_breakpoint_at_gate(2) # Break before CNOT
95
+
96
+ print("\n✓ Debugging with breakpoint:")
97
+
98
+ # Step through
99
+ debugger.step()
100
+ print(f" After gate 1: {debugger.get_current_state()}")
101
+
102
+ debugger.step()
103
+ print(f" After gate 2: {debugger.get_current_state()}")
104
+
105
+ debugger.continue_execution()
106
+ print(f" Final state: {debugger.get_current_state()}")
107
+
108
+
109
+ def example_4_compare_results():
110
+ """Example 4: Compare Qiskit and QuantumDebugger execution"""
111
+ print("\n" + "="*70)
112
+ print("Example 4: Compare Results")
113
+ print("="*70)
114
+
115
+ # Create same circuit in both
116
+ qc_qiskit = QiskitCircuit(2)
117
+ qc_qiskit.h(0)
118
+ qc_qiskit.cx(0, 1)
119
+
120
+ qc_qd = QuantumCircuit(2)
121
+ qc_qd.h(0)
122
+ qc_qd.cnot(0, 1)
123
+
124
+ print("\n✓ Created identical Bell state circuits")
125
+
126
+ # Execute in QuantumDebugger
127
+ state_qd = qc_qd.get_statevector()
128
+
129
+ # Import Qiskit circuit and execute
130
+ qc_qd_from_qiskit = QiskitAdapter.from_qiskit(qc_qiskit)
131
+ state_from_qiskit = qc_qd_from_qiskit.get_statevector()
132
+
133
+ # Compare
134
+ fidelity = state_qd.fidelity(state_from_qiskit)
135
+
136
+ print(f"\n✓ Results comparison:")
137
+ print(f" QD state: {state_qd}")
138
+ print(f" From Qiskit: {state_from_qiskit}")
139
+ print(f" Fidelity: {fidelity:.10f}")
140
+
141
+ if fidelity > 0.9999:
142
+ print(" ✓ Results match perfectly!")
143
+
144
+
145
+ if __name__ == "__main__":
146
+ print("\n" + "="*70)
147
+ print(" "*15 + "QISKIT INTEGRATION EXAMPLES")
148
+ print("="*70)
149
+
150
+ example_1_import_qiskit()
151
+ example_2_export_to_qiskit()
152
+ example_3_debug_qiskit_algorithm()
153
+ example_4_compare_results()
154
+
155
+ print("\n" + "="*70)
156
+ print("✨ Qiskit integration allows you to:")
157
+ print(" • Import existing Qiskit circuits")
158
+ print(" • Debug step-by-step with breakpoints")
159
+ print(" • Export back to Qiskit for hardware execution")
160
+ print(" • Leverage both ecosystems together!")
161
+ print("="*70 + "\n")
@@ -0,0 +1,42 @@
1
+ """
2
+ QuantumDebugger - Interactive debugging and profiling for quantum circuits
3
+
4
+ A powerful Python library for step-through debugging, state inspection,
5
+ and performance analysis of quantum circuits.
6
+ """
7
+
8
+ __version__ = "0.2.0"
9
+ __author__ = "warlord9004"
10
+ __license__ = "MIT"
11
+
12
+ from .core.circuit import QuantumCircuit
13
+ from .core.quantum_state import QuantumState
14
+ from .core.gates import GateLibrary
15
+ from .debugger.debugger import QuantumDebugger
16
+ from .debugger.breakpoints import Breakpoint, BreakpointManager
17
+ from .debugger.inspector import StateInspector
18
+ from .profiler.profiler import CircuitProfiler
19
+ from .profiler.metrics import CircuitMetrics
20
+ from .visualization.state_viz import StateVisualizer
21
+ from .visualization.bloch_sphere import BlochSphere
22
+
23
+ # Optional integrations
24
+ try:
25
+ from .integrations import QiskitAdapter
26
+ __all_integrations__ = ['QiskitAdapter']
27
+ except ImportError:
28
+ __all_integrations__ = []
29
+
30
+ __all__ = [
31
+ 'QuantumCircuit',
32
+ 'QuantumState',
33
+ 'GateLibrary',
34
+ 'QuantumDebugger',
35
+ 'Breakpoint',
36
+ 'BreakpointManager',
37
+ 'StateInspector',
38
+ 'CircuitProfiler',
39
+ 'CircuitMetrics',
40
+ 'StateVisualizer',
41
+ 'BlochSphere',
42
+ ] + __all_integrations__
@@ -88,6 +88,10 @@ class QuantumCircuit:
88
88
  """Apply CZ (controlled-Z) gate"""
89
89
  return self._add_gate('CZ', GateLibrary.CZ, [control, target])
90
90
 
91
+ def cp(self, theta: float, control: int, target: int):
92
+ """Apply controlled-phase gate"""
93
+ return self._add_gate('CP', GateLibrary.CP(theta), [control, target], {'theta': theta})
94
+
91
95
  def swap(self, qubit1: int, qubit2: int):
92
96
  """Apply SWAP gate"""
93
97
  return self._add_gate('SWAP', GateLibrary.SWAP, [qubit1, qubit2])