iqm-client 29.6.0__py3-none-any.whl → 29.8.0__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.
@@ -21,9 +21,17 @@ from typing import Any
21
21
  from uuid import UUID
22
22
  import warnings
23
23
 
24
- from iqm.iqm_client import Circuit, CircuitCompilationOptions, CircuitValidationError, IQMClient, RunRequest
24
+ from iqm.iqm_client import (
25
+ Circuit,
26
+ CircuitCompilationOptions,
27
+ CircuitValidationError,
28
+ IQMClient,
29
+ RunRequest,
30
+ )
25
31
  from iqm.iqm_client.util import to_json_dict
32
+ from iqm.qiskit_iqm import IQMFakeAphrodite, IQMFakeApollo, IQMFakeDeneb
26
33
  from iqm.qiskit_iqm.fake_backends import IQMFakeAdonis
34
+ from iqm.qiskit_iqm.fake_backends.fake_garnet import IQMFakeGarnet
27
35
  from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
28
36
  from iqm.qiskit_iqm.iqm_job import IQMJob
29
37
  from iqm.qiskit_iqm.qiskit_to_iqm import serialize_instructions
@@ -257,26 +265,31 @@ class IQMBackend(IQMBackendBase):
257
265
  return Circuit(name=circuit.name, instructions=instructions, metadata=metadata)
258
266
 
259
267
 
268
+ facade_names = {
269
+ "facade_adonis": IQMFakeAdonis(),
270
+ "facade_aphrodite": IQMFakeAphrodite(),
271
+ "facade_apollo": IQMFakeApollo(),
272
+ "facade_deneb": IQMFakeDeneb(),
273
+ "facade_garnet": IQMFakeGarnet(),
274
+ }
275
+
276
+
260
277
  class IQMFacadeBackend(IQMBackend):
261
- """Facade backend for mimicking the execution of quantum circuits on IQM quantum computers. Allows to submit a
262
- circuit to the IQM server, and if the execution was successful, performs a simulation with a respective IQM noise
263
- model locally, then returns the simulated results.
278
+ """Simulates the execution of quantum circuits on a mock IQM quantum computer.
279
+
280
+ Can be used to submit a circuit to a mock IQM server that has no real quantum hardware,
281
+ and if the mock execution is successful, simulates the circuit locally using an error model that
282
+ is representative of the mocked QPU. Finally returns the simulated results.
264
283
 
265
284
  Args:
266
- client: client instance for communicating with an IQM server
267
- **kwargs: optional arguments to be passed to the parent Backend initializer
285
+ client: Client instance for communicating with an IQM server.
286
+ **kwargs: Optional arguments to be passed to the parent class.
268
287
 
