quantum-debugger 0.2.2__tar.gz → 0.4.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.
- quantum_debugger-0.4.0/PKG-INFO +430 -0
- quantum_debugger-0.4.0/README.md +378 -0
- quantum_debugger-0.4.0/examples/benchmarks.py +224 -0
- quantum_debugger-0.4.0/examples/qaoa_maxcut_example.py +138 -0
- quantum_debugger-0.4.0/examples/qml_basic_example.py +160 -0
- quantum_debugger-0.4.0/examples/vqe_h2_example.py +104 -0
- quantum_debugger-0.4.0/quantum_debugger/__init__.py +93 -0
- quantum_debugger-0.4.0/quantum_debugger/backends/__init__.py +125 -0
- quantum_debugger-0.4.0/quantum_debugger/backends/base.py +93 -0
- quantum_debugger-0.4.0/quantum_debugger/backends/cupy_backend.py +137 -0
- quantum_debugger-0.4.0/quantum_debugger/backends/numba_backend.py +140 -0
- quantum_debugger-0.4.0/quantum_debugger/backends/numpy_backend.py +56 -0
- quantum_debugger-0.4.0/quantum_debugger/backends/sparse_backend.py +151 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/core/circuit.py +126 -5
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/core/quantum_state.py +5 -1
- quantum_debugger-0.4.0/quantum_debugger/mitigation/__init__.py +28 -0
- quantum_debugger-0.4.0/quantum_debugger/mitigation/core/__init__.py +12 -0
- quantum_debugger-0.4.0/quantum_debugger/mitigation/core/extrapolator.py +293 -0
- quantum_debugger-0.4.0/quantum_debugger/mitigation/core/folder.py +282 -0
- quantum_debugger-0.4.0/quantum_debugger/mitigation/zne.py +209 -0
- quantum_debugger-0.4.0/quantum_debugger/noise/__init__.py +70 -0
- quantum_debugger-0.4.0/quantum_debugger/noise/composite_noise.py +54 -0
- quantum_debugger-0.4.0/quantum_debugger/noise/hardware_profiles.py +411 -0
- quantum_debugger-0.4.0/quantum_debugger/noise/noise_helpers.py +95 -0
- quantum_debugger-0.4.0/quantum_debugger/noise/noise_models.py +312 -0
- quantum_debugger-0.4.0/quantum_debugger/noise/stochastic_sampler.py +167 -0
- quantum_debugger-0.4.0/quantum_debugger/parallel/__init__.py +12 -0
- quantum_debugger-0.4.0/quantum_debugger/parallel/executor.py +164 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/__init__.py +31 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/algorithms/__init__.py +11 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/algorithms/qaoa.py +196 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/algorithms/vqe.py +220 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/ansatz/__init__.py +158 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/gates/__init__.py +5 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/gates/parameterized.py +175 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/hamiltonians/__init__.py +10 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/hamiltonians/molecular.py +107 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/optimizers/__init__.py +219 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/training/__init__.py +138 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/utils/__init__.py +3 -0
- quantum_debugger-0.4.0/quantum_debugger/qml/utils/gradients.py +146 -0
- quantum_debugger-0.4.0/quantum_debugger.egg-info/PKG-INFO +430 -0
- quantum_debugger-0.4.0/quantum_debugger.egg-info/SOURCES.txt +68 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger.egg-info/requires.txt +4 -4
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/setup.py +14 -14
- quantum_debugger-0.2.2/PKG-INFO +0 -239
- quantum_debugger-0.2.2/README.md +0 -187
- quantum_debugger-0.2.2/quantum_debugger/__init__.py +0 -42
- quantum_debugger-0.2.2/quantum_debugger.egg-info/PKG-INFO +0 -239
- quantum_debugger-0.2.2/quantum_debugger.egg-info/SOURCES.txt +0 -32
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/CHANGELOG.md +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/LICENSE +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/MANIFEST.in +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/examples/bell_state_debug.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/examples/grover_profiling.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/examples/interactive_demo.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/examples/qiskit_integration_demo.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/core/__init__.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/core/gates.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/debugger/__init__.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/debugger/breakpoints.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/debugger/debugger.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/debugger/inspector.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/integrations/__init__.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/integrations/qiskit_adapter.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/profiler/__init__.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/profiler/metrics.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/profiler/profiler.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/visualization/__init__.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/visualization/bloch_sphere.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger/visualization/state_viz.py +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger.egg-info/dependency_links.txt +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/quantum_debugger.egg-info/top_level.txt +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/requirements.txt +0 -0
- {quantum_debugger-0.2.2 → quantum_debugger-0.4.0}/setup.cfg +0 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quantum-debugger
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Interactive quantum circuit debugger and Quantum Machine Learning library with VQE, QAOA, and parameterized gates
|
|
5
|
+
Home-page: https://github.com/Raunakg2005/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://github.com/Raunakg2005/quantum-debugger#readme
|
|
11
|
+
Keywords: quantum computing debugging profiling quantum-circuit visualization qml vqe qaoa machine-learning
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
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.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: numpy>=1.20.0
|
|
27
|
+
Requires-Dist: scipy>=1.7.0
|
|
28
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
29
|
+
Provides-Extra: qiskit
|
|
30
|
+
Requires-Dist: qiskit>=2.0.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: mypy>=0.990; 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
|
+
# Quantum Debugger
|
|
54
|
+
|
|
55
|
+
**Interactive debugger, profiler, and quantum machine learning library for quantum circuits**
|
|
56
|
+
|
|
57
|
+
[](https://pypi.org/project/quantum-debugger/)
|
|
58
|
+
[]()
|
|
59
|
+
[]()
|
|
60
|
+
[]()
|
|
61
|
+
|
|
62
|
+
A powerful Python library for quantum circuit debugging, state inspection, performance analysis, and **quantum machine learning**. Now with VQE, QAOA, and parameterized quantum circuits!
|
|
63
|
+
|
|
64
|
+
## ✨ What's New in v0.4.0
|
|
65
|
+
|
|
66
|
+
**Quantum Machine Learning Module** 🚀
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from quantum_debugger.qml import VQE, h2_hamiltonian, hardware_efficient_ansatz
|
|
70
|
+
|
|
71
|
+
# Find H2 molecule ground state
|
|
72
|
+
H = h2_hamiltonian()
|
|
73
|
+
vqe = VQE(H, hardware_efficient_ansatz, num_qubits=2)
|
|
74
|
+
result = vqe.run(initial_params)
|
|
75
|
+
print(f"Ground state energy: {result['ground_state_energy']:.6f} Hartree")
|
|
76
|
+
# Accuracy: < 1% error from exact solution
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**New Features:**
|
|
80
|
+
- ✅ **Parameterized Gates** (RX, RY, RZ with trainable parameters)
|
|
81
|
+
- ✅ **VQE** (Variational Quantum Eigensolver for chemistry)
|
|
82
|
+
- ✅ **QAOA** (Quantum optimization for MaxCut problems)
|
|
83
|
+
- ✅ **Training Framework** (Adam, SGD, SPSA, RMSprop optimizers)
|
|
84
|
+
- ✅ **Gradient Computation** (Parameter shift rule, finite differences)
|
|
85
|
+
- ✅ **316 comprehensive tests** (100% passing)
|
|
86
|
+
|
|
87
|
+
See full [QML Documentation](#quantum-machine-learning-v040) below.
|
|
88
|
+
|
|
89
|
+
## Features
|
|
90
|
+
|
|
91
|
+
### Core Debugging
|
|
92
|
+
- **Step-through Debugging** - Execute circuits gate-by-gate with breakpoints
|
|
93
|
+
- **State Inspection** - Analyze quantum states at any point
|
|
94
|
+
- **Circuit Profiling** - Depth analysis, gate statistics, optimization suggestions
|
|
95
|
+
- **Visualization** - State vectors, Bloch spheres, and more
|
|
96
|
+
- **Noise Simulation** - Realistic hardware noise models
|
|
97
|
+
- **Qiskit Integration** - Import/export circuits from Qiskit
|
|
98
|
+
|
|
99
|
+
### Quantum Machine Learning (NEW v0.4.0)
|
|
100
|
+
- **Parameterized Circuits** - Trainable quantum gates
|
|
101
|
+
- **VQE** - Molecular ground state finding
|
|
102
|
+
- **QAOA** - Combinatorial optimization
|
|
103
|
+
- **Training & Optimization** - 4 classical optimizers
|
|
104
|
+
- **Ansatz Library** - 4 pre-built quantum circuit templates
|
|
105
|
+
|
|
106
|
+
## Quick Start
|
|
107
|
+
|
|
108
|
+
### Installation
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
pip install quantum-debugger
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Basic Circuit Debugging
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from quantum_debugger import QuantumCircuit, QuantumDebugger
|
|
118
|
+
|
|
119
|
+
# Create a Bell state
|
|
120
|
+
qc = QuantumCircuit(2)
|
|
121
|
+
qc.h(0)
|
|
122
|
+
qc.cnot(0, 1)
|
|
123
|
+
|
|
124
|
+
# Debug step-by-step
|
|
125
|
+
debugger = QuantumDebugger(qc)
|
|
126
|
+
debugger.step() # Execute first gate
|
|
127
|
+
print(debugger.get_current_state())
|
|
128
|
+
debugger.step() # Execute second gate
|
|
129
|
+
print(debugger.get_current_state())
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Quantum Machine Learning
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from quantum_debugger.qml import RXGate, RYGate, RZGate
|
|
136
|
+
|
|
137
|
+
# Parameterized quantum gate
|
|
138
|
+
rx = RXGate(target=0, parameter=0.5, trainable=True)
|
|
139
|
+
matrix = rx.matrix() # 2x2 unitary matrix
|
|
140
|
+
|
|
141
|
+
# Update parameter during training
|
|
142
|
+
rx.parameter = 0.7
|
|
143
|
+
new_matrix = rx.matrix() # Automatically cached for performance
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Quantum Machine Learning (v0.4.0)
|
|
147
|
+
|
|
148
|
+
### 1. Parameterized Gates
|
|
149
|
+
|
|
150
|
+
**Rotation gates with trainable parameters:**
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from quantum_debugger.qml import RXGate, RYGate, RZGate
|
|
154
|
+
|
|
155
|
+
# Three rotation gate types
|
|
156
|
+
rx = RXGate(0, theta=0.5, trainable=True) # Rotation about X-axis
|
|
157
|
+
ry = RYGate(0, theta=0.3, trainable=True) # Rotation about Y-axis
|
|
158
|
+
rz = RZGate(0, theta=0.7, trainable=True) # Rotation about Z-axis
|
|
159
|
+
|
|
160
|
+
# Get unitary matrix
|
|
161
|
+
U = rx.matrix() # 2x2 complex array
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Features:**
|
|
165
|
+
- Matrix caching (100-1000x speedup)
|
|
166
|
+
- Thread-safe operations
|
|
167
|
+
- Parameter validation
|
|
168
|
+
- Gradient tracking
|
|
169
|
+
|
|
170
|
+
### 2. VQE (Variational Quantum Eigensolver)
|
|
171
|
+
|
|
172
|
+
**Find ground state energy of molecules:**
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from quantum_debugger.qml import VQE, h2_hamiltonian, hardware_efficient_ansatz
|
|
176
|
+
import numpy as np
|
|
177
|
+
|
|
178
|
+
# Setup H2 molecule Hamiltonian
|
|
179
|
+
H = h2_hamiltonian() # 2 qubits, chemistry-accurate
|
|
180
|
+
|
|
181
|
+
# Create VQE instance
|
|
182
|
+
vqe = VQE(
|
|
183
|
+
hamiltonian=H,
|
|
184
|
+
ansatz_builder=hardware_efficient_ansatz,
|
|
185
|
+
num_qubits=2,
|
|
186
|
+
optimizer='COBYLA',
|
|
187
|
+
max_iterations=100
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
# Run optimization
|
|
191
|
+
initial_params = np.random.rand(2)
|
|
192
|
+
result = vqe.run(initial_params)
|
|
193
|
+
|
|
194
|
+
print(f"Ground state energy: {result['ground_state_energy']:.6f} Hartree")
|
|
195
|
+
print(f"Optimal parameters: {result['optimal_params']}")
|
|
196
|
+
print(f"Iterations: {result['iterations']}")
|
|
197
|
+
|
|
198
|
+
# Compare with exact solution
|
|
199
|
+
exact = vqe.exact_ground_state()
|
|
200
|
+
error = abs(result['ground_state_energy'] - exact)
|
|
201
|
+
print(f"Error from exact: {error:.6f} Hartree")
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Available Ansätze:**
|
|
205
|
+
- `hardware_efficient_ansatz` - RY rotations with CNOTs
|
|
206
|
+
- `real_amplitudes_ansatz` - Real-valued states
|
|
207
|
+
- `ucc_singlet_ansatz` - Chemistry-inspired
|
|
208
|
+
- `alternating_layered_ansatz` - RX and RY layers
|
|
209
|
+
|
|
210
|
+
### 3. QAOA (Quantum Approximate Optimization)
|
|
211
|
+
|
|
212
|
+
**Solve MaxCut on graphs:**
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
from quantum_debugger.qml import QAOA
|
|
216
|
+
|
|
217
|
+
# Define graph (list of edges)
|
|
218
|
+
graph = [(0, 1), (1, 2), (2, 3), (3, 0)] # Square graph
|
|
219
|
+
|
|
220
|
+
# Create QAOA instance
|
|
221
|
+
qaoa = QAOA(
|
|
222
|
+
graph=graph,
|
|
223
|
+
p=2, # 2 QAOA layers
|
|
224
|
+
optimizer='COBYLA',
|
|
225
|
+
max_iterations=50
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
# Run optimization
|
|
229
|
+
result = qaoa.run()
|
|
230
|
+
|
|
231
|
+
print(f"Best cut value: {result['best_value']:.2f}")
|
|
232
|
+
print(f"Optimal parameters: {result['optimal_params']}")
|
|
233
|
+
print(f"Approximation ratio: {result['best_value']/4:.1%}") # 4 is optimal for square
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Supported graph topologies:**
|
|
237
|
+
- Complete graphs, Cycles, Stars
|
|
238
|
+
- Line graphs, Custom graphs
|
|
239
|
+
- Disconnected graphs
|
|
240
|
+
|
|
241
|
+
### 4. Training & Optimization
|
|
242
|
+
|
|
243
|
+
**Classical optimizers for quantum circuits:**
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
from quantum_debugger.qml.optimizers import Adam, GradientDescent, SPSA
|
|
247
|
+
from quantum_debugger.qml.utils.gradients import parameter_shift_gradient
|
|
248
|
+
|
|
249
|
+
# Adam optimizer
|
|
250
|
+
optimizer = Adam(learning_rate=0.01)
|
|
251
|
+
|
|
252
|
+
# Training loop
|
|
253
|
+
params = np.array([0.5, 0.3])
|
|
254
|
+
for epoch in range(100):
|
|
255
|
+
# Compute gradients
|
|
256
|
+
grad = parameter_shift_gradient(circuit_builder, cost_function, params, 0)
|
|
257
|
+
|
|
258
|
+
# Update parameters
|
|
259
|
+
params = optimizer.step(params, grad)
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Available optimizers:**
|
|
263
|
+
- **Adam** - Adaptive learning rates (recommended)
|
|
264
|
+
- **SGD** - Stochastic gradient descent
|
|
265
|
+
- **SPSA** - Gradient-free, noise-tolerant
|
|
266
|
+
- **RMSprop** - Adaptive learning
|
|
267
|
+
|
|
268
|
+
**Gradient methods:**
|
|
269
|
+
- **Parameter shift rule** - Exact for quantum gates
|
|
270
|
+
- **Finite differences** - General purpose
|
|
271
|
+
|
|
272
|
+
### 5. Training Framework
|
|
273
|
+
|
|
274
|
+
**Complete training workflow:**
|
|
275
|
+
|
|
276
|
+
```python
|
|
277
|
+
from quantum_debugger.qml.training import QuantumTrainer
|
|
278
|
+
|
|
279
|
+
def circuit_builder(params):
|
|
280
|
+
gates = []
|
|
281
|
+
gates.append(RYGate(0, params[0]))
|
|
282
|
+
gates.append(RXGate(1, params[1]))
|
|
283
|
+
return gates
|
|
284
|
+
|
|
285
|
+
def cost_function(circuit):
|
|
286
|
+
# Your cost calculation
|
|
287
|
+
return energy
|
|
288
|
+
|
|
289
|
+
# Create trainer
|
|
290
|
+
trainer = QuantumTrainer(
|
|
291
|
+
circuit_builder=circuit_builder,
|
|
292
|
+
cost_function=cost_function,
|
|
293
|
+
optimizer='adam',
|
|
294
|
+
learning_rate=0.01,
|
|
295
|
+
gradient_method='parameter_shift'
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
# Train
|
|
299
|
+
result = trainer.train(
|
|
300
|
+
initial_params=np.random.rand(2),
|
|
301
|
+
epochs=100,
|
|
302
|
+
verbose=True
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
print(f"Final loss: {result['final_loss']:.6f}")
|
|
306
|
+
print(f"Training history: {len(result['history'])} epochs")
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## 📚 Core Features
|
|
310
|
+
|
|
311
|
+
### Supported Gates
|
|
312
|
+
|
|
313
|
+
**Single-qubit:** H, X, Y, Z, S, T, RX, RY, RZ, PHASE
|
|
314
|
+
**Two-qubit:** CNOT, CZ, CP (controlled-phase), SWAP
|
|
315
|
+
**Three-qubit:** Toffoli (CCNOT)
|
|
316
|
+
|
|
317
|
+
### Debugging Features
|
|
318
|
+
|
|
319
|
+
- ✅ Forward/backward stepping
|
|
320
|
+
- ✅ Breakpoints (gate-based & conditional)
|
|
321
|
+
- ✅ Execution history tracking
|
|
322
|
+
- ✅ State comparison
|
|
323
|
+
- ✅ Circuit profiling
|
|
324
|
+
|
|
325
|
+
### Noise Simulation (v0.3.0)
|
|
326
|
+
|
|
327
|
+
```python
|
|
328
|
+
from quantum_debugger import QuantumCircuit
|
|
329
|
+
from quantum_debugger.noise import IBM_PERTH_2025
|
|
330
|
+
|
|
331
|
+
# Simulate on IBM hardware
|
|
332
|
+
qc = QuantumCircuit(2, noise_model=IBM_PERTH_2025.noise_model)
|
|
333
|
+
qc.h(0).cnot(0, 1)
|
|
334
|
+
results = qc.run(shots=1000)
|
|
335
|
+
print(f"Fidelity: {results['fidelity']:.4f}")
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
**Available noise models:**
|
|
339
|
+
- Depolarizing, Amplitude/Phase Damping, Thermal Relaxation
|
|
340
|
+
- Hardware profiles: IBM, Google, IonQ, Rigetti
|
|
341
|
+
|
|
342
|
+
## 🧪 Testing & Quality
|
|
343
|
+
|
|
344
|
+
- **316/316 tests passing** (100%)
|
|
345
|
+
- Core logic, integration, regression, property-based tests
|
|
346
|
+
- Validated up to **12 qubits** (4,096-D state space)
|
|
347
|
+
- Numerical precision < 1e-10
|
|
348
|
+
- Cross-platform (Windows/Linux/macOS)
|
|
349
|
+
- Python 3.9-3.12 compatible
|
|
350
|
+
|
|
351
|
+
See [test files](.) for details.
|
|
352
|
+
|
|
353
|
+
## 🔧 Requirements
|
|
354
|
+
|
|
355
|
+
- Python 3.9+
|
|
356
|
+
- NumPy >= 1.20.0
|
|
357
|
+
- SciPy >= 1.7.0
|
|
358
|
+
- Matplotlib >= 3.5.0 (optional, for visualization)
|
|
359
|
+
- Qiskit >= 2.0 (optional, for integration)
|
|
360
|
+
|
|
361
|
+
## 📖 Documentation
|
|
362
|
+
|
|
363
|
+
- **Tutorials:**
|
|
364
|
+
- [Parameterized Gates Tutorial](tutorials/parameterized_gates_tutorial.md)
|
|
365
|
+
- [VQE Preparation Guide](tutorials/vqe_preparation.md)
|
|
366
|
+
- [QAOA Tutorial](tutorials/qaoa_tutorial.md)
|
|
367
|
+
|
|
368
|
+
- **Examples:**
|
|
369
|
+
- [VQE H2 Molecule](examples/vqe_h2_example.py)
|
|
370
|
+
- [QAOA MaxCut](examples/qaoa_maxcut_example.py)
|
|
371
|
+
- [Performance Benchmarks](examples/benchmarks.py)
|
|
372
|
+
|
|
373
|
+
## 📈 Version History
|
|
374
|
+
|
|
375
|
+
**v0.4.0** (December 2024) - Quantum Machine Learning
|
|
376
|
+
- ✅ Parameterized gates (RX, RY, RZ)
|
|
377
|
+
- ✅ VQE algorithm for molecular chemistry
|
|
378
|
+
- ✅ QAOA for combinatorial optimization
|
|
379
|
+
- ✅ Training framework with 4 optimizers
|
|
380
|
+
- ✅ Gradient computation (parameter shift, finite differences)
|
|
381
|
+
- ✅ 316 comprehensive tests
|
|
382
|
+
- ✅ 3 tutorials, 4 example scripts
|
|
383
|
+
|
|
384
|
+
**v0.3.0** (December 2024) - Noise Simulation
|
|
385
|
+
- Realistic noise models (4 types)
|
|
386
|
+
- Hardware profiles (IBM, Google, IonQ, Rigetti)
|
|
387
|
+
- Qiskit Aer validation
|
|
388
|
+
- 89 new tests
|
|
389
|
+
|
|
390
|
+
**v0.2.0** - Qiskit Integration
|
|
391
|
+
- Bidirectional circuit conversion
|
|
392
|
+
- CP gate support
|
|
393
|
+
- 12-qubit support
|
|
394
|
+
|
|
395
|
+
**v0.1.0** - Foundation
|
|
396
|
+
- Core quantum simulation
|
|
397
|
+
- Basic debugging features
|
|
398
|
+
|
|
399
|
+
## 🗺️ Roadmap
|
|
400
|
+
|
|
401
|
+
**v0.5.0** (Q1 2025) - Advanced QML
|
|
402
|
+
- [ ] Quantum Neural Networks (QNN)
|
|
403
|
+
- [ ] More molecular Hamiltonians (LiH, H2O)
|
|
404
|
+
- [ ] Error mitigation integration
|
|
405
|
+
- [ ] GPU acceleration
|
|
406
|
+
|
|
407
|
+
**v1.0.0** (Future)
|
|
408
|
+
- [ ] Real hardware backend support
|
|
409
|
+
- [ ] Advanced visualization dashboards
|
|
410
|
+
- [ ] Quantum error correction tools
|
|
411
|
+
- [ ] Production deployment tools
|
|
412
|
+
|
|
413
|
+
## 🤝 Contributing
|
|
414
|
+
|
|
415
|
+
Contributions welcome! Please ensure tests pass:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
pytest test_*.py -v
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## 📄 License
|
|
422
|
+
|
|
423
|
+
MIT License - see [LICENSE](LICENSE) file.
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
**PyPI:** https://pypi.org/project/quantum-debugger/
|
|
428
|
+
**Author:** warlord9004
|
|
429
|
+
**Version:** 0.4.0
|
|
430
|
+
**Python:** 3.9+
|