azure-quantum 2.2.0.dev5__py3-none-any.whl → 2.3.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.
@@ -80,7 +80,7 @@ class Target(abc.ABC, SessionHost):
80
80
  :type name: str
81
81
  :param input_data_format: Format of input data (ex. "qir.v1")
82
82
  :type input_data_format: str
83
- :param output_data_format: Format of output data (ex. "microsoft.resource-estimates.v1")
83
+ :param output_data_format: Format of output data (ex. "microsoft.quantum-log.v1")
84
84
  :type output_data_format: str
85
85
  :param capability: QIR capability. Deprecated, use `target_profile`
86
86
  :type capability: str
@@ -330,16 +330,6 @@ target '{self.name}' of provider '{self.provider_id}' not found."
330
330
  """
331
331
  return InputParams()
332
332
 
333
- def estimate_cost(
334
- self,
335
- input_data: Any,
336
- input_params: Union[Dict[str, Any], None] = None
337
- ):
338
- """
339
- Estimate the cost for a given circuit.
340
- """
341
- return NotImplementedError("Price estimation is not implemented yet for this target.")
342
-
343
333
  def _get_azure_workspace(self) -> "Workspace":
344
334
  return self.workspace
345
335
 
azure/quantum/version.py CHANGED
@@ -5,4 +5,4 @@
5
5
  # Copyright (c) Microsoft Corporation. All rights reserved.
6
6
  # Licensed under the MIT License.
7
7
  ##
8
- __version__ = "2.2.0.dev5"
8
+ __version__ = "2.3.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: azure-quantum
3
- Version: 2.2.0.dev5
3
+ Version: 2.3.0
4
4
  Summary: Python client for Azure Quantum
5
5
  Home-page: https://github.com/microsoft/azure-quantum-python
6
6
  Author: Microsoft
@@ -27,7 +27,7 @@ Requires-Dist: graphviz>=0.20.1; extra == "all"
27
27
  Requires-Dist: pulser<0.19,>=0.18; extra == "all"
28
28
  Requires-Dist: qiskit-ionq<0.6,>=0.5; extra == "all"
29
29
  Requires-Dist: qsharp[qiskit]<2.0,>=1.9.0; extra == "all"
30
- Requires-Dist: pyqir<0.11,>=0.10.5; extra == "all"
30
+ Requires-Dist: pyqir<0.11,>=0.10.6; extra == "all"
31
31
  Requires-Dist: Markdown<4.0,>=3.4.1; extra == "all"
32
32
  Requires-Dist: python-markdown-math<1.0,>=0.8.0; extra == "all"
33
33
  Requires-Dist: qsharp<2.0,>=1.0.33; extra == "all"
@@ -44,7 +44,7 @@ Requires-Dist: pulser<0.19,>=0.18; extra == "pulser"
44
44
  Provides-Extra: qiskit
45
45
  Requires-Dist: qiskit-ionq<0.6,>=0.5; extra == "qiskit"
46
46
  Requires-Dist: qsharp[qiskit]<2.0,>=1.9.0; extra == "qiskit"
47
- Requires-Dist: pyqir<0.11,>=0.10.5; extra == "qiskit"
47
+ Requires-Dist: pyqir<0.11,>=0.10.6; extra == "qiskit"
48
48
  Requires-Dist: Markdown<4.0,>=3.4.1; extra == "qiskit"
49
49
  Requires-Dist: python-markdown-math<1.0,>=0.8.0; extra == "qiskit"
50
50
  Provides-Extra: qsharp
@@ -2,7 +2,7 @@ azure/quantum/__init__.py,sha256=Za8xZY4lzFkW8m4ero-bqrfN437D2NRukM77ukb4GPM,508
2
2
  azure/quantum/_constants.py,sha256=nDL_QrGdI_Zz_cvTB9nVgfE7J6A_Boo1ollMYqsiEBs,3499
3
3
  azure/quantum/_workspace_connection_params.py,sha256=KoT90U89Dj6pVwAKp_ENJL1hyTF0oQe7w0QioOGvjXg,21685
4
4
  azure/quantum/storage.py,sha256=_4bMniDk9LrB_K5CQwuCivJFZXdmhRvU2b6Z3xxXw9I,12556
5
- azure/quantum/version.py,sha256=Z08War2Liv_5bTLhAAiZ4EsFqKHQu4iUGkLQ5HX6PRk,240
5
+ azure/quantum/version.py,sha256=GEd2ft3bCMWju8VtjXrAo-KCleey7-8UKW4slWuuFhA,235
6
6
  azure/quantum/workspace.py,sha256=1__iZTe59ozAsAGJ4nECxmk_211Dm8ALJi-MFIdrg4o,23438
7
7
  azure/quantum/_authentication/__init__.py,sha256=bniNZlS0hMIjO_y7DevGBAS6MixyA5pbPHcdGipUWM4,236
8
8
  azure/quantum/_authentication/_chained.py,sha256=0rdohB_fVGFHUhlly9sGxqQTBTZGpGxtlBqNHDFbAqE,4848
@@ -14,7 +14,7 @@ azure/quantum/_client/_configuration.py,sha256=5uktKtZxoVVAoSyeL0VNGS9AfPERp-9rU
14
14
  azure/quantum/_client/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
15
15
  azure/quantum/_client/_serialization.py,sha256=KJSS6KWgnKcz-cENQCmWZ9Ziv303lnBbLwFIpYZeKFU,81097
16
16
  azure/quantum/_client/_vendor.py,sha256=h8ByiyZ4cCQyFxqnuhTQdv1Rms3dVjKsrgZDzwMcSJ0,996
17
- azure/quantum/_client/_version.py,sha256=mmo1ypZwkaOTiny7lpDoS6NnhwLrFI5vhNYI_PCTv_Q,500
17
+ azure/quantum/_client/_version.py,sha256=P1f813gUNzQVuJ1KodrFeYe048KTdzHTQu2R3CDqRlg,495
18
18
  azure/quantum/_client/models/__init__.py,sha256=c1PRpzNsQTcDk4GkrFMMIlwNQQa2c0p5N0Lzd-23YBA,2100
19
19
  azure/quantum/_client/models/_enums.py,sha256=omj_B8_E8ONzTHg5hLgDlFYibRRbdr9sEN298im_otA,2977
20
20
  azure/quantum/_client/models/_models.py,sha256=wktCM5oBVfwQetNoHobL1wNsC3knXV-HmqBq_Q77Kw4,41810
@@ -22,15 +22,15 @@ azure/quantum/_client/models/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb
22
22
  azure/quantum/_client/operations/__init__.py,sha256=1mIl1WjHa-yFdX45TZayC1JfYeEPj5v7E2i7vck69qM,1154
23
23
  azure/quantum/_client/operations/_operations.py,sha256=N_96-hfw6dYL3xfOI1mrYiXWAbWhNBNsV8EFpHtjW4U,81928
24
24
  azure/quantum/_client/operations/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
25
- azure/quantum/argument_types/__init__.py,sha256=S3-qpSHPz2d27xrgYbWvnv76OzULIONTp9mSGXu2ATM,271
25
+ azure/quantum/argument_types/__init__.py,sha256=AEDyuUMipR2za248GrRzqxfzr0Ysd8tj2F0OQBSFKWg,255
26
26
  azure/quantum/argument_types/types.py,sha256=2mM8s37DKgNfSsjzwmg4dnmj9roSeHY1ZT5vKnpjAYM,1041
27
27
  azure/quantum/chemistry/__init__.py,sha256=IWy-J-agQviD6GN5Px9c3X6MgMO_QhUKon5ZvQWEHJM,351
28
28
  azure/quantum/cirq/__init__.py,sha256=AJT_qCdxfqgeiPmqmbxQgCzETCOIJyHYoy6pCs-OskQ,227
29
29
  azure/quantum/cirq/job.py,sha256=Wm52HFYel9Di6xGdzDdYfBLM3ZklaE1qOQ9YNg87eeY,3031
30
- azure/quantum/cirq/service.py,sha256=1L2seZt26ENQY973vIa6aex7SsWpCu6YkpClsr6AteY,8880
30
+ azure/quantum/cirq/service.py,sha256=5TcBvdULJJD_KsZna35dWYfkn7EY8Rge0ucnkwgJS3w,7833
31
31
  azure/quantum/cirq/targets/__init__.py,sha256=cpb677Kg1V5cdI0kdgkLafI8xfwYZZYx0tc6qc024gE,574
32
- azure/quantum/cirq/targets/ionq.py,sha256=-M7aL-1XYmV3qF6eUYd-FR800NIEvrcY1Pty5vM7XDc,7101
33
- azure/quantum/cirq/targets/quantinuum.py,sha256=t7L5prczDQJlzStth6Rh6r35DX1Z8J_my-VJxLBp2n4,4537
32
+ azure/quantum/cirq/targets/ionq.py,sha256=PIX6jGgzhfRdXOXuwGxATuiMr_Le0XNEJJ6-Itit_Ws,5998
33
+ azure/quantum/cirq/targets/quantinuum.py,sha256=I0uxYV90jCSq-rttSTHbv7yuruqyxI5FCMJYdhkXhOI,3939
34
34
  azure/quantum/cirq/targets/target.py,sha256=1EEog72dFZoiOTQP7obOrCuO3VH0yjXGAIMeO6bm22o,2184
35
35
  azure/quantum/job/__init__.py,sha256=nFuOsG25a8WzYFLwA2fhA0JMNWtblfDjV5WRgB6UQbw,829
36
36
  azure/quantum/job/base_job.py,sha256=NwtI-dcpOfKp-ANnLAPKQVgT3t9BEv_MQSp1N47oKM0,13876
@@ -41,38 +41,32 @@ azure/quantum/job/session.py,sha256=EEJVKEEB5g0yyH963aaR0GY0Cd0axrX-49gwDWxBcfE,
41
41
  azure/quantum/job/workspace_item.py,sha256=lyBIJCtUfIZMGJYJkX7Se8IDnXhXe4JU0RnqzSuhhI4,1380
42
42
  azure/quantum/job/workspace_item_factory.py,sha256=QRWyrtgcKZqUucJOFi9V_SYMV3lj6S74tGRrPtk3NE0,1200
43
43
  azure/quantum/qiskit/__init__.py,sha256=gjKsmRwtVNcbbsuOvy2wT0ASELh5NXGmuwaEwjZcVQo,314
44
- azure/quantum/qiskit/job.py,sha256=0pwmS-M0lDrSzHUgIrM0yRmEp5cbVPX7Vo1Tar0xAJM,14970
44
+ azure/quantum/qiskit/job.py,sha256=El1wyQ98WZaR96IICkDV8kToRtcA7yG24L2eE9Wdx2c,14539
45
45
  azure/quantum/qiskit/provider.py,sha256=kbZJgDX-hI-AD5rQfik4JHNnNd74oyfrKYauosqBRxw,10966
46
- azure/quantum/qiskit/backends/__init__.py,sha256=DBC6GgYa5Y0p5xu5ADqlOXs7zp8_RDTJ86qKhuzXfG0,1118
47
- azure/quantum/qiskit/backends/backend.py,sha256=wsNri5CtI0rGSpTEzuqIwxebjK1Nop0OyxadSyPH3IQ,24001
48
- azure/quantum/qiskit/backends/ionq.py,sha256=YYR6ELJ7VMw2kUSMQ0VTART0ykJvGgYTQDbfAFdx8Do,14438
49
- azure/quantum/qiskit/backends/microsoft.py,sha256=l6o6u78DhyObX6YBulwoj6OUIj49DZHEjPms-WvQ9H0,6068
46
+ azure/quantum/qiskit/backends/__init__.py,sha256=Ygx3GwVHbIJ9Bi-_KqVQsL7B3QfeL-qUKIMIEfuStGw,994
47
+ azure/quantum/qiskit/backends/backend.py,sha256=pE5FSsLRy6JpfCGDWd7SFcnH8k8qz6-eJRwZ31fh58o,23361
48
+ azure/quantum/qiskit/backends/ionq.py,sha256=YivsJSuLBWmOxpK1qk4aEr1eJvQkWHTG4y8Ak6t-QN8,13781
50
49
  azure/quantum/qiskit/backends/qci.py,sha256=c0YK-znG8TSAnFmeszo7mpKhM624QHszTQoapOqOvHg,4794
51
- azure/quantum/qiskit/backends/quantinuum.py,sha256=r7D3pelIdhczTP5hwpfshK_zi2-E3KFesdi_3dYxYJk,13654
50
+ azure/quantum/qiskit/backends/quantinuum.py,sha256=VjNoBzdmhRizcW7cHzFQWTEvpiftbJtg1FzNCQatuvk,12513
52
51
  azure/quantum/qiskit/backends/rigetti.py,sha256=lTsa0UjPdsAZUvvfnBge7H22TvA7c-_3fU09ZTA4ARs,4146
53
- azure/quantum/qiskit/results/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- azure/quantum/qiskit/results/resource_estimator.py,sha256=pAP5ZpVxdzNekQ_qXfSdSKYWWuqL_Vq7WK6pWU4wbEQ,814
55
52
  azure/quantum/target/__init__.py,sha256=F0nIEJdlbczmxAdtvPDWf8J1Y33_XjPzloliHeWpJos,689
56
- azure/quantum/target/ionq.py,sha256=saPRhYlwyx0tLEtJHWR0K5tE7CUjwnXu_ay17sCKM_Y,8317
53
+ azure/quantum/target/ionq.py,sha256=2iS4H-fBJYRTCM7VJse3Hqya_y2iEuU5QBG3Oj4c-SU,3931
57
54
  azure/quantum/target/params.py,sha256=oI-35HUEMCskNjpxCJU3tjL664K-TxqAg5LA5xU0nso,9130
58
- azure/quantum/target/quantinuum.py,sha256=dogWB2u6XUOhg0VZVoI9GbvDeHa-EQtl05N_iJExEUg,8169
59
- azure/quantum/target/target.py,sha256=jmrFY_CqYAQCMWEfs05MxHq_mUOSyqUGmBwl2cg0XUo,16989
55
+ azure/quantum/target/quantinuum.py,sha256=a8cfthXeR2wE8ktNzgexEmoZ3EBw-VRRwFuPSLATGjI,3207
56
+ azure/quantum/target/target.py,sha256=Iz8GAM-4AjVnKHaI12By1G3wzT5ZUWQau8BVCFU7Vvo,16679
60
57
  azure/quantum/target/target_factory.py,sha256=jjZ9zxWaNDkcvslKV02GSP8rtXwStJ7EmVXQSOFh_j8,5266
61
- azure/quantum/target/microsoft/__init__.py,sha256=36kM2YlWv69AzAfUA5wMdWyYRSaCMwX2Ajhffpzx67g,570
62
- azure/quantum/target/microsoft/job.py,sha256=GM4OA-rxFUqQzsH8V59pVc4BmBaPYvd99E26pyPwxto,1249
63
- azure/quantum/target/microsoft/result.py,sha256=AntJptXKHNRdRR6oxhTlKKPOJVSU7u9fIfH2GXJqfx0,18784
64
- azure/quantum/target/microsoft/target.py,sha256=prjaHSjBQe6kfFSRq8E_SdIaS0SYmu-UbtaKqTKJGfw,18700
58
+ azure/quantum/target/microsoft/target.py,sha256=MlEBPhXYcHPBuORSeoslFgpw31C_cwJBf-xl0F18Jc8,6226
65
59
  azure/quantum/target/microsoft/elements/__init__.py,sha256=gVVpaN5086iuBnajtvTjSd7MLExtnsR6RDCmcgz6xpE,70
66
60
  azure/quantum/target/microsoft/elements/dft/__init__.py,sha256=kCXOA9HT-gb23An-A0eyktlB66VoH6EwNO4gPM97l3U,224
67
- azure/quantum/target/microsoft/elements/dft/job.py,sha256=REDLDF6-HBwB4OxUMrgKfZWCE6W7RWj7HKhiYeH1a-E,2936
68
- azure/quantum/target/microsoft/elements/dft/target.py,sha256=IeFDVh3SqDsQOZmd9UKhl1Qu0ChkOEIHHb5fC5x4YGE,2556
61
+ azure/quantum/target/microsoft/elements/dft/job.py,sha256=6v7lZwXyUGrOI8J17akanMrFXrPVDhsZR3c6AFpa5So,6942
62
+ azure/quantum/target/microsoft/elements/dft/target.py,sha256=I1JBTqsZ_S8rDig2yIJYa6SEthVtgHmDaq5_GVk_Pv4,9018
69
63
  azure/quantum/target/pasqal/__init__.py,sha256=qbe6oWTQTsnTYwY3xZr32z4AWaYIchx71bYlqC2rQqw,348
70
64
  azure/quantum/target/pasqal/result.py,sha256=SUvpnrtgvCGiepmNpyifW8b4p14-SZZ1ToCC0NAdIwg,1463
71
65
  azure/quantum/target/pasqal/target.py,sha256=K_vqavov6gvS84voRKeBx9pO8g4LrtWrlZ5-RMLWozw,5139
72
66
  azure/quantum/target/rigetti/__init__.py,sha256=I1vyzZBYGI540pauTqJd0RSSyTShGqkEL7Yjo25_RNY,378
73
67
  azure/quantum/target/rigetti/result.py,sha256=65mtAZxfdNrTWNjWPqgfwt2BZN6Nllo4g_bls7-Nm68,2334
74
- azure/quantum/target/rigetti/target.py,sha256=75yGp8RYXGX9NWOkqoY_9L7FtUcAlD5KPj92wTn1zYg,7418
75
- azure_quantum-2.2.0.dev5.dist-info/METADATA,sha256=Il--zQ5N4L08RaVT9HOvUPIwm5oXW5C_hleoySn-kgA,7362
76
- azure_quantum-2.2.0.dev5.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
77
- azure_quantum-2.2.0.dev5.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
78
- azure_quantum-2.2.0.dev5.dist-info/RECORD,,
68
+ azure/quantum/target/rigetti/target.py,sha256=rjartYFzD5DulRDLo6Y0XeGlosBcvPiOmmzNVdtDZik,7580
69
+ azure_quantum-2.3.0.dist-info/METADATA,sha256=x93a5w-nEHM8bmk0D5onA5pnSH2WfERXzZx5JHmu--4,7357
70
+ azure_quantum-2.3.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
71
+ azure_quantum-2.3.0.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
72
+ azure_quantum-2.3.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.44.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,161 +0,0 @@
1
- ##
2
- # Copyright (c) Microsoft Corporation.
3
- # Licensed under the MIT License.
4
- ##
5
-
6
- from typing import TYPE_CHECKING, Any, Dict, List, Union
7
- from azure.quantum.version import __version__
8
- from qiskit import QuantumCircuit
9
- from abc import abstractmethod
10
- from .backend import AzureQirBackend, QIR_BASIS_GATES
11
-
12
- from qiskit.providers.models import BackendConfiguration
13
- from qiskit.providers import Options, Provider
14
- from qsharp import TargetProfile
15
- from qsharp.interop.qiskit import ResourceEstimatorBackend
16
- import pyqir as pyqir
17
-
18
- if TYPE_CHECKING:
19
- from azure.quantum.qiskit import AzureQuantumProvider
20
-
21
- import logging
22
-
23
- logger = logging.getLogger(__name__)
24
-
25
- __all__ = ["MicrosoftBackend", "MicrosoftResourceEstimationBackend"]
26
-
27
-
28
- class MicrosoftBackend(AzureQirBackend):
29
- """Base class for interfacing with a Microsoft backend in Azure Quantum"""
30
-
31
- @abstractmethod
32
- def __init__(
33
- self, configuration: BackendConfiguration, provider: Provider = None, **fields
34
- ):
35
- super().__init__(configuration, provider, **fields)
36
-
37
- @classmethod
38
- def _default_options(cls):
39
- return Options(target_profile=TargetProfile.Adaptive_RI)
40
-
41
- def _azure_config(self) -> Dict[str, str]:
42
- config = super()._azure_config()
43
- config.update(
44
- {
45
- "provider_id": "microsoft-qc",
46
- "output_data_format": "microsoft.resource-estimates.v1",
47
- }
48
- )
49
- return config
50
-
51
- def _translate_input(
52
- self,
53
- circuits: Union[QuantumCircuit, List[QuantumCircuit]],
54
- input_params: Dict[str, Any],
55
- ) -> bytes:
56
- """Translates the input values to the QIR expected by the Backend."""
57
- # All the logic is in the base class, but we need to override
58
- # this method to ensure that the bitcode QIR format is used for RE.
59
-
60
- # normal translation is to QIR text format in utf-8 encoded bytes
61
- ir_byte_str = super()._translate_input(circuits, input_params)
62
- # decode the utf-8 encoded bytes to a string
63
- ir_str = ir_byte_str.decode('utf-8')
64
- # convert the QIR text format to QIR bitcode format
65
- module = pyqir.Module.from_ir(pyqir.Context(), ir_str)
66
- return module.bitcode
67
-
68
- def _generate_qir(
69
- self, circuits: List[QuantumCircuit], target_profile: TargetProfile, **kwargs
70
- ) -> pyqir.Module:
71
- if len(circuits) == 0:
72
- raise ValueError("No QuantumCircuits provided")
73
-
74
- name = "circuits"
75
- if isinstance(circuits, QuantumCircuit):
76
- name = circuits.name
77
- circuits = [circuits]
78
- elif isinstance(circuits, list):
79
- for value in circuits:
80
- if not isinstance(value, QuantumCircuit):
81
- raise ValueError(
82
- "Input must be Union[QuantumCircuit, List[QuantumCircuit]]"
83
- )
84
- else:
85
- raise ValueError(
86
- "Input must be Union[QuantumCircuit, List[QuantumCircuit]]"
87
- )
88
-
89
- skip_transpilation = kwargs.pop("skip_transpilation", False)
90
- backend = ResourceEstimatorBackend(
91
- skip_transpilation=skip_transpilation, **kwargs
92
- )
93
- context = pyqir.Context()
94
- llvm_module = pyqir.qir_module(context, name)
95
- for circuit in circuits:
96
- qir_str = backend.qir(circuit, target_profile=target_profile)
97
- module = pyqir.Module.from_ir(context, qir_str)
98
- llvm_module.link(module)
99
-
100
- # Add NOOP for recording output tuples
101
- # the service isn't set up to handle any output recording calls
102
- # and the Q# compiler will always emit them.
103
- noop_tuple_record_output = """; NOOP the extern calls to recording output tuples
104
- define void @__quantum__rt__tuple_record_output(i64, i8*) {
105
- ret void
106
- }"""
107
- noop_tuple_record_output_module = pyqir.Module.from_ir(
108
- context, noop_tuple_record_output
109
- )
110
- llvm_module.link(noop_tuple_record_output_module)
111
-
112
- err = llvm_module.verify()
113
- if err is not None:
114
- raise Exception(err)
115
-
116
- return llvm_module
117
-
118
-
119
- class MicrosoftResourceEstimationBackend(MicrosoftBackend):
120
- """Backend class for interfacing with the resource estimator target"""
121
-
122
- backend_names = ("microsoft.estimator",)
123
-
124
- @classmethod
125
- def _default_options(cls):
126
- return Options(
127
- target_profile=TargetProfile.Adaptive_RI,
128
- errorBudget=1e-3,
129
- qubitParams={"name": "qubit_gate_ns_e3"},
130
- qecScheme={"name": "surface_code"}
131
- )
132
-
133
- def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
134
- """Constructor for class to interface with the resource estimator target"""
135
- default_config = BackendConfiguration.from_dict(
136
- {
137
- "backend_name": name,
138
- "backend_version": __version__,
139
- "simulator": True,
140
- "local": False,
141
- "coupling_map": None,
142
- "description": "Resource estimator on Azure Quantum",
143
- "basis_gates": QIR_BASIS_GATES,
144
- "memory": False,
145
- "n_qubits": 0xFFFFFFFFFFFFFFFF, # NOTE: maximum 64-bit unsigned value
146
- "conditional": True,
147
- "max_shots": 1,
148
- "max_experiments": 1,
149
- "open_pulse": False,
150
- "gates": [
151
- {"name": "TODO", "parameters": [], "qasm_def": "TODO"}
152
- ], # NOTE: copied from other backends
153
- "azure": self._azure_config(),
154
- "is_default": True,
155
- }
156
- )
157
- logger.info("Initializing MicrosoftResourceEstimationBackend")
158
- configuration: BackendConfiguration = kwargs.pop(
159
- "configuration", default_config
160
- )
161
- super().__init__(configuration=configuration, provider=provider, **kwargs)
File without changes
@@ -1,25 +0,0 @@
1
- #!/bin/env python
2
- # -*- coding: utf-8 -*-
3
- ##
4
- # resource_estimator.py: Qiskit result for microsoft.estimator target.
5
- ##
6
- # Copyright (c) Microsoft Corporation. All rights reserved.
7
- # Licensed under the MIT License.
8
- ##
9
- from azure.quantum.target.microsoft import MicrosoftEstimatorResult
10
-
11
-
12
- def make_estimator_result(data):
13
- if not data["success"]:
14
- error_data = data["error_data"]
15
- message = "Cannot retrieve results as job execution failed " \
16
- f"({error_data['code']}: {error_data['message']})"
17
-
18
- raise RuntimeError(message)
19
-
20
- results = data["results"]
21
- if len(results) == 1:
22
- data = results[0]['data']
23
- return MicrosoftEstimatorResult(data)
24
- else:
25
- raise ValueError("Expected Qiskit results for RE be of length 1")
@@ -1,15 +0,0 @@
1
- ##
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License.
4
- ##
5
-
6
- """Defines classes for interacting with Microsoft Estimator"""
7
-
8
- __all__ = ["ErrorBudgetPartition", "MicrosoftEstimator",
9
- "MicrosoftEstimatorJob", "MicrosoftEstimatorResult",
10
- "MicrosoftEstimatorParams", "QECScheme", "QubitParams"]
11
-
12
- from .job import MicrosoftEstimatorJob
13
- from .result import MicrosoftEstimatorResult
14
- from .target import ErrorBudgetPartition, MicrosoftEstimator, \
15
- MicrosoftEstimatorParams, QECScheme, QubitParams
@@ -1,35 +0,0 @@
1
- ##
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License.
4
- ##
5
- from ... import Job
6
- from ...job.base_job import DEFAULT_TIMEOUT
7
- from ..._client.models import JobDetails
8
- from .result import MicrosoftEstimatorResult
9
-
10
- class MicrosoftEstimatorJob(Job):
11
- """
12
- A dedicated job class for jobs from the microsoft.estimator target.
13
- """
14
-
15
- def __init__(self, workspace, job_details: JobDetails, **kwargs):
16
- super().__init__(workspace, job_details, **kwargs)
17
-
18
- def get_results(self, timeout_secs: float = DEFAULT_TIMEOUT) -> MicrosoftEstimatorResult:
19
- """
20
- Get estimation result.
21
-
22
- :param timeout_secs: Timeout in seconds, defaults to 300 sec.
23
- :type timeout_secs: float
24
- :return: Estimation result
25
- :rtype: MicrosoftEstimatorResult
26
- """
27
- try:
28
- results = super().get_results(timeout_secs)
29
- return MicrosoftEstimatorResult(results)
30
- except RuntimeError:
31
- error_obj = self.details.error_data
32
- message = "Cannot retrieve results as job execution failed " \
33
- f"({error_obj.code}: {error_obj.message})"
34
- raise RuntimeError(message)
35
-