269
288
  """
270
289
 
271
290
  def __init__(self, client: IQMClient, **kwargs):
272
- self.fake_adonis = IQMFakeAdonis()
273
- target_architecture = client.get_static_quantum_architecture()
274
-
275
- if not self.fake_adonis.validate_compatible_architecture(target_architecture):
276
- raise ValueError("Quantum architecture of the remote quantum computer does not match Adonis.")
277
-
278
291
  super().__init__(client, **kwargs)
279
- self.name = "facade_adonis"
292
+ self.backend = self._determine_facade_backend_from_sqa()
280
293
 
281
294
  def _validate_no_empty_cregs(self, circuit: QuantumCircuit) -> bool:
282
295
  """Returns True if given circuit has no empty (unused) classical registers, False otherwise."""
@@ -289,6 +302,12 @@ class IQMFacadeBackend(IQMBackend):
289
302
  return False
290
303
  return True
291
304
 
305
+ def _determine_facade_backend_from_sqa(self) -> IQMFacadeBackend:
306
+ for backend in facade_names.values():
307
+ if backend.validate_compatible_architecture(self.client.get_static_quantum_architecture()):
308
+ return backend
309
+ raise ValueError("Quantum architecture of the remote quantum computer does not match facade input.")
310
+
292
311
  def run(self, run_input: QuantumCircuit | list[QuantumCircuit], **options) -> JobV1:
293
312
  circuits = [run_input] if isinstance(run_input, QuantumCircuit) else run_input
294
313
  circuits_validated_cregs: list[bool] = [self._validate_no_empty_cregs(circuit) for circuit in circuits]
@@ -302,7 +321,7 @@ class IQMFacadeBackend(IQMBackend):
302
321
  iqm_backend_job.result() # get and discard results
303
322
  if iqm_backend_job.status() == JobStatus.ERROR:
304
323
  raise RuntimeError("Remote execution did not succeed.")
305
- return self.fake_adonis.run(run_input, **options)
324
+ return self.backend.run(run_input, **options)
306
325
 
307
326
 
308
327
  class IQMProvider:
@@ -336,7 +355,9 @@ class IQMProvider:
336
355
  client = IQMClient(self.url, **self.user_auth_args)
337
356
 
338
357
  if name and name.startswith("facade_"):
339
- if name == "facade_adonis":
358
+ if name in facade_names:
359
+ if not facade_names[name].validate_compatible_architecture(client.get_static_quantum_architecture()):
360
+ raise ValueError("Quantum architecture of the remote quantum computer does not match facade input.")
340
361
  return IQMFacadeBackend(client)
341
362
 
342
363
  warnings.warn(f"Unknown facade backend: {name}. A regular backend associated with {self.url} will be used.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-client
3
- Version: 29.6.0
3
+ Version: 29.8.0
4
4
  Summary: Client library for accessing an IQM quantum computer
5
5
  Author-email: IQM Finland Oy <developers@meetiqm.com>
6
6
  License: Apache License
@@ -39,7 +39,7 @@ iqm/qiskit_iqm/iqm_circuit_validation.py,sha256=vE5CNyJOQ7OMRpQV-xsO1uf_NNFE8v6-
39
39
  iqm/qiskit_iqm/iqm_job.py,sha256=_JF2DANalsRu4b0r-XxMmTNOqmaShjp1rmU7h44DKRo,11466
40
40
  iqm/qiskit_iqm/iqm_move_layout.py,sha256=pHqV1G4bri3rFEsMBN6FrtQ0FXVNQG-Ymm4v7zdnilQ,10787
41
41
  iqm/qiskit_iqm/iqm_naive_move_pass.py,sha256=HoLPgkRK7X2g8KM2ML5-rggNE5HIfGEzq4vkthYSPyg,12398
42
- iqm/qiskit_iqm/iqm_provider.py,sha256=aZG3OfbG1YT9584p1EtIPuSvl6Z8Vdx_3GlHasRzmqg,15842
42
+ iqm/qiskit_iqm/iqm_provider.py,sha256=TjrpZZIAI2_K3pWG6sn30M3jFfEDAWp64_4pDis0OU8,16589
43
43
  iqm/qiskit_iqm/iqm_transpilation.py,sha256=2bwvVd8NwBRU6gwlPOsovhyAmUnm8thKokvkuCwfWC8,8915
44
44
  iqm/qiskit_iqm/move_gate.py,sha256=QU9RKKVvbGq33qcIi9AKLcvQVQMibkgW4ibjzk-oVy4,2808
45
45
  iqm/qiskit_iqm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -56,10 +56,10 @@ iqm/qiskit_iqm/fake_backends/fake_apollo.py,sha256=eT2vd3kQBi1rrvxCpePymBCfFK84d
56
56
  iqm/qiskit_iqm/fake_backends/fake_deneb.py,sha256=RzQXmLXmBARDiMKVxk5Aw9fVbc6IYlW0A5jibk9iYD0,3156
57
57
  iqm/qiskit_iqm/fake_backends/fake_garnet.py,sha256=GI0xafTCj1Um09qVuccO6GPOGBm6ygul_O40Wu220Ys,5555
58
58
  iqm/qiskit_iqm/fake_backends/iqm_fake_backend.py,sha256=wJtfsxjPYbDKmzaz5R4AuaXvvPHa21WyPtRgNctL9eY,16785
59
- iqm_client-29.6.0.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
60
- iqm_client-29.6.0.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
61
- iqm_client-29.6.0.dist-info/METADATA,sha256=JQ1QQ4RIgig2IvWRLIE7r5hLU-76qXRNmZxRUj4eVJ4,17590
62
- iqm_client-29.6.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
63
- iqm_client-29.6.0.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
64
- iqm_client-29.6.0.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
65
- iqm_client-29.6.0.dist-info/RECORD,,
59
+ iqm_client-29.8.0.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
60
+ iqm_client-29.8.0.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
61
+ iqm_client-29.8.0.dist-info/METADATA,sha256=TholVIUEaPzDgpCB1RP4lJe0q8GzFq62V8BypJ22-JQ,17590
62
+ iqm_client-29.8.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
63
+ iqm_client-29.8.0.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
64
+ iqm_client-29.8.0.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
65
+ iqm_client-29.8.0.dist-info/RECORD,,