quantum-debugger 0.1.1__tar.gz → 0.2.1__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.1/PKG-INFO +239 -0
  2. quantum_debugger-0.2.1/README.md +187 -0
  3. quantum_debugger-0.2.1/examples/qiskit_integration_demo.py +161 -0
  4. quantum_debugger-0.2.1/quantum_debugger/__init__.py +42 -0
  5. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/core/circuit.py +4 -0
  6. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/core/gates.py +50 -62
  7. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/debugger/debugger.py +12 -0
  8. quantum_debugger-0.2.1/quantum_debugger/integrations/__init__.py +9 -0
  9. quantum_debugger-0.2.1/quantum_debugger/integrations/qiskit_adapter.py +176 -0
  10. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/profiler/metrics.py +3 -3
  11. quantum_debugger-0.2.1/quantum_debugger.egg-info/PKG-INFO +239 -0
  12. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger.egg-info/SOURCES.txt +3 -0
  13. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/setup.py +4 -4
  14. quantum_debugger-0.1.1/PKG-INFO +0 -176
  15. quantum_debugger-0.1.1/README.md +0 -124
  16. quantum_debugger-0.1.1/quantum_debugger/__init__.py +0 -22
  17. quantum_debugger-0.1.1/quantum_debugger.egg-info/PKG-INFO +0 -176
  18. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/CHANGELOG.md +0 -0
  19. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/LICENSE +0 -0
  20. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/MANIFEST.in +0 -0
  21. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/examples/bell_state_debug.py +0 -0
  22. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/examples/grover_profiling.py +0 -0
  23. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/examples/interactive_demo.py +0 -0
  24. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/core/__init__.py +0 -0
  25. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/core/quantum_state.py +0 -0
  26. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/debugger/__init__.py +0 -0
  27. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/debugger/breakpoints.py +0 -0
  28. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/debugger/inspector.py +0 -0
  29. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/profiler/__init__.py +0 -0
  30. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/profiler/profiler.py +0 -0
  31. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/visualization/__init__.py +0 -0
  32. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/visualization/bloch_sphere.py +0 -0
  33. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger/visualization/state_viz.py +0 -0
  34. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger.egg-info/dependency_links.txt +0 -0
  35. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger.egg-info/requires.txt +0 -0
  36. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/quantum_debugger.egg-info/top_level.txt +0 -0
  37. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/requirements.txt +0 -0
  38. {quantum_debugger-0.1.1 → quantum_debugger-0.2.1}/setup.cfg +0 -0
