Commit 86f768b
Qiskit 2 support (#326)
* fix some primitive imports
* remove unnecessary import
* unfix qiskit version
* fix BackendProperties
* black
* fix parallel sampler estimator imports
* fix clbit import
* fix imports in optree
* add sympy requirement
* use pennylane target
* us sympify instead of _symbol_expr
* use if_test instead of c_if
* clean build_circuit_instructions
* use recursive call to build_pennylane_circuit
* fix some imports
* add qulacs target
* fix parameter and condition access in qulacs circuit
* use draw to check if circuit is correct
* fix condition checks
* split executor tests
* adapt executor tests
* catch empty observable error
* use np allclose in optree derivative test
* use pure numerical expected gradients
* Initial plan
* Fix non-linear parameter detection in optree derivative
- Add check to detect when parameters appear in non-linear functions
- Parameter shift rule only works for linear/affine parameter dependencies
- Updated tests to remove non-linear arccos(x[0]) from test circuits
- Added new test to verify non-linear parameters raise ValueError
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* Drop Python 3.9 support to align with qiskit-machine-learning 0.9.0
- Update minimum Python version to 3.10
- Remove Python 3.9 from CI workflows
- Remove autoray pinning for Python 3.9
- Remove old Qiskit version tests (0.46, 1.x)
- Update classifiers in pyproject.toml
This change is necessary because qiskit-machine-learning 0.9.0
dropped Python 3.9 support when migrating to Qiskit 2.0.
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* Address code review feedback
- Use multiple test values (0.3, 0.7) for non-linearity check
- Relax tolerance from 1e-10 to 1e-8 for floating-point precision
- Add comment explaining larger tolerance for second derivatives
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* Address review feedback: Keep Python 3.9, add 3.14, use sympy for polynomial check
- Keep Python 3.9 minimum version in pyproject.toml
- Add Python 3.14 to all test matrices
- Restore Python 3.9 for minimal requirements test
- Add Qiskit 1.x compatibility test
- Update Python classifiers to include 3.9 and 3.14
- Replace numerical gradient check with sympy-based polynomial degree check
- Use second derivative to determine if parameter enters gate linearly
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* Update minimum qiskit version to 1.0.0 to fix Target.num_qubits issue
- Update qiskit>=1.0.0 (was >=0.45.0) - fixes Target.num_qubits=None bug
- Update qiskit-aer>=0.13.0 (was >=0.12.0) - for qiskit 1.0 compatibility
- Update qiskit-ibm-runtime>=0.20.0 (was >=0.18.0) - for qiskit 1.0 compatibility
- Update documentation to reflect new minimum versions
The issue was that qiskit 0.45.0's Target.from_configuration() creates
a Target without num_qubits, causing TypeError when transpiling with
targets in pennylane_circuit.py.
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* Remove Python 3.14 from test matrices due to qulacs build issues
- Remove Python 3.14 from quick_tests.yaml
- Remove Python 3.14 from elaborate_tests.yaml (full, Windows, macOS)
- Update Python 3.14 -> 3.13 for Windows and macOS tests
- Remove Python 3.14 from classifiers in pyproject.toml
Python 3.14 cannot build qulacs (C++ extension) from source due to
missing Boost dependencies, causing all 3.14 tests to fail.
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* use different encoding circuit in test
* black
* Improve polynomial degree check using sympy.Poly and update qiskit 1.x test
- Use sympy.Poly to check polynomial degree instead of second derivative
- Use ParameterExpression.sympify() to convert to sympy expressions
- Catch PolynomialError and GeneratorsNeeded for non-polynomial functions
- Update qiskit 1.x test to use latest versions:
- qiskit: 1.1.2 -> 1.4.5
- qiskit-aer: (implicit) -> 0.15.1
- qiskit-algorithms: 0.3.0 -> 0.3.1
- qiskit-ibm-runtime: 0.27.1 -> 0.45.1
This approach is more direct and mathematically sound - it explicitly
checks if the expression is a polynomial and its degree, rather than
inferring from the second derivative.
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* black
* use argnum/s as arg to accomodate both
* use 3.13 in qiskit 1 test
* use n_local
* fix parallel sampler output
* double wrap sympify
* check if condition is not None
* reset shots after setting
* qiskit version shenanigans
* remove qiskit<1 support
* remove qiskit smaller 1 from tests
* fix mark error
* black
* new black
* update example
* Initial plan
* Implement review comments from PR #326
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* fix example
* Add tests for if_else gate handling in PennyLaneCircuit
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* black examples
* black
* Initial plan
* Apply review comments from PR #326 review 3845990151
Co-authored-by: MoritzWillmann <44642314+MoritzWillmann@users.noreply.github.com>
* fix tests
* fix qiskit version dependencies
* add black jupyter to pyproject toml
* fix minimal tests
* adress review comments
* adress review comments
* fix bitstring handling qiskit<2
---------
Co-authored-by: David Kreplin <david.kreplin@ipa.fraunhofer.de>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>1 parent 14fddc6 commit 86f768b
36 files changed
Lines changed: 1766 additions & 960 deletions
File tree
- .github/workflows
- docs
- install
- user_guide
- examples
- encoding_circuits
- executor
- qnn
- src/squlearn
- encoding_circuit/circuit_library
- kernel/lowlevel_kernel
- qnn/lowlevel_qnn
- util
- execution
- optree
- pennylane
- qulacs
- tests
- encoding_circuit/circuit_library
- qnn
- lowlevel_qnn
- util
- execution
- optree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 44 | | |
68 | 45 | | |
69 | 46 | | |
| |||
72 | 49 | | |
73 | 50 | | |
74 | 51 | | |
75 | | - | |
| 52 | + | |
76 | 53 | | |
77 | 54 | | |
78 | 55 | | |
79 | 56 | | |
80 | 57 | | |
81 | | - | |
| 58 | + | |
82 | 59 | | |
83 | 60 | | |
84 | 61 | | |
| |||
94 | 71 | | |
95 | 72 | | |
96 | 73 | | |
97 | | - | |
| 74 | + | |
98 | 75 | | |
99 | 76 | | |
100 | 77 | | |
| |||
111 | 88 | | |
112 | 89 | | |
113 | 90 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 91 | | |
120 | 92 | | |
121 | 93 | | |
| |||
136 | 108 | | |
137 | 109 | | |
138 | 110 | | |
139 | | - | |
| 111 | + | |
140 | 112 | | |
141 | 113 | | |
142 | 114 | | |
| |||
152 | 124 | | |
153 | 125 | | |
154 | 126 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | 127 | | |
160 | 128 | | |
161 | 129 | | |
| |||
170 | 138 | | |
171 | 139 | | |
172 | 140 | | |
173 | | - | |
| 141 | + | |
174 | 142 | | |
175 | 143 | | |
176 | 144 | | |
| |||
187 | 155 | | |
188 | 156 | | |
189 | 157 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | 158 | | |
196 | 159 | | |
197 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | 38 | | |
44 | 39 | | |
45 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 68 | + | |
79 | 69 | | |
80 | 70 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
85 | 75 | | |
86 | 76 | | |
87 | 77 | | |
| |||
98 | 88 | | |
99 | 89 | | |
100 | 90 | | |
101 | | - | |
| 91 | + | |
102 | 92 | | |
103 | 93 | | |
104 | 94 | | |
| |||
206 | 196 | | |
207 | 197 | | |
208 | 198 | | |
209 | | - | |
| 199 | + | |
210 | 200 | | |
211 | 201 | | |
212 | 202 | | |
| |||
224 | 214 | | |
225 | 215 | | |
226 | 216 | | |
227 | | - | |
| 217 | + | |
228 | 218 | | |
229 | 219 | | |
230 | 220 | | |
| |||
260 | 250 | | |
261 | 251 | | |
262 | 252 | | |
263 | | - | |
| 253 | + | |
264 | 254 | | |
265 | 255 | | |
266 | 256 | | |
| |||
292 | 282 | | |
293 | 283 | | |
294 | 284 | | |
295 | | - | |
| 285 | + | |
296 | 286 | | |
297 | 287 | | |
298 | 288 | | |
299 | 289 | | |
300 | 290 | | |
301 | 291 | | |
302 | | - | |
| 292 | + | |
303 | 293 | | |
304 | 294 | | |
305 | 295 | | |
| |||
347 | 337 | | |
348 | 338 | | |
349 | 339 | | |
350 | | - | |
| 340 | + | |
351 | 341 | | |
352 | 342 | | |
353 | 343 | | |
354 | 344 | | |
355 | 345 | | |
356 | | - | |
| 346 | + | |
357 | 347 | | |
358 | 348 | | |
359 | | - | |
| 349 | + | |
360 | 350 | | |
361 | 351 | | |
362 | 352 | | |
| |||
380 | 370 | | |
381 | 371 | | |
382 | 372 | | |
383 | | - | |
| 373 | + | |
384 | 374 | | |
385 | 375 | | |
386 | 376 | | |
| |||
416 | 406 | | |
417 | 407 | | |
418 | 408 | | |
419 | | - | |
| 409 | + | |
420 | 410 | | |
421 | 411 | | |
422 | 412 | | |
| |||
427 | 417 | | |
428 | 418 | | |
429 | 419 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | 420 | | |
439 | 421 | | |
440 | 422 | | |
441 | 423 | | |
442 | | - | |
| 424 | + | |
443 | 425 | | |
444 | 426 | | |
445 | 427 | | |
| |||
472 | 454 | | |
473 | 455 | | |
474 | 456 | | |
475 | | - | |
| 457 | + | |
476 | 458 | | |
477 | 459 | | |
478 | 460 | | |
| |||
486 | 468 | | |
487 | 469 | | |
488 | 470 | | |
489 | | - | |
| 471 | + | |
490 | 472 | | |
491 | 473 | | |
492 | 474 | | |
| |||
Large diffs are not rendered by default.
0 commit comments