azure-quantum 3.1.1.dev1__py3-none-any.whl → 3.1.1.dev2__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.
@@ -6,4 +6,4 @@
6
6
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  # --------------------------------------------------------------------------
8
8
 
9
- VERSION = "3.1.1.dev1"
9
+ VERSION = "3.1.1.dev2"
@@ -2,6 +2,7 @@
2
2
  # Copyright (c) Microsoft Corporation.
3
3
  # Licensed under the MIT License.
4
4
  ##
5
+ import json
5
6
  import numpy as np
6
7
 
7
8
  from typing import TYPE_CHECKING, Any, Dict, Sequence
@@ -97,7 +98,7 @@ class QuantinuumTarget(Quantinuum, CirqTarget):
97
98
  metadata = {
98
99
  "qubits": len(program.all_qubits()),
99
100
  "repetitions": repetitions,
100
- "measurement_dict": self._measurement_dict(program)
101
+ "measurement_dict": json.dumps(self._measurement_dict(program))
101
102
  }
102
103
  # Override metadata with value from kwargs
103
104
  metadata.update(kwargs.get("metadata", {}))
@@ -27,6 +27,8 @@ from qiskit_ionq.helpers import (
27
27
  if TYPE_CHECKING:
28
28
  from azure.quantum.qiskit import AzureQuantumProvider
29
29
 
30
+ import json
31
+
30
32
  import logging
31
33
 
32
34
  logger = logging.getLogger(__name__)
@@ -244,7 +246,7 @@ class IonQBackend(AzureBackend):
244
246
  _, _, meas_map = qiskit_circ_to_ionq_circ(circuit, gateset=self.gateset())
245
247
 
246
248
  metadata = super()._prepare_job_metadata(circuit, **kwargs)
247
- metadata["meas_map"] = meas_map
249
+ metadata["meas_map"] = json.dumps(meas_map)
248
250
 
249
251
  return metadata
250
252
 
@@ -250,4 +250,4 @@ class InputParams(InputParamsItem):
250
250
  if len(self.file_uris) > 0:
251
251
  result["fileUris"] = self.file_uris
252
252
 
253
- return result
253
+ return result
@@ -84,7 +84,7 @@ class Target(abc.ABC, SessionHost):
84
84
  :type output_data_format: str
85
85
  :param capability: QIR capability. Deprecated, use `target_profile`
86
86
  :type capability: str
87
- :param provider_id: Id of provider (ex. "microsoft-qc")
87
+ :param provider_id: Id of provider
88
88
  :type provider_id: str
89
89
  :param content_type: "Content-Type" attribute value to set on input blob (ex. "application/json")
90
90
  :type content_type: azure.quantum.job.ContentType
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__ = "3.1.1.dev1"
8
+ __version__ = "3.1.1.dev2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: azure-quantum
3
- Version: 3.1.1.dev1
3
+ Version: 3.1.1.dev2
4
4
  Summary: Python client for Azure Quantum
5
5
  Home-page: https://github.com/microsoft/azure-quantum-python
6
6
  Author: Microsoft
@@ -14,7 +14,7 @@ Requires-Dist: azure-core<2.0,>=1.30
14
14
  Requires-Dist: azure-identity<2.0,>=1.17
15
15
  Requires-Dist: azure-storage-blob==12.20
16
16
  Requires-Dist: msrest<1.0,>=0.7.1
17
- Requires-Dist: numpy<2.0,>=1.21.0
17
+ Requires-Dist: numpy>=1.21.0
18
18
  Requires-Dist: deprecated<2.0,>=1.2.12
19
19
  Requires-Dist: Markdown>=3.4.1
20
20
  Requires-Dist: python-markdown-math>=0.8
@@ -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=Y_psyrHjJR5bGGquHM90OWLzA14e8OOs1xIuo2zzye4,240
5
+ azure/quantum/version.py,sha256=kT6iAQuQmH3npEp-1ZuHMptXDTtsxidS3dtm45LNU2U,240
6
6
  azure/quantum/workspace.py,sha256=9oO4vjwIn1pdHFLZCQcEPQ_xjQjTNO4UIWSBQpj6Cgo,35574
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=FFUHJPp6X0015GpD-YLmYCoq8GI86nHCn
14
14
  azure/quantum/_client/_model_base.py,sha256=hu7OdRS2Ra1igfBo-R3zS3dzO3YhFC4FGHJ_WiyZgNg,43736
15
15
  azure/quantum/_client/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
16
16
  azure/quantum/_client/_serialization.py,sha256=bBl0y0mh-0sDd-Z8_dj921jQQhqhYWTOl59qSLuk01M,86686
17
- azure/quantum/_client/_version.py,sha256=0I-JGT0Q9PmYSn-3lUL_C1sY91HhoawnrJg5rrhcNok,500
17
+ azure/quantum/_client/_version.py,sha256=IweYXjVZv-WgI1yIRbwCoSP6EMpm2MDBFQBQCF6m3OU,500
18
18
  azure/quantum/_client/py.typed,sha256=dcrsqJrcYfTX-ckLFJMTaj6mD8aDe2u0tkQG-ZYxnEg,26
19
19
  azure/quantum/_client/models/__init__.py,sha256=MR2av7s_tCP66hicN9JXCmTngJ4_-ozM4cmblGjPwn8,1971
20
20
  azure/quantum/_client/models/_enums.py,sha256=RNCPXxeae4d7wtPqcSxu5JZBLFLZZYVZbALjui_f1fM,4288
@@ -25,13 +25,12 @@ azure/quantum/_client/operations/_operations.py,sha256=EL4c4l1t6VwdIay8_V2PomXYd
25
25
  azure/quantum/_client/operations/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
26
26
  azure/quantum/argument_types/__init__.py,sha256=AEDyuUMipR2za248GrRzqxfzr0Ysd8tj2F0OQBSFKWg,255
27
27
  azure/quantum/argument_types/types.py,sha256=2mM8s37DKgNfSsjzwmg4dnmj9roSeHY1ZT5vKnpjAYM,1041
28
- azure/quantum/chemistry/__init__.py,sha256=IWy-J-agQviD6GN5Px9c3X6MgMO_QhUKon5ZvQWEHJM,351
29
28
  azure/quantum/cirq/__init__.py,sha256=AJT_qCdxfqgeiPmqmbxQgCzETCOIJyHYoy6pCs-OskQ,227
30
29
  azure/quantum/cirq/job.py,sha256=Wm52HFYel9Di6xGdzDdYfBLM3ZklaE1qOQ9YNg87eeY,3031
31
30
  azure/quantum/cirq/service.py,sha256=5TcBvdULJJD_KsZna35dWYfkn7EY8Rge0ucnkwgJS3w,7833
32
31
  azure/quantum/cirq/targets/__init__.py,sha256=cpb677Kg1V5cdI0kdgkLafI8xfwYZZYx0tc6qc024gE,574
33
32
  azure/quantum/cirq/targets/ionq.py,sha256=PIX6jGgzhfRdXOXuwGxATuiMr_Le0XNEJJ6-Itit_Ws,5998
34
- azure/quantum/cirq/targets/quantinuum.py,sha256=I0uxYV90jCSq-rttSTHbv7yuruqyxI5FCMJYdhkXhOI,3939
33
+ azure/quantum/cirq/targets/quantinuum.py,sha256=IQYMQes9PZkgxhUb2nZ1hIzStWWhnSUJMXkMGNBdztQ,3964
35
34
  azure/quantum/cirq/targets/target.py,sha256=1EEog72dFZoiOTQP7obOrCuO3VH0yjXGAIMeO6bm22o,2184
36
35
  azure/quantum/job/__init__.py,sha256=nFuOsG25a8WzYFLwA2fhA0JMNWtblfDjV5WRgB6UQbw,829
37
36
  azure/quantum/job/base_job.py,sha256=GDwoJDxoaCwGz9TBuzlkuqXdU84L6FliO_2YWxnLnrE,14399
@@ -46,17 +45,16 @@ azure/quantum/qiskit/job.py,sha256=El1wyQ98WZaR96IICkDV8kToRtcA7yG24L2eE9Wdx2c,1
46
45
  azure/quantum/qiskit/provider.py,sha256=kbZJgDX-hI-AD5rQfik4JHNnNd74oyfrKYauosqBRxw,10966
47
46
  azure/quantum/qiskit/backends/__init__.py,sha256=Ygx3GwVHbIJ9Bi-_KqVQsL7B3QfeL-qUKIMIEfuStGw,994
48
47
  azure/quantum/qiskit/backends/backend.py,sha256=pE5FSsLRy6JpfCGDWd7SFcnH8k8qz6-eJRwZ31fh58o,23361
49
- azure/quantum/qiskit/backends/ionq.py,sha256=YivsJSuLBWmOxpK1qk4aEr1eJvQkWHTG4y8Ak6t-QN8,13781
48
+ azure/quantum/qiskit/backends/ionq.py,sha256=exXdWL63CxlIIiK4bfSFpJCKXzJgjLKz5OL7CvOB0iE,13808
50
49
  azure/quantum/qiskit/backends/qci.py,sha256=c0YK-znG8TSAnFmeszo7mpKhM624QHszTQoapOqOvHg,4794
51
50
  azure/quantum/qiskit/backends/quantinuum.py,sha256=1ThH4mmk4CUG-2RTvwsFEXQ3TEvHPJnW7Lo6QYpC3QE,12705
52
51
  azure/quantum/qiskit/backends/rigetti.py,sha256=lTsa0UjPdsAZUvvfnBge7H22TvA7c-_3fU09ZTA4ARs,4146
53
52
  azure/quantum/target/__init__.py,sha256=F0nIEJdlbczmxAdtvPDWf8J1Y33_XjPzloliHeWpJos,689
54
53
  azure/quantum/target/ionq.py,sha256=2iS4H-fBJYRTCM7VJse3Hqya_y2iEuU5QBG3Oj4c-SU,3931
55
- azure/quantum/target/params.py,sha256=oI-35HUEMCskNjpxCJU3tjL664K-TxqAg5LA5xU0nso,9130
54
+ azure/quantum/target/params.py,sha256=Txpq_AKdVV8OeZjK1z48CIym--_a6wncorj4LmmlQ_E,9128
56
55
  azure/quantum/target/quantinuum.py,sha256=5xvYb0Q2KSQr6FJ_A1bc2904Gz6NF_Xmn8UJ79NMOZU,3306
57
- azure/quantum/target/target.py,sha256=Iz8GAM-4AjVnKHaI12By1G3wzT5ZUWQau8BVCFU7Vvo,16679
56
+ azure/quantum/target/target.py,sha256=jmB4mU32rQIViJ_Zq5qYh-ktLr9vv_vz-sKpvR8GY-M,16658
58
57
  azure/quantum/target/target_factory.py,sha256=jjZ9zxWaNDkcvslKV02GSP8rtXwStJ7EmVXQSOFh_j8,5266
59
- azure/quantum/target/microsoft/target.py,sha256=MlEBPhXYcHPBuORSeoslFgpw31C_cwJBf-xl0F18Jc8,6226
60
58
  azure/quantum/target/microsoft/elements/__init__.py,sha256=gVVpaN5086iuBnajtvTjSd7MLExtnsR6RDCmcgz6xpE,70
61
59
  azure/quantum/target/microsoft/elements/dft/__init__.py,sha256=kCXOA9HT-gb23An-A0eyktlB66VoH6EwNO4gPM97l3U,224
62
60
  azure/quantum/target/microsoft/elements/dft/job.py,sha256=6v7lZwXyUGrOI8J17akanMrFXrPVDhsZR3c6AFpa5So,6942
@@ -67,7 +65,7 @@ azure/quantum/target/pasqal/target.py,sha256=K_vqavov6gvS84voRKeBx9pO8g4LrtWrlZ5
67
65
  azure/quantum/target/rigetti/__init__.py,sha256=I1vyzZBYGI540pauTqJd0RSSyTShGqkEL7Yjo25_RNY,378
68
66
  azure/quantum/target/rigetti/result.py,sha256=65mtAZxfdNrTWNjWPqgfwt2BZN6Nllo4g_bls7-Nm68,2334
69
67
  azure/quantum/target/rigetti/target.py,sha256=5C8p7CVKKXsaBM0BLFA4MrBwvLtY5INp4GQsE9t4P1U,7407
70
- azure_quantum-3.1.1.dev1.dist-info/METADATA,sha256=lOFlc52x-uH1_jcrzhcu9pKNagQjX_5tz6MosANo_QE,7364
71
- azure_quantum-3.1.1.dev1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
72
- azure_quantum-3.1.1.dev1.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
73
- azure_quantum-3.1.1.dev1.dist-info/RECORD,,
68
+ azure_quantum-3.1.1.dev2.dist-info/METADATA,sha256=MkoZOkF6W1Ctm5W0mQ_f5z0i-7m6wUSvyOe-s7xCCoU,7359
69
+ azure_quantum-3.1.1.dev2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
70
+ azure_quantum-3.1.1.dev2.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
71
+ azure_quantum-3.1.1.dev2.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- ##
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License.
4
- ##
5
-
6
- from urllib.request import urlopen
7
-
8
- def df_chemistry() -> bytes:
9
- """
10
- Returns bitcode of a QIR program for the double-factorized chemistry
11
- quantum algorithm.
12
- """
13
- return urlopen("https://aka.ms/RE/df_chemistry").read()
@@ -1,142 +0,0 @@
1
- ##
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License.
4
- ##
5
- import re
6
- import warnings
7
- from dataclasses import dataclass, field
8
- from typing import Any, Dict, Optional, Type, Union, List
9
-
10
- from ...job import Job
11
- from ...job.base_job import ContentType
12
- from ...workspace import Workspace
13
- from ..params import InputParams, InputParamsItem, AutoValidatingParams, \
14
- validating_field
15
- from ..target import Target
16
-
17
- def _check_error_rate(name, value):
18
- if value <= 0.0 or value >= 1.0:
19
- raise ValueError(f"{name} must be between 0 and 1")
20
-
21
- def _check_error_rate_or_process_and_readout(name, value):
22
- if value is None:
23
- return
24
-
25
- if isinstance(value, float):
26
- _check_error_rate(name, value)
27
- return
28
-
29
- if not isinstance(value, MeasurementErrorRate):
30
- raise ValueError(f"{name} must be either a float or "
31
- "MeasurementErrorRate with two fields: 'process' and 'readout'")
32
-
33
- def check_time(name, value):
34
- pat = r"^(\+?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\s*(s|ms|μs|µs|us|ns)$"
35
- if re.match(pat, value) is None:
36
- raise ValueError(f"{name} is not a valid time string; use a "
37
- "suffix s, ms, us, or ns")
38
-
39
- @dataclass
40
- class MeasurementErrorRate(AutoValidatingParams):
41
- process: float = field(metadata={"validate": _check_error_rate})
42
- readout: float = field(metadata={"validate": _check_error_rate})
43
-
44
- @dataclass
45
- class ProtocolSpecificDistillationUnitSpecification(AutoValidatingParams):
46
- num_unit_qubits: Optional[int] = None
47
- duration_in_qubit_cycle_time: Optional[int] = None
48
-
49
- def post_validation(self, result):
50
- if self.num_unit_qubits is None:
51
- raise LookupError("num_unit_qubits must be set")
52
-
53
- if self.duration_in_qubit_cycle_time is None:
54
- raise LookupError("duration_in_qubit_cycle_time must be set")
55
-
56
-
57
- @dataclass
58
- class DistillationUnitSpecification(AutoValidatingParams):
59
- name: Optional[str] = None
60
- display_name: Optional[str] = None
61
- num_input_ts: Optional[int] = None
62
- num_output_ts: Optional[int] = None
63
- failure_probability_formula: Optional[str] = None
64
- output_error_rate_formula: Optional[str] = None
65
- physical_qubit_specification: Optional[ProtocolSpecificDistillationUnitSpecification] = None
66
- logical_qubit_specification: Optional[ProtocolSpecificDistillationUnitSpecification] = None
67
- logical_qubit_specification_first_round_override: \
68
- Optional[ProtocolSpecificDistillationUnitSpecification] = None
69
-
70
- def has_custom_specification(self):
71
- return \
72
- self.display_name is not None \
73
- or self.num_input_ts is not None \
74
- or self.num_output_ts is not None \
75
- or self.failure_probability_formula is not None \
76
- or self.output_error_rate_formula is not None \
77
- or self.physical_qubit_specification is not None \
78
- or self.logical_qubit_specification is not None \
79
- or self.logical_qubit_specification_first_round_override is not None
80
-
81
- def has_predefined_name(self):
82
- return self.name is not None
83
-
84
- def post_validation(self, result):
85
- if not self.has_custom_specification() and not self.has_predefined_name():
86
- raise LookupError("name must be set or custom specification must be provided")
87
-
88
- if self.has_custom_specification() and self.has_predefined_name():
89
- raise LookupError("If predefined name is provided, "
90
- "custom specification is not allowed. "
91
- "Either remove name or remove all other "
92
- "specification of the distillation unit")
93
-
94
- if self.has_predefined_name():
95
- return # all other validation is on the server side
96
-
97
- if self.num_input_ts is None:
98
- raise LookupError("num_input_ts must be set")
99
-
100
- if self.num_output_ts is None:
101
- raise LookupError("num_output_ts must be set")
102
-
103
- if self.failure_probability_formula is None:
104
- raise LookupError("failure_probability_formula must be set")
105
-
106
- if self.output_error_rate_formula is None:
107
- raise LookupError("output_error_rate_formula must be set")
108
-
109
- if self.physical_qubit_specification is not None:
110
- self.physical_qubit_specification.post_validation(result)
111
-
112
- if self.logical_qubit_specification is not None:
113
- self.logical_qubit_specification.post_validation(result)
114
-
115
- if self.logical_qubit_specification_first_round_override is not None:
116
- self.logical_qubit_specification_first_round_override.post_validation(result)
117
-
118
- def as_dict(self, validate=True) -> Dict[str, Any]:
119
- specification_dict = super().as_dict(validate)
120
- if len(specification_dict) != 0:
121
- if self.physical_qubit_specification is not None:
122
- physical_qubit_specification_dict = \
123
- self.physical_qubit_specification.as_dict(validate)
124
- if len(physical_qubit_specification_dict) != 0:
125
- specification_dict["physicalQubitSpecification"] = \
126
- physical_qubit_specification_dict
127
-
128
- if self.logical_qubit_specification is not None:
129
- logical_qubit_specification_dict = \
130
- self.logical_qubit_specification.as_dict(validate)
131
- if len(logical_qubit_specification_dict) != 0:
132
- specification_dict["logicalQubitSpecification"] = \
133
- logical_qubit_specification_dict
134
-
135
- if self.logical_qubit_specification_first_round_override is not None:
136
- logical_qubit_specification_first_round_override_dict = \
137
- self.logical_qubit_specification_first_round_override.as_dict(validate)
138
- if len(logical_qubit_specification_first_round_override_dict) != 0:
139
- specification_dict["logicalQubitSpecificationFirstRoundOverride"] = \
140
- logical_qubit_specification_first_round_override_dict
141
-
142
- return specification_dict