iqm-benchmarks 2.6__py3-none-any.whl → 2.8__py3-none-any.whl

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.

Potentially problematic release.


This version of iqm-benchmarks might be problematic. Click here for more details.

@@ -26,7 +26,6 @@ from .benchmark_definition import (
26
26
  BenchmarkRunResult,
27
27
  )
28
28
  from .circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
29
- from .compressive_gst.compressive_gst import CompressiveGST, GSTConfiguration
30
29
  from .entanglement.ghz import GHZBenchmark, GHZConfiguration
31
30
  from .quantum_volume.clops import CLOPSBenchmark, CLOPSConfiguration
32
31
  from .quantum_volume.quantum_volume import QuantumVolumeBenchmark, QuantumVolumeConfiguration
@@ -47,6 +46,15 @@ AVAILABLE_BENCHMARKS = {
47
46
  MirrorRandomizedBenchmarking.name: MirrorRandomizedBenchmarking,
48
47
  }
49
48
 
49
+ try:
50
+ # Requires dependencies from "project.optional-dependencies.mgst" section to be installed. See "pyproject.toml"
51
+ # file
52
+ from .compressive_gst.compressive_gst import CompressiveGST, GSTConfiguration
53
+
54
+ AVAILABLE_BENCHMARKS.update({CompressiveGST.name: CompressiveGST})
55
+ except ModuleNotFoundError:
56
+ pass
57
+
50
58
  try:
51
59
  # Change here if project is renamed and does not equal the package name
52
60
  dist_name = "iqm-benchmarks"
@@ -58,6 +58,8 @@ class CompressiveGST(Benchmark):
58
58
 
59
59
  analysis_function = staticmethod(mgst_analysis)
60
60
 
61
+ name: str = "compressive_gst"
62
+
61
63
  def __init__(self, backend: IQMBackendBase, configuration: "GSTConfiguration"):
62
64
  """Construct the compressive_gst class.
63
65
 
@@ -102,10 +104,6 @@ class CompressiveGST(Benchmark):
102
104
  self.J = np.empty((self.configuration.num_circuits, self.num_povm))
103
105
  self.bootstrap_results = List[Tuple[np.ndarray]] # List of GST outcomes from bootstrapping
104
106
 
105
- @staticmethod
106
- def name() -> str:
107
- return "compressive_GST"
108
-
109
107
  @timeit
110
108
  def generate_meas_circuits(self) -> None:
111
109
  """Generate random circuits from the gate set
@@ -172,7 +170,7 @@ class CompressiveGST(Benchmark):
172
170
  # Adding configuration entries and class variables, prioritizing the latter in case of conflicts
173
171
  for key, value in (self.configuration.__dict__ | self.__dict__).items():
174
172
  if key == "benchmark": # Avoid saving the class objects
175
- dataset.attrs[key] = value.name()
173
+ dataset.attrs[key] = value.name
176
174
  elif key == "backend":
177
175
  dataset.attrs[key] = value.name
178
176
  else:
@@ -180,6 +180,148 @@ def is_successful(
180
180
  return bool(approximation_ratio > 0.2)
181
181
 
182
182
 
183
+ def get_optimal_angles(num_layers: int) -> List[float]:
184
+ """provides the optimal angles for QAOA MaxCut ansatz given the number of layers
185
+
186
+ Args:
187
+ num_layers (int): number of layers of the QAOA MaxCut ansatz.
188
+
189
+ Returns:
190
+ list[float]: optimal angles for QAOA MaxCut ansatz
191
+ """
192
+
193
+ # Good initial angles from from Wurtz et.al.
194
+ # "The fixed angle conjecture for QAOA on regular MaxCut graphs."
195
+ # arXiv preprint arXiv:2107.00677 (2021).
196
+
197
+ OPTIMAL_INITIAL_ANGLES = {
198
+ "1": [-0.616, 0.393 / 2],
199
+ "2": [-0.488, 0.898 / 2, 0.555 / 2, 0.293 / 2],
200
+ "3": [-0.422, 0.798 / 2, 0.937 / 2, 0.609 / 2, 0.459 / 2, 0.235 / 2],
201
+ "4": [-0.409, 0.781 / 2, 0.988 / 2, 1.156 / 2, 0.600 / 2, 0.434 / 2, 0.297 / 2, 0.159 / 2],
202
+ "5": [-0.36, -0.707, -0.823, -1.005, -1.154, 0.632 / 2, 0.523 / 2, 0.390 / 2, 0.275 / 2, 0.149 / 2],
203
+ "6": [
204
+ -0.331,
205
+ -0.645,
206
+ -0.731,
207
+ -0.837,
208
+ -1.009,
209
+ -1.126,
210
+ 0.636 / 2,
211
+ 0.535 / 2,
212
+ 0.463 / 2,
213
+ 0.360 / 2,
214
+ 0.259 / 2,
215
+ 0.139 / 2,
216
+ ],
217
+ "7": [
218
+ -0.310,
219
+ -0.618,
220
+ -0.690,
221
+ -0.751,
222
+ -0.859,
223
+ -1.020,
224
+ -1.122,
225
+ 0.648 / 2,
226
+ 0.554 / 2,
227
+ 0.490 / 2,
228
+ 0.445 / 2,
229
+ 0.341 / 2,
230
+ 0.244 / 2,
231
+ 0.131 / 2,
232
+ ],
233
+ "8": [
234
+ -0.295,
235
+ -0.587,
236
+ -0.654,
237
+ -0.708,
238
+ -0.765,
239
+ -0.864,
240
+ -1.026,
241
+ -1.116,
242
+ 0.649 / 2,
243
+ 0.555 / 2,
244
+ 0.500 / 2,
245
+ 0.469 / 2,
246
+ 0.420 / 2,
247
+ 0.319 / 2,
248
+ 0.231 / 2,
249
+ 0.123 / 2,
250
+ ],
251
+ "9": [
252
+ -0.279,
253
+ -0.566,
254
+ -0.631,
255
+ -0.679,
256
+ -0.726,
257
+ -0.768,
258
+ -0.875,
259
+ -1.037,
260
+ -1.118,
261
+ 0.654 / 2,
262
+ 0.562 / 2,
263
+ 0.509 / 2,
264
+ 0.487 / 2,
265
+ 0.451 / 2,
266
+ 0.403 / 2,
267
+ 0.305 / 2,
268
+ 0.220 / 2,
269
+ 0.117 / 2,
270
+ ],
271
+ "10": [
272
+ -0.267,
273
+ -0.545,
274
+ -0.610,
275
+ -0.656,
276
+ -0.696,
277
+ -0.729,
278
+ -0.774,
279
+ -0.882,
280
+ -1.044,
281
+ -1.115,
282
+ 0.656 / 2,
283
+ 0.563 / 2,
284
+ 0.514 / 2,
285
+ 0.496 / 2,
286
+ 0.496 / 2,
287
+ 0.436 / 2,
288
+ 0.388 / 2,
289
+ 0.291 / 2,
290
+ 0.211 / 2,
291
+ 0.112 / 2,
292
+ ],
293
+ "11": [
294
+ -0.257,
295
+ -0.528,
296
+ -0.592,
297
+ -0.640,
298
+ -0.677,
299
+ -0.702,
300
+ -0.737,
301
+ -0.775,
302
+ -0.884,
303
+ -1.047,
304
+ -1.115,
305
+ 0.656 / 2,
306
+ 0.563 / 2,
307
+ 0.516 / 2,
308
+ 0.504 / 2,
309
+ 0.482 / 2,
310
+ 0.456 / 2,
311
+ 0.421 / 2,
312
+ 0.371 / 2,
313
+ 0.276 / 2,
314
+ 0.201 / 2,
315
+ 0.107 / 2,
316
+ ],
317
+ }
318
+
319
+ if num_layers > 11:
320
+ raise ValueError("QAOA MaxCut ansatz currently only supports 11 layers")
321
+
322
+ return OPTIMAL_INITIAL_ANGLES[str(num_layers)]
323
+
324
+
183
325
  def plot_approximation_ratios(
184
326
  nodes: list[int],
185
327
  beta_ratio: list[float],
@@ -410,129 +552,7 @@ def run_QAOA(
410
552
  res = minimize(objective_function, opt_angles, method="COBYLA", tol=1e-5, options={"maxiter": 0})
411
553
  else:
412
554
  # Good initial angles from from Wurtz et.al. "The fixed angle conjecture for QAOA on regular MaxCut graphs." arXiv preprint arXiv:2107.00677 (2021).
413
- OPTIMAL_INITIAL_ANGLES = {
414
- "1": [-0.616, 0.393 / 2],
415
- "2": [-0.488, 0.898 / 2, 0.555 / 2, 0.293 / 2],
416
- "3": [-0.422, 0.798 / 2, 0.937 / 2, 0.609 / 2, 0.459 / 2, 0.235 / 2],
417
- "4": [-0.409, 0.781 / 2, 0.988 / 2, 1.156 / 2, 0.600 / 2, 0.434 / 2, 0.297 / 2, 0.159 / 2],
418
- "5": [-0.36, -0.707, -0.823, -1.005, -1.154, 0.632 / 2, 0.523 / 2, 0.390 / 2, 0.275 / 2, 0.149 / 2],
419
- "6": [
420
- -0.331,
421
- -0.645,
422
- -0.731,
423
- -0.837,
424
- -1.009,
425
- -1.126,
426
- 0.636 / 2,
427
- 0.535 / 2,
428
- 0.463 / 2,
429
- 0.360 / 2,
430
- 0.259 / 2,
431
- 0.139 / 2,
432
- ],
433
- "7": [
434
- -0.310,
435
- -0.618,
436
- -0.690,
437
- -0.751,
438
- -0.859,
439
- -1.020,
440
- -1.122,
441
- 0.648 / 2,
442
- 0.554 / 2,
443
- 0.490 / 2,
444
- 0.445 / 2,
445
- 0.341 / 2,
446
- 0.244 / 2,
447
- 0.131 / 2,
448
- ],
449
- "8": [
450
- -0.295,
451
- -0.587,
452
- -0.654,
453
- -0.708,
454
- -0.765,
455
- -0.864,
456
- -1.026,
457
- -1.116,
458
- 0.649 / 2,
459
- 0.555 / 2,
460
- 0.500 / 2,
461
- 0.469 / 2,
462
- 0.420 / 2,
463
- 0.319 / 2,
464
- 0.231 / 2,
465
- 0.123 / 2,
466
- ],
467
- "9": [
468
- -0.279,
469
- -0.566,
470
- -0.631,
471
- -0.679,
472
- -0.726,
473
- -0.768,
474
- -0.875,
475
- -1.037,
476
- -1.118,
477
- 0.654 / 2,
478
- 0.562 / 2,
479
- 0.509 / 2,
480
- 0.487 / 2,
481
- 0.451 / 2,
482
- 0.403 / 2,
483
- 0.305 / 2,
484
- 0.220 / 2,
485
- 0.117 / 2,
486
- ],
487
- "10": [
488
- -0.267,
489
- -0.545,
490
- -0.610,
491
- -0.656,
492
- -0.696,
493
- -0.729,
494
- -0.774,
495
- -0.882,
496
- -1.044,
497
- -1.115,
498
- 0.656 / 2,
499
- 0.563 / 2,
500
- 0.514 / 2,
501
- 0.496 / 2,
502
- 0.496 / 2,
503
- 0.436 / 2,
504
- 0.388 / 2,
505
- 0.291 / 2,
506
- 0.211 / 2,
507
- 0.112 / 2,
508
- ],
509
- "11": [
510
- -0.257,
511
- -0.528,
512
- -0.592,
513
- -0.640,
514
- -0.677,
515
- -0.702,
516
- -0.737,
517
- -0.775,
518
- -0.884,
519
- -1.047,
520
- -1.115,
521
- 0.656 / 2,
522
- 0.563 / 2,
523
- 0.516 / 2,
524
- 0.504 / 2,
525
- 0.482 / 2,
526
- 0.456 / 2,
527
- 0.421 / 2,
528
- 0.371 / 2,
529
- 0.276 / 2,
530
- 0.201 / 2,
531
- 0.107 / 2,
532
- ],
533
- }
534
-
535
- theta = OPTIMAL_INITIAL_ANGLES[str(qaoa_layers)]
555
+ theta = get_optimal_angles(qaoa_layers)
536
556
  bounds = [(-np.pi, np.pi)] * qaoa_layers + [(0.0, np.pi)] * qaoa_layers
537
557
 
538
558
  res = minimize(
@@ -740,6 +760,7 @@ class QScoreBenchmark(Benchmark):
740
760
  execution_results = []
741
761
  graph_list = []
742
762
  qubit_set_list = []
763
+ theta_list = []
743
764
 
744
765
  qcvv_logger.debug(f"Executing on {self.num_instances} random graphs with {num_nodes} nodes.")
745
766
 
@@ -790,7 +811,17 @@ class QScoreBenchmark(Benchmark):
790
811
  raise ValueError('choose_qubits_routine must either be "naive" or "custom".')
791
812
  qubit_set_list.append(qubit_set)
792
813
 
793
- qc = self.generate_maxcut_ansatz(graph, theta=[float(q) for q in qubit_set])
814
+ if self.use_classically_optimized_angles:
815
+ if graph.number_of_edges() != 0:
816
+ theta = calculate_optimal_angles_for_QAOA_p1(graph)
817
+ else:
818
+ theta = [1.0, 1.0]
819
+ else:
820
+ theta = get_optimal_angles(self.num_qaoa_layers)
821
+
822
+ theta_list.append(theta)
823
+
824
+ qc = self.generate_maxcut_ansatz(graph, theta)
794
825
  qc_list.append(qc)
795
826
  qubit_to_node_copy = self.qubit_to_node.copy()
796
827
  qubit_to_node_list.append(qubit_to_node_copy)
@@ -840,6 +871,7 @@ class QScoreBenchmark(Benchmark):
840
871
  "virtual_nodes": virtual_node_list,
841
872
  "qubit_to_node": qubit_to_node_list,
842
873
  "no_edge_instances": no_edge_instances,
874
+ "theta": theta_list,
843
875
  }
844
876
  }
845
877
  )
iqm/benchmarks/utils.py CHANGED
@@ -149,8 +149,13 @@ def get_iqm_backend(backend_label: str) -> IQMBackendBase:
149
149
  IQMBackendBase.
150
150
  """
151
151
  # ****** 5Q star ******
152
+ # Pyrite
153
+ if backend_label.lower() == "pyrite":
154
+ iqm_server_url = "https://cocos.resonance.meetiqm.com/pyrite"
155
+ provider = IQMProvider(iqm_server_url)
156
+ backend_object = provider.get_backend()
152
157
  # FakeAdonis
153
- if backend_label.lower() in ("iqmfakeadonis", "fakeadonis"):
158
+ elif backend_label.lower() in ("iqmfakeadonis", "fakeadonis"):
154
159
  backend_object = IQMFakeAdonis()
155
160
 
156
161
  # ****** 20Q grid ******
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: iqm-benchmarks
3
- Version: 2.6
3
+ Version: 2.8
4
4
  Summary: A package for implementation of Quantum Characterization, Verification and Validation (QCVV) techniques on IQM's hardware at gate level abstraction
5
5
  Author-email: IQM Finland Oy <developers@meetiqm.com>, Aniket Rath <aniket.rath@meetiqm.com>, Jami Rönkkö <jami@meetiqm.com>, Pedro Figueroa Romero <pedro.romero@meetiqm.com>, Vicente Pina Canelles <vicente.pina@meetiqm.com>, Raphael Brieger <raphael.brieger@meetiqm.com>, Stefan Seegerer <stefan.seegerer@meetiqm.com>
6
6
  Project-URL: Homepage, https://github.com/iqm-finland/iqm-benchmarks
@@ -31,11 +31,9 @@ Requires-Dist: tox==4.16.0; extra == "develop"
31
31
  Provides-Extra: examples
32
32
  Requires-Dist: notebook==7.2.1; extra == "examples"
33
33
  Provides-Extra: mgst
34
- Requires-Dist: numpy<2.0; extra == "mgst"
35
- Requires-Dist: cvxpy==1.5.3; extra == "mgst"
36
- Requires-Dist: pygsti==0.9.12.3; extra == "mgst"
37
- Requires-Dist: tqdm==4.66.5; extra == "mgst"
38
34
  Requires-Dist: numba==0.60.0; extra == "mgst"
35
+ Requires-Dist: pygsti[diamond_norm]==0.9.12.3; extra == "mgst"
36
+ Requires-Dist: tqdm==4.66.5; extra == "mgst"
39
37
  Provides-Extra: test
40
38
  Requires-Dist: black==24.4.2; extra == "test"
41
39
  Requires-Dist: isort==5.13.2; extra == "test"
@@ -1,17 +1,17 @@
1
- iqm/benchmarks/__init__.py,sha256=sFDsukGeEKJfTO3kaBli0bz8gSewemon35yHAx7bOQY,2279
1
+ iqm/benchmarks/__init__.py,sha256=Hc0oxTTjCA2QlLJeD7lBBt84l1tFbAF5WkAhP92JmgA,2525
2
2
  iqm/benchmarks/benchmark.py,sha256=SGhBcSxLPUu-cVXAjG4Db2TRobFCRBYoE1NtTDK1lJg,4432
3
3
  iqm/benchmarks/benchmark_definition.py,sha256=AZkvANrf0_0glbq_P_uo_YqbBU9IZa2gJlMVz6qT6VU,10500
4
4
  iqm/benchmarks/circuit_containers.py,sha256=anEtZEsodYqOX-34oZRmuKGeEpp_VfgG5045Mz4-4hI,7562
5
5
  iqm/benchmarks/logging_config.py,sha256=U7olP5Kr75AcLJqNODf9VBhJLVqIvA4AYR6J39D5rww,1052
6
6
  iqm/benchmarks/readout_mitigation.py,sha256=7FlbSH-RJTtQuRYLChwkQV_vBv0ZfMQTH519cAbyxQ4,12252
7
- iqm/benchmarks/utils.py,sha256=BNbPeNNiFfE72Y-coVjLK3O7y7-j1Ag-l_qyBQsxXRY,20278
7
+ iqm/benchmarks/utils.py,sha256=MrGWVB4X037u0XZY68PtIEG8Xud3T0ZKldv2JpeLYD0,20500
8
8
  iqm/benchmarks/compressive_gst/__init__.py,sha256=LneifgYXtcwo2jcXo7GdUEHL6_peipukShhkrdaTRCA,929
9
- iqm/benchmarks/compressive_gst/compressive_gst.py,sha256=LyhuKCq7UvmkcDhgzRm1QuK95eepJlerxqNXuj7llxc,22146
9
+ iqm/benchmarks/compressive_gst/compressive_gst.py,sha256=bG-NdSbiYTqfTGpBZtHqsjepNwUU04VB0wrqg9KH8OA,22104
10
10
  iqm/benchmarks/compressive_gst/gst_analysis.py,sha256=wMsomKcD5bUhfzAsi9NGw5YMkkcZ-pOFYsZvuCyGHRM,35282
11
11
  iqm/benchmarks/entanglement/__init__.py,sha256=9T7prOwqMmFWdb4t6ETAHZXKK5o6FvU2DvVb6WhNi-U,682
12
12
  iqm/benchmarks/entanglement/ghz.py,sha256=e97DMjH-uAuoO7cqoDS_6k7yDr-DjU9soWL2GyTgp8U,40257
13
13
  iqm/benchmarks/optimization/__init__.py,sha256=_ajW_OibYLCtzU5AUv5c2zuuVYn8ZNeZUcUUSIGt51M,747
14
- iqm/benchmarks/optimization/qscore.py,sha256=6I13YbFvFq1RcX4mYTw6S4ALb4Ix9t7gjlRzZbaTARM,34038
14
+ iqm/benchmarks/optimization/qscore.py,sha256=nkvt6zJTQclknBmUaliKP0f6Vtgvx4BvNtgVwT7W-1k,34606
15
15
  iqm/benchmarks/quantum_volume/__init__.py,sha256=i-Q4SpDWELBw7frXnxm1j4wJRcxbIyrS5uEK_v06YHo,951
16
16
  iqm/benchmarks/quantum_volume/clops.py,sha256=j6BPEj1rKBAHigox7nrvaTLyb4iCrHadBl2d1yiETDA,30956
17
17
  iqm/benchmarks/quantum_volume/quantum_volume.py,sha256=PPg1kZA5Lx9b24iFVgP_VcgymI6CsD5LfB5Ppfk8TBM,36814
@@ -36,8 +36,8 @@ mGST/optimization.py,sha256=YHwkzIkYvsZOPjclR-BCQWh24jeqjuXp0BB0WX5Lwow,10559
36
36
  mGST/qiskit_interface.py,sha256=L4H-4SdhP_bjSFFvpQoF1E7EyGbIJ_CI_y4a7_YEwmU,10102
37
37
  mGST/reporting/figure_gen.py,sha256=6Xd8vwfy09hLY1YbJY6TRevuMsQSU4MsWqemly3ZO0I,12970
38
38
  mGST/reporting/reporting.py,sha256=We1cccz9BKbITYcSlZHdmBGdjMWAa1xNZe5tKP-yh_E,26004
39
- iqm_benchmarks-2.6.dist-info/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
40
- iqm_benchmarks-2.6.dist-info/METADATA,sha256=sKrWhTqD0WfOnCXSxidvds1IR2e74v0Gxa_E6eUMxsk,9506
41
- iqm_benchmarks-2.6.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
42
- iqm_benchmarks-2.6.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
43
- iqm_benchmarks-2.6.dist-info/RECORD,,
39
+ iqm_benchmarks-2.8.dist-info/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
40
+ iqm_benchmarks-2.8.dist-info/METADATA,sha256=neTH_5NYUnCBrsllhR-T130J7lpkG7FnFjoD7JHOewg,9433
41
+ iqm_benchmarks-2.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
42
+ iqm_benchmarks-2.8.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
43
+ iqm_benchmarks-2.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.7.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5