@@ -0,0 +1,239 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantum-debugger
3
+ Version: 0.2.1
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/Raunakg2005/quantum-debugger/issues
9
+ Project-URL: Source, https://github.com/Raunakg2005/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
+ [![Documentation](https://img.shields.io/badge/docs-readthedocs-blue)](https://quantum-debugger.readthedocs.io/)
62
+
63
+
64
+ A powerful Python library for step-through debugging, state inspection, and performance analysis of quantum circuits. Now with **production-grade Qiskit integration**!
65
+
66
+ ## ✨ Features
67
+
68
+ - 🐛 **Step-through Debugging** - Execute circuits gate-by-gate with breakpoints
69
+ - 🔍 **State Inspection** - Analyze quantum states at any point
70
+ - 📊 **Circuit Profiling** - Depth analysis, gate statistics, optimization suggestions
71
+ - 🎨 **Visualization** - State vectors, Bloch spheres, and more
72
+ - 🔗 **Qiskit Integration** - Import/export circuits from Qiskit (NEW in v0.2.0!)
73
+ - ✅ **100% Tested** - 88 comprehensive tests, production-ready
74
+
75
+ ## 🚀 Quick Start
76
+
77
+ ### Installation
78
+
79
+ ```bash
80
+ pip install quantum-debugger
81
+ ```
82
+
83
+ ### Basic Usage
84
+
85
+ ```python
86
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
87
+
88
+ # Create a Bell state
89
+ qc = QuantumCircuit(2)
90
+ qc.h(0)
91
+ qc.cnot(0, 1)
92
+
93
+ # Debug step-by-step
94
+ debugger = QuantumDebugger(qc)
95
+ debugger.step() # Execute first gate
96
+ print(debugger.get_current_state())
97
+ debugger.step() # Execute second gate
98
+ print(debugger.get_current_state())
99
+ ```
100
+
101
+ ### Qiskit Integration (NEW!)
102
+
103
+ ```python
104
+ from qiskit import QuantumCircuit as QiskitCircuit
105
+ from quantum_debugger.integrations.qiskit_adapter import QiskitAdapter
106
+
107
+ # Import from Qiskit
108
+ qc_qiskit = QiskitCircuit(2)
109
+ qc_qiskit.h(0)
110
+ qc_qiskit.cx(0, 1)
111
+
112
+ qc_qd = QiskitAdapter.from_qiskit(qc_qiskit)
113
+
114
+ # Debug with our tools
115
+ debugger = QuantumDebugger(qc_qd)
116
+ debugger.add_breakpoint_at_gate(1)
117
+ debugger.continue_execution()
118
+
119
+ # Export back to Qiskit
120
+ qc_back = QiskitAdapter.to_qiskit(qc_qd)
121
+ ```
122
+
123
+ ## 📚 Core Features
124
+
125
+ ### Supported Gates
126
+
127
+ **Single-qubit**: H, X, Y, Z, S, T, RX, RY, RZ, PHASE
128
+ **Two-qubit**: CNOT, CZ, CP (controlled-phase), SWAP
129
+ **Three-qubit**: Toffoli (CCNOT)
130
+
131
+ ### Debugging Features
132
+
133
+ - ✅ Forward/backward stepping
134
+ - ✅ Breakpoints (gate-based & conditional)
135
+ - ✅ Execution history tracking
136
+ - ✅ State comparison
137
+ - ✅ Circuit profiling
138
+
139
+ ### Validated Algorithms
140
+
141
+ Grover's Search • Deutsch-Jozsa • Shor's Period Finding • Quantum Phase Estimation • VQE • Quantum Teleportation • QAOA • Error Correction
142
+
143
+ ## 🎯 Examples
144
+
145
+ ### Debugging Grover's Algorithm
146
+
147
+ ```python
148
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
149
+
150
+ # 2-qubit Grover's
151
+ qc = QuantumCircuit(2)
152
+ qc.h(0).h(1) # Superposition
153
+ qc.cz(0, 1) # Oracle
154
+ qc.h(0).h(1) # Diffusion
155
+ qc.z(0).z(1)
156
+ qc.cz(0, 1)
157
+ qc.h(0).h(1)
158
+
159
+ # Debug with breakpoints
160
+ debugger = QuantumDebugger(qc)
161
+ debugger.add_breakpoint_at_gate(2) # Break after oracle
162
+ debugger.continue_execution()
163
+ print(f"After oracle: {debugger.get_current_state()}")
164
+ ```
165
+
166
+ ### Circuit Profiling
167
+
168
+ ```python
169
+ from quantum_debugger import QuantumCircuit, CircuitProfiler
170
+
171
+ qc = QuantumCircuit(3)
172
+ for i in range(10):
173
+ qc.h(i % 3)
174
+ qc.cnot(i % 3, (i + 1) % 3)
175
+
176
+ profiler = CircuitProfiler(qc)
177
+ metrics = profiler.analyze()
178
+
179
+ print(f"Depth: {metrics.depth}")
180
+ print(f"Gates: {metrics.total_gates}")
181
+ print("Optimization suggestions:")
182
+ for suggestion in profiler.get_optimization_suggestions():
183
+ print(f" • {suggestion}")
184
+ ```
185
+
186
+ ## 📊 Testing & Quality
187
+
188
+ - **88/88 tests passing** (100%)
189
+ - Validated up to **12 qubits** (4,096-D state space)
190
+ - **100+ gate circuits** tested
191
+ - Perfect Qiskit integration fidelity
192
+ - Numerical precision < 1e-10
193
+
194
+ See [TEST_SUMMARY.md](TEST_SUMMARY.md) for details.
195
+
196
+ ## 🔧 Requirements
197
+
198
+ - Python 3.8+
199
+ - NumPy >= 1.21.0
200
+ - SciPy >= 1.7.0
201
+ - Matplotlib >= 3.5.0
202
+ - Qiskit >= 2.0 (optional, for integration features)
203
+
204
+ ## 📖 Documentation
205
+
206
+ - [Examples](examples/) - Interactive demos
207
+ - [Test Summary](TEST_SUMMARY.md) - Complete test coverage
208
+ - [Changelog](CHANGELOG.md) - Version history
209
+ - [Roadmap](ROADMAP.md) - Future features
210
+
211
+ ## 🤝 Contributing
212
+
213
+ Contributions welcome! See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
214
+
215
+ ## 📄 License
216
+
217
+ MIT License - see [LICENSE](LICENSE) file.
218
+
219
+ ## 🌟 What's New in v0.2.0
220
+
221
+ - ✨ **Qiskit Integration** - Bidirectional circuit conversion
222
+ - ✨ **CP Gate** - Controlled-phase gate support
223
+ - ✨ **19 New Tests** - Qiskit integration fully validated
224
+ - ✨ **12-Qubit Support** - Tested on extreme-scale circuits
225
+ - 🐛 **Bug Fixes** - Improved debugger API compatibility
226
+
227
+ ## 🚀 Roadmap
228
+
229
+ - [ ] Noise simulation
230
+ - [ ] Web-based debugger UI
231
+ - [ ] Cirq integration
232
+ - [ ] Hardware backend support
233
+ - [ ] Quantum machine learning tools
234
+
235
+ ---
236
+
237
+ **PyPI**: https://pypi.org/project/quantum-debugger/
238
+ **Author**: warlord9004
239
+ **Version**: 0.2.0
@@ -0,0 +1,187 @@
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
+ [![Documentation](https://img.shields.io/badge/docs-readthedocs-blue)](https://quantum-debugger.readthedocs.io/)
10
+
11
+
12
+ A powerful Python library for step-through debugging, state inspection, and performance analysis of quantum circuits. Now with **production-grade Qiskit integration**!
13
+
14
+ ## ✨ Features
15
+
16
+ - 🐛 **Step-through Debugging** - Execute circuits gate-by-gate with breakpoints
17
+ - 🔍 **State Inspection** - Analyze quantum states at any point
18
+ - 📊 **Circuit Profiling** - Depth analysis, gate statistics, optimization suggestions
19
+ - 🎨 **Visualization** - State vectors, Bloch spheres, and more
20
+ - 🔗 **Qiskit Integration** - Import/export circuits from Qiskit (NEW in v0.2.0!)
21
+ - ✅ **100% Tested** - 88 comprehensive tests, production-ready
22
+
23
+ ## 🚀 Quick Start
24
+
25
+ ### Installation
26
+
27
+ ```bash
28
+ pip install quantum-debugger
29
+ ```
30
+
31
+ ### Basic Usage
32
+
33
+ ```python
34
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
35
+
36
+ # Create a Bell state
37
+ qc = QuantumCircuit(2)
38
+ qc.h(0)
39
+ qc.cnot(0, 1)
40
+
41
+ # Debug step-by-step
42
+ debugger = QuantumDebugger(qc)
43
+ debugger.step() # Execute first gate
44
+ print(debugger.get_current_state())
45
+ debugger.step() # Execute second gate
46
+ print(debugger.get_current_state())
47
+ ```
48
+
49
+ ### Qiskit Integration (NEW!)
50
+
51
+ ```python
52
+ from qiskit import QuantumCircuit as QiskitCircuit
53
+ from quantum_debugger.integrations.qiskit_adapter import QiskitAdapter
54
+
55
+ # Import from Qiskit
56
+ qc_qiskit = QiskitCircuit(2)
57
+ qc_qiskit.h(0)
58
+ qc_qiskit.cx(0, 1)
59
+
60
+ qc_qd = QiskitAdapter.from_qiskit(qc_qiskit)
61
+
62
+ # Debug with our tools
63
+ debugger = QuantumDebugger(qc_qd)
64
+ debugger.add_breakpoint_at_gate(1)
65
+ debugger.continue_execution()
66
+
67
+ # Export back to Qiskit
68
+ qc_back = QiskitAdapter.to_qiskit(qc_qd)
69
+ ```
70
+
71
+ ## 📚 Core Features
72
+
73
+ ### Supported Gates
74
+
75
+ **Single-qubit**: H, X, Y, Z, S, T, RX, RY, RZ, PHASE
76
+ **Two-qubit**: CNOT, CZ, CP (controlled-phase), SWAP
77
+ **Three-qubit**: Toffoli (CCNOT)
78
+
79
+ ### Debugging Features
80
+
81
+ - ✅ Forward/backward stepping
82
+ - ✅ Breakpoints (gate-based & conditional)
83
+ - ✅ Execution history tracking
84
+ - ✅ State comparison
85
+ - ✅ Circuit profiling
86
+
87
+ ### Validated Algorithms
88
+
89
+ Grover's Search • Deutsch-Jozsa • Shor's Period Finding • Quantum Phase Estimation • VQE • Quantum Teleportation • QAOA • Error Correction
90
+
91
+ ## 🎯 Examples
92
+
93
+ ### Debugging Grover's Algorithm
94
+
95
+ ```python
96
+ from quantum_debugger import QuantumCircuit, QuantumDebugger
97
+
98
+ # 2-qubit Grover's
99
+ qc = QuantumCircuit(2)
100
+ qc.h(0).h(1) # Superposition
101
+ qc.cz(0, 1) # Oracle
102
+ qc.h(0).h(1) # Diffusion
103
+ qc.z(0).z(1)
104
+ qc.cz(0, 1)
105
+ qc.h(0).h(1)
106
+
107
+ # Debug with breakpoints
108
+ debugger = QuantumDebugger(qc)
109
+ debugger.add_breakpoint_at_gate(2) # Break after oracle
110
+ debugger.continue_execution()
111
+ print(f"After oracle: {debugger.get_current_state()}")
112
+ ```
113
+
114
+ ### Circuit Profiling
115
+
116
+ ```python
117
+ from quantum_debugger import QuantumCircuit, CircuitProfiler
118
+
119
+ qc = QuantumCircuit(3)
120
+ for i in range(10):
121
+ qc.h(i % 3)
122
+ qc.cnot(i % 3, (i + 1) % 3)
123
+
124
+ profiler = CircuitProfiler(qc)
125
+ metrics = profiler.analyze()
126
+
127
+ print(f"Depth: {metrics.depth}")
128
+ print(f"Gates: {metrics.total_gates}")
129
+ print("Optimization suggestions:")
130
+ for suggestion in profiler.get_optimization_suggestions():
131
+ print(f" • {suggestion}")
132
+ ```
133
+
134
+ ## 📊 Testing & Quality
135
+
136
+ - **88/88 tests passing** (100%)
137
+ - Validated up to **12 qubits** (4,096-D state space)
138
+ - **100+ gate circuits** tested
139
+ - Perfect Qiskit integration fidelity
140
+ - Numerical precision < 1e-10
141
+
142
+ See [TEST_SUMMARY.md](TEST_SUMMARY.md) for details.
143
+
144
+ ## 🔧 Requirements
145
+
146
+ - Python 3.8+
147
+ - NumPy >= 1.21.0
148
+ - SciPy >= 1.7.0
149
+ - Matplotlib >= 3.5.0
150
+ - Qiskit >= 2.0 (optional, for integration features)
151
+
152
+ ## 📖 Documentation
153
+
154
+ - [Examples](examples/) - Interactive demos
155
+ - [Test Summary](TEST_SUMMARY.md) - Complete test coverage
156
+ - [Changelog](CHANGELOG.md) - Version history
157
+ - [Roadmap](ROADMAP.md) - Future features
158
+
159
+ ## 🤝 Contributing
160
+
161
+ Contributions welcome! See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
162
+
163
+ ## 📄 License
164
+
165
+ MIT License - see [LICENSE](LICENSE) file.
166
+
167
+ ## 🌟 What's New in v0.2.0
168
+
169
+ - ✨ **Qiskit Integration** - Bidirectional circuit conversion
170
+ - ✨ **CP Gate** - Controlled-phase gate support
171
+ - ✨ **19 New Tests** - Qiskit integration fully validated
172
+ - ✨ **12-Qubit Support** - Tested on extreme-scale circuits
173
+ - 🐛 **Bug Fixes** - Improved debugger API compatibility
174
+
175
+ ## 🚀 Roadmap
176
+
177
+ - [ ] Noise simulation
178
+ - [ ] Web-based debugger UI
179
+ - [ ] Cirq integration
180
+ - [ ] Hardware backend support
181
+ - [ ] Quantum machine learning tools
182
+
183
+ ---
184
+
185
+ **PyPI**: https://pypi.org/project/quantum-debugger/
186
+ **Author**: warlord9004
187
+ **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.1"
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])