azure-quantum 2.1.0__py3-none-any.whl → 2.1.2__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.
- azure/quantum/_client/_version.py +1 -1
- azure/quantum/qiskit/backends/__init__.py +0 -2
- azure/quantum/qiskit/backends/backend.py +55 -0
- azure/quantum/qiskit/backends/ionq.py +9 -120
- azure/quantum/qiskit/backends/qci.py +2 -24
- azure/quantum/qiskit/backends/quantinuum.py +32 -7
- azure/quantum/qiskit/backends/rigetti.py +4 -24
- azure/quantum/qiskit/job.py +47 -37
- azure/quantum/qiskit/provider.py +4 -4
- azure/quantum/target/ionq.py +24 -27
- azure/quantum/target/quantinuum.py +31 -25
- azure/quantum/target/rigetti/target.py +4 -4
- azure/quantum/target/target.py +61 -1
- azure/quantum/version.py +1 -1
- {azure_quantum-2.1.0.dist-info → azure_quantum-2.1.2.dist-info}/METADATA +35 -35
- {azure_quantum-2.1.0.dist-info → azure_quantum-2.1.2.dist-info}/RECORD +18 -18
- {azure_quantum-2.1.0.dist-info → azure_quantum-2.1.2.dist-info}/WHEEL +1 -1
- {azure_quantum-2.1.0.dist-info → azure_quantum-2.1.2.dist-info}/top_level.txt +0 -0
|
@@ -36,6 +36,25 @@ except ImportError:
|
|
|
36
36
|
To install run: pip install azure-quantum[qiskit]"
|
|
37
37
|
)
|
|
38
38
|
|
|
39
|
+
QIR_BASIS_GATES = [
|
|
40
|
+
"x",
|
|
41
|
+
"y",
|
|
42
|
+
"z",
|
|
43
|
+
"rx",
|
|
44
|
+
"ry",
|
|
45
|
+
"rz",
|
|
46
|
+
"h",
|
|
47
|
+
"swap",
|
|
48
|
+
"cx",
|
|
49
|
+
"cz",
|
|
50
|
+
"reset",
|
|
51
|
+
"s",
|
|
52
|
+
"sdg",
|
|
53
|
+
"t",
|
|
54
|
+
"tdg",
|
|
55
|
+
"measure",
|
|
56
|
+
]
|
|
57
|
+
|
|
39
58
|
|
|
40
59
|
class AzureBackendBase(Backend, SessionHost):
|
|
41
60
|
|
|
@@ -279,7 +298,12 @@ class AzureQirBackend(AzureBackendBase):
|
|
|
279
298
|
"blob_name": "inputData",
|
|
280
299
|
"content_type": "qir.v1",
|
|
281
300
|
"input_data_format": "qir.v1",
|
|
301
|
+
"output_data_format": "microsoft.quantum-results.v2",
|
|
302
|
+
"is_default": True,
|
|
282
303
|
}
|
|
304
|
+
|
|
305
|
+
def _basis_gates(self) -> List[str]:
|
|
306
|
+
return QIR_BASIS_GATES
|
|
283
307
|
|
|
284
308
|
def run(
|
|
285
309
|
self,
|
|
@@ -428,6 +452,37 @@ class AzureQirBackend(AzureBackendBase):
|
|
|
428
452
|
|
|
429
453
|
return module.bitcode
|
|
430
454
|
|
|
455
|
+
def _estimate_cost_qir(self, circuits, shots, options={}):
|
|
456
|
+
"""Estimate the cost for the given circuit."""
|
|
457
|
+
config = self.configuration()
|
|
458
|
+
input_params = self._get_input_params(options, shots=shots)
|
|
459
|
+
|
|
460
|
+
if not (isinstance(circuits, list)):
|
|
461
|
+
circuits = [circuits]
|
|
462
|
+
|
|
463
|
+
to_qir_kwargs = input_params.pop(
|
|
464
|
+
"to_qir_kwargs", config.azure.get("to_qir_kwargs", {"record_output": True})
|
|
465
|
+
)
|
|
466
|
+
targetCapability = input_params.pop(
|
|
467
|
+
"targetCapability",
|
|
468
|
+
self.options.get("targetCapability", "AdaptiveExecution"),
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
if not input_params.pop("skipTranspile", False):
|
|
472
|
+
# Set of gates supported by QIR targets.
|
|
473
|
+
circuits = transpile(
|
|
474
|
+
circuits, basis_gates=config.basis_gates, optimization_level=0
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
(module, _) = self._generate_qir(
|
|
479
|
+
circuits, targetCapability, **to_qir_kwargs
|
|
480
|
+
)
|
|
481
|
+
|
|
482
|
+
workspace = self.provider().get_workspace()
|
|
483
|
+
target = workspace.get_targets(self.name())
|
|
484
|
+
return target.estimate_cost(module, shots=shots)
|
|
485
|
+
|
|
431
486
|
|
|
432
487
|
class AzureBackend(AzureBackendBase):
|
|
433
488
|
"""Base class for interfacing with a backend in Azure Quantum"""
|
|
@@ -20,7 +20,6 @@ from qiskit.providers.models import BackendConfiguration
|
|
|
20
20
|
from qiskit.providers import Options, Provider
|
|
21
21
|
|
|
22
22
|
from qiskit_ionq.helpers import (
|
|
23
|
-
ionq_basis_gates,
|
|
24
23
|
GATESET_MAP,
|
|
25
24
|
qiskit_circ_to_ionq_circ,
|
|
26
25
|
)
|
|
@@ -34,15 +33,12 @@ logger = logging.getLogger(__name__)
|
|
|
34
33
|
|
|
35
34
|
__all__ = [
|
|
36
35
|
"IonQBackend",
|
|
37
|
-
"IonQQPUBackend",
|
|
38
36
|
"IonQSimulatorBackend",
|
|
39
37
|
"IonQAriaBackend",
|
|
40
38
|
"IonQForteBackend",
|
|
41
39
|
"IonQQirBackend",
|
|
42
40
|
"IonQSimulatorQirBackend",
|
|
43
41
|
"IonQSimulatorNativeBackend",
|
|
44
|
-
"IonQQPUQirBackend",
|
|
45
|
-
"IonQQPUNativeBackend",
|
|
46
42
|
"IonQAriaQirBackend",
|
|
47
43
|
"IonQForteQirBackend",
|
|
48
44
|
"IonQAriaNativeBackend",
|
|
@@ -80,6 +76,10 @@ class IonQQirBackendBase(AzureQirBackend):
|
|
|
80
76
|
}
|
|
81
77
|
)
|
|
82
78
|
return config
|
|
79
|
+
|
|
80
|
+
def estimate_cost(self, circuits, shots, options={}):
|
|
81
|
+
"""Estimate the cost for the given circuit."""
|
|
82
|
+
return self._estimate_cost_qir(circuits, shots, options)
|
|
83
83
|
|
|
84
84
|
def run(
|
|
85
85
|
self,
|
|
@@ -106,7 +106,6 @@ class IonQSimulatorQirBackend(IonQQirBackendBase):
|
|
|
106
106
|
|
|
107
107
|
def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
|
|
108
108
|
"""Base class for interfacing with an IonQ QIR Simulator backend"""
|
|
109
|
-
|
|
110
109
|
default_config = BackendConfiguration.from_dict(
|
|
111
110
|
{
|
|
112
111
|
"backend_name": name,
|
|
@@ -115,7 +114,7 @@ class IonQSimulatorQirBackend(IonQQirBackendBase):
|
|
|
115
114
|
"local": False,
|
|
116
115
|
"coupling_map": None,
|
|
117
116
|
"description": "IonQ simulator on Azure Quantum",
|
|
118
|
-
"basis_gates":
|
|
117
|
+
"basis_gates": self._basis_gates(),
|
|
119
118
|
"memory": False,
|
|
120
119
|
"n_qubits": 29,
|
|
121
120
|
"conditional": False,
|
|
@@ -133,44 +132,11 @@ class IonQSimulatorQirBackend(IonQQirBackendBase):
|
|
|
133
132
|
super().__init__(configuration=configuration, provider=provider, **kwargs)
|
|
134
133
|
|
|
135
134
|
|
|
136
|
-
class IonQQPUQirBackend(IonQQirBackendBase):
|
|
137
|
-
backend_names = ("ionq.qpu",)
|
|
138
|
-
|
|
139
|
-
def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
|
|
140
|
-
"""Base class for interfacing with an IonQ QPU backend"""
|
|
141
|
-
|
|
142
|
-
default_config = BackendConfiguration.from_dict(
|
|
143
|
-
{
|
|
144
|
-
"backend_name": name,
|
|
145
|
-
"backend_version": __version__,
|
|
146
|
-
"simulator": False,
|
|
147
|
-
"local": False,
|
|
148
|
-
"coupling_map": None,
|
|
149
|
-
"description": "IonQ QPU on Azure Quantum",
|
|
150
|
-
"basis_gates": ionq_basis_gates,
|
|
151
|
-
"memory": False,
|
|
152
|
-
"n_qubits": 11,
|
|
153
|
-
"conditional": False,
|
|
154
|
-
"max_shots": 10000,
|
|
155
|
-
"max_experiments": 1,
|
|
156
|
-
"open_pulse": False,
|
|
157
|
-
"gates": [{"name": "TODO", "parameters": [], "qasm_def": "TODO"}],
|
|
158
|
-
"azure": self._azure_config(),
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
logger.info("Initializing IonQQPUQirBackend")
|
|
162
|
-
configuration: BackendConfiguration = kwargs.pop(
|
|
163
|
-
"configuration", default_config
|
|
164
|
-
)
|
|
165
|
-
super().__init__(configuration=configuration, provider=provider, **kwargs)
|
|
166
|
-
|
|
167
|
-
|
|
168
135
|
class IonQAriaQirBackend(IonQQirBackendBase):
|
|
169
136
|
backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2")
|
|
170
137
|
|
|
171
138
|
def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
|
|
172
139
|
"""Base class for interfacing with an IonQ Aria QPU backend"""
|
|
173
|
-
|
|
174
140
|
default_config = BackendConfiguration.from_dict(
|
|
175
141
|
{
|
|
176
142
|
"backend_name": name,
|
|
@@ -179,9 +145,9 @@ class IonQAriaQirBackend(IonQQirBackendBase):
|
|
|
179
145
|
"local": False,
|
|
180
146
|
"coupling_map": None,
|
|
181
147
|
"description": "IonQ Aria QPU on Azure Quantum",
|
|
182
|
-
"basis_gates":
|
|
148
|
+
"basis_gates": self._basis_gates(),
|
|
183
149
|
"memory": False,
|
|
184
|
-
"n_qubits":
|
|
150
|
+
"n_qubits": 25,
|
|
185
151
|
"conditional": False,
|
|
186
152
|
"max_shots": 10000,
|
|
187
153
|
"max_experiments": 1,
|
|
@@ -202,7 +168,6 @@ class IonQForteQirBackend(IonQQirBackendBase):
|
|
|
202
168
|
|
|
203
169
|
def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
|
|
204
170
|
"""Base class for interfacing with an IonQ Forte QPU backend"""
|
|
205
|
-
|
|
206
171
|
default_config = BackendConfiguration.from_dict(
|
|
207
172
|
{
|
|
208
173
|
"backend_name": name,
|
|
@@ -211,7 +176,7 @@ class IonQForteQirBackend(IonQQirBackendBase):
|
|
|
211
176
|
"local": False,
|
|
212
177
|
"coupling_map": None,
|
|
213
178
|
"description": "IonQ Forte QPU on Azure Quantum",
|
|
214
|
-
"basis_gates":
|
|
179
|
+
"basis_gates": self._basis_gates(),
|
|
215
180
|
"memory": False,
|
|
216
181
|
"n_qubits": 35,
|
|
217
182
|
"conditional": False,
|
|
@@ -276,7 +241,7 @@ class IonQBackend(AzureBackend):
|
|
|
276
241
|
"provider_id": "ionq",
|
|
277
242
|
"input_data_format": "ionq.circuit.v1",
|
|
278
243
|
"output_data_format": "ionq.quantum-results.v1",
|
|
279
|
-
"is_default":
|
|
244
|
+
"is_default": False,
|
|
280
245
|
}
|
|
281
246
|
|
|
282
247
|
def _prepare_job_metadata(self, circuit, **kwargs):
|
|
@@ -351,64 +316,6 @@ class IonQSimulatorNativeBackend(IonQSimulatorBackend):
|
|
|
351
316
|
kwargs["gateset"] = "native"
|
|
352
317
|
super().__init__(name, provider, **kwargs)
|
|
353
318
|
|
|
354
|
-
def _azure_config(self) -> Dict[str, str]:
|
|
355
|
-
config = super()._azure_config()
|
|
356
|
-
config.update(
|
|
357
|
-
{
|
|
358
|
-
"is_default": False,
|
|
359
|
-
}
|
|
360
|
-
)
|
|
361
|
-
return config
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
class IonQQPUBackend(IonQBackend):
|
|
365
|
-
backend_names = ("ionq.qpu",)
|
|
366
|
-
|
|
367
|
-
def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
|
|
368
|
-
"""Base class for interfacing with an IonQ QPU backend"""
|
|
369
|
-
gateset = kwargs.pop("gateset", "qis")
|
|
370
|
-
default_config = BackendConfiguration.from_dict(
|
|
371
|
-
{
|
|
372
|
-
"backend_name": name,
|
|
373
|
-
"backend_version": __version__,
|
|
374
|
-
"simulator": False,
|
|
375
|
-
"local": False,
|
|
376
|
-
"coupling_map": None,
|
|
377
|
-
"description": "IonQ QPU on Azure Quantum",
|
|
378
|
-
"basis_gates": GATESET_MAP[gateset],
|
|
379
|
-
"memory": False,
|
|
380
|
-
"n_qubits": 11,
|
|
381
|
-
"conditional": False,
|
|
382
|
-
"max_shots": 10000,
|
|
383
|
-
"max_experiments": 1,
|
|
384
|
-
"open_pulse": False,
|
|
385
|
-
"gates": [{"name": "TODO", "parameters": [], "qasm_def": "TODO"}],
|
|
386
|
-
"azure": self._azure_config(),
|
|
387
|
-
"gateset": gateset,
|
|
388
|
-
}
|
|
389
|
-
)
|
|
390
|
-
logger.info("Initializing IonQQPUBackend")
|
|
391
|
-
configuration: BackendConfiguration = kwargs.pop(
|
|
392
|
-
"configuration", default_config
|
|
393
|
-
)
|
|
394
|
-
super().__init__(configuration=configuration, provider=provider, **kwargs)
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
class IonQQPUNativeBackend(IonQQPUBackend):
|
|
398
|
-
def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
|
|
399
|
-
if "gateset" not in kwargs:
|
|
400
|
-
kwargs["gateset"] = "native"
|
|
401
|
-
super().__init__(name, provider, **kwargs)
|
|
402
|
-
|
|
403
|
-
def _azure_config(self) -> Dict[str, str]:
|
|
404
|
-
config = super()._azure_config()
|
|
405
|
-
config.update(
|
|
406
|
-
{
|
|
407
|
-
"is_default": False,
|
|
408
|
-
}
|
|
409
|
-
)
|
|
410
|
-
return config
|
|
411
|
-
|
|
412
319
|
|
|
413
320
|
class IonQAriaBackend(IonQBackend):
|
|
414
321
|
backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2")
|
|
@@ -482,27 +389,9 @@ class IonQAriaNativeBackend(IonQAriaBackend):
|
|
|
482
389
|
kwargs["gateset"] = "native"
|
|
483
390
|
super().__init__(name, provider, **kwargs)
|
|
484
391
|
|
|
485
|
-
def _azure_config(self) -> Dict[str, str]:
|
|
486
|
-
config = super()._azure_config()
|
|
487
|
-
config.update(
|
|
488
|
-
{
|
|
489
|
-
"is_default": False,
|
|
490
|
-
}
|
|
491
|
-
)
|
|
492
|
-
return config
|
|
493
|
-
|
|
494
392
|
|
|
495
393
|
class IonQForteNativeBackend(IonQForteBackend):
|
|
496
394
|
def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
|
|
497
395
|
if "gateset" not in kwargs:
|
|
498
396
|
kwargs["gateset"] = "native"
|
|
499
397
|
super().__init__(name, provider, **kwargs)
|
|
500
|
-
|
|
501
|
-
def _azure_config(self) -> Dict[str, str]:
|
|
502
|
-
config = super()._azure_config()
|
|
503
|
-
config.update(
|
|
504
|
-
{
|
|
505
|
-
"is_default": False,
|
|
506
|
-
}
|
|
507
|
-
)
|
|
508
|
-
return config
|
|
@@ -15,28 +15,6 @@ from .backend import (
|
|
|
15
15
|
from qiskit.providers.models import BackendConfiguration
|
|
16
16
|
from qiskit.providers import Options, Provider
|
|
17
17
|
|
|
18
|
-
QIR_BASIS_GATES = [
|
|
19
|
-
"measure",
|
|
20
|
-
"m",
|
|
21
|
-
"barrier",
|
|
22
|
-
"cx",
|
|
23
|
-
"cz",
|
|
24
|
-
"h",
|
|
25
|
-
"reset",
|
|
26
|
-
"rx",
|
|
27
|
-
"ry",
|
|
28
|
-
"rz",
|
|
29
|
-
"s",
|
|
30
|
-
"sdg",
|
|
31
|
-
"swap",
|
|
32
|
-
"t",
|
|
33
|
-
"tdg",
|
|
34
|
-
"x",
|
|
35
|
-
"y",
|
|
36
|
-
"z",
|
|
37
|
-
"id",
|
|
38
|
-
]
|
|
39
|
-
|
|
40
18
|
if TYPE_CHECKING:
|
|
41
19
|
from azure.quantum.qiskit import AzureQuantumProvider
|
|
42
20
|
|
|
@@ -110,7 +88,7 @@ class QCISimulatorBackend(QCIBackend):
|
|
|
110
88
|
"local": False,
|
|
111
89
|
"coupling_map": None,
|
|
112
90
|
"description": "QCI simulator on Azure Quantum",
|
|
113
|
-
"basis_gates":
|
|
91
|
+
"basis_gates": self._basis_gates(),
|
|
114
92
|
"memory": False,
|
|
115
93
|
"n_qubits": 29,
|
|
116
94
|
"conditional": True,
|
|
@@ -142,7 +120,7 @@ class QCIQPUBackend(QCIBackend):
|
|
|
142
120
|
"local": False,
|
|
143
121
|
"coupling_map": None,
|
|
144
122
|
"description": "QCI QPU on Azure Quantum",
|
|
145
|
-
"basis_gates":
|
|
123
|
+
"basis_gates": self._basis_gates(),
|
|
146
124
|
"memory": False,
|
|
147
125
|
"n_qubits": 11,
|
|
148
126
|
"conditional": True,
|
|
@@ -50,6 +50,24 @@ QUANTINUUM_BASIS_GATES = [
|
|
|
50
50
|
"reset",
|
|
51
51
|
]
|
|
52
52
|
|
|
53
|
+
QUANTINUUM_QIR_BASIS_GATES = [
|
|
54
|
+
"x",
|
|
55
|
+
"y",
|
|
56
|
+
"z",
|
|
57
|
+
"rx",
|
|
58
|
+
"ry",
|
|
59
|
+
"rz",
|
|
60
|
+
"h",
|
|
61
|
+
"cx",
|
|
62
|
+
"cz",
|
|
63
|
+
"reset",
|
|
64
|
+
"s",
|
|
65
|
+
"sdg",
|
|
66
|
+
"t",
|
|
67
|
+
"tdg",
|
|
68
|
+
"measure",
|
|
69
|
+
]
|
|
70
|
+
|
|
53
71
|
QUANTINUUM_PROVIDER_ID = "quantinuum"
|
|
54
72
|
QUANTINUUM_PROVIDER_NAME = "Quantinuum"
|
|
55
73
|
|
|
@@ -94,9 +112,16 @@ class QuantinuumQirBackendBase(AzureQirBackend):
|
|
|
94
112
|
}
|
|
95
113
|
)
|
|
96
114
|
return config
|
|
115
|
+
|
|
116
|
+
def _basis_gates(self) -> List[str]:
|
|
117
|
+
return QUANTINUUM_QIR_BASIS_GATES
|
|
97
118
|
|
|
98
119
|
def _get_n_qubits(self, name):
|
|
99
120
|
return _get_n_qubits(name)
|
|
121
|
+
|
|
122
|
+
def estimate_cost(self, circuits, shots, options={}):
|
|
123
|
+
"""Estimate the cost for the given circuit."""
|
|
124
|
+
return self._estimate_cost_qir(circuits, shots, options)
|
|
100
125
|
|
|
101
126
|
|
|
102
127
|
class QuantinuumSyntaxCheckerQirBackend(QuantinuumQirBackendBase):
|
|
@@ -118,8 +143,8 @@ class QuantinuumSyntaxCheckerQirBackend(QuantinuumQirBackendBase):
|
|
|
118
143
|
"local": False,
|
|
119
144
|
"coupling_map": None,
|
|
120
145
|
"description": f"Quantinuum Syntax Checker on Azure Quantum",
|
|
121
|
-
"basis_gates":
|
|
122
|
-
"memory":
|
|
146
|
+
"basis_gates": self._basis_gates(),
|
|
147
|
+
"memory": True,
|
|
123
148
|
"n_qubits": self._get_n_qubits(name),
|
|
124
149
|
"conditional": False,
|
|
125
150
|
"max_shots": None,
|
|
@@ -155,8 +180,8 @@ class QuantinuumEmulatorQirBackend(QuantinuumQirBackendBase):
|
|
|
155
180
|
"local": False,
|
|
156
181
|
"coupling_map": None,
|
|
157
182
|
"description": f"Quantinuum emulator on Azure Quantum",
|
|
158
|
-
"basis_gates":
|
|
159
|
-
"memory":
|
|
183
|
+
"basis_gates": self._basis_gates(),
|
|
184
|
+
"memory": True,
|
|
160
185
|
"n_qubits": self._get_n_qubits(name),
|
|
161
186
|
"conditional": False,
|
|
162
187
|
"max_shots": None,
|
|
@@ -192,8 +217,8 @@ class QuantinuumQPUQirBackend(QuantinuumQirBackendBase):
|
|
|
192
217
|
"local": False,
|
|
193
218
|
"coupling_map": None,
|
|
194
219
|
"description": f"Quantinuum QPU on Azure Quantum",
|
|
195
|
-
"basis_gates":
|
|
196
|
-
"memory":
|
|
220
|
+
"basis_gates": self._basis_gates(),
|
|
221
|
+
"memory": True,
|
|
197
222
|
"n_qubits": self._get_n_qubits(name),
|
|
198
223
|
"conditional": False,
|
|
199
224
|
"max_shots": 10000,
|
|
@@ -236,7 +261,7 @@ class QuantinuumBackend(AzureBackend):
|
|
|
236
261
|
"provider_id": self._provider_id,
|
|
237
262
|
"input_data_format": "honeywell.openqasm.v1",
|
|
238
263
|
"output_data_format": "honeywell.quantum-results.v1",
|
|
239
|
-
"is_default":
|
|
264
|
+
"is_default": False,
|
|
240
265
|
}
|
|
241
266
|
|
|
242
267
|
def _translate_input(self, circuit):
|
|
@@ -12,26 +12,6 @@ from .backend import AzureQirBackend
|
|
|
12
12
|
from qiskit.providers.models import BackendConfiguration
|
|
13
13
|
from qiskit.providers import Options, Provider
|
|
14
14
|
|
|
15
|
-
QIR_BASIS_GATES = [
|
|
16
|
-
"measure",
|
|
17
|
-
"m",
|
|
18
|
-
"cx",
|
|
19
|
-
"cz",
|
|
20
|
-
"h",
|
|
21
|
-
"reset",
|
|
22
|
-
"rx",
|
|
23
|
-
"ry",
|
|
24
|
-
"rz",
|
|
25
|
-
"s",
|
|
26
|
-
"sdg",
|
|
27
|
-
"t",
|
|
28
|
-
"tdg",
|
|
29
|
-
"x",
|
|
30
|
-
"y",
|
|
31
|
-
"z",
|
|
32
|
-
"id",
|
|
33
|
-
]
|
|
34
|
-
|
|
35
15
|
if TYPE_CHECKING:
|
|
36
16
|
from azure.quantum.qiskit import AzureQuantumProvider
|
|
37
17
|
|
|
@@ -85,8 +65,8 @@ class RigettiSimulatorBackend(RigettiBackend):
|
|
|
85
65
|
"local": False,
|
|
86
66
|
"coupling_map": None,
|
|
87
67
|
"description": "Rigetti simulator on Azure Quantum",
|
|
88
|
-
"basis_gates":
|
|
89
|
-
"memory":
|
|
68
|
+
"basis_gates": self._basis_gates(),
|
|
69
|
+
"memory": True,
|
|
90
70
|
"n_qubits": RigettiTarget.num_qubits(name),
|
|
91
71
|
"conditional": False,
|
|
92
72
|
"max_shots": 10000,
|
|
@@ -117,8 +97,8 @@ class RigettiQPUBackend(RigettiBackend):
|
|
|
117
97
|
"local": False,
|
|
118
98
|
"coupling_map": None,
|
|
119
99
|
"description": "Rigetti QPU on Azure Quantum",
|
|
120
|
-
"basis_gates":
|
|
121
|
-
"memory":
|
|
100
|
+
"basis_gates": self._basis_gates(),
|
|
101
|
+
"memory": True,
|
|
122
102
|
"n_qubits": RigettiTarget.num_qubits(name),
|
|
123
103
|
"conditional": False,
|
|
124
104
|
"max_shots": 10000,
|
azure/quantum/qiskit/job.py
CHANGED
|
@@ -273,45 +273,32 @@ class AzureQuantumJob(JobV1):
|
|
|
273
273
|
|
|
274
274
|
def _translate_microsoft_v2_results(self):
|
|
275
275
|
""" Translate Microsoft's batching job results histograms into a format that can be consumed by qiskit libraries. """
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
276
|
+
az_result_histogram = self._azure_job.get_results_histogram()
|
|
277
|
+
az_result_shots = self._azure_job.get_results_shots()
|
|
278
|
+
|
|
279
|
+
# If it is a non-batched result, format to be in batch format so we can have one code path
|
|
280
|
+
if isinstance(az_result_histogram, dict):
|
|
281
|
+
az_result_histogram = [az_result_histogram]
|
|
282
|
+
az_result_shots = [az_result_shots]
|
|
283
|
+
|
|
284
284
|
histograms = []
|
|
285
|
-
|
|
286
|
-
for
|
|
285
|
+
|
|
286
|
+
for (histogram, shots) in zip(az_result_histogram, az_result_shots):
|
|
287
287
|
counts = {}
|
|
288
288
|
probabilities = {}
|
|
289
289
|
|
|
290
|
-
|
|
291
|
-
raise ValueError("TotalCount missing from Job results")
|
|
292
|
-
|
|
293
|
-
total_count = circuit_results["TotalCount"]
|
|
290
|
+
total_count = len(shots)
|
|
294
291
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
if not "Histogram" in circuit_results:
|
|
299
|
-
raise ValueError("Histogram missing from Job results")
|
|
300
|
-
|
|
301
|
-
histogram = circuit_results["Histogram"]
|
|
302
|
-
for result in histogram:
|
|
303
|
-
if not "Display" in result:
|
|
304
|
-
raise ValueError("Dispaly missing from histogram result")
|
|
305
|
-
|
|
306
|
-
if not "Count" in result:
|
|
307
|
-
raise ValueError("Count missing from histogram result")
|
|
308
|
-
|
|
309
|
-
bitstring = AzureQuantumJob._qir_to_qiskit_bitstring(result["Display"])
|
|
310
|
-
count = result["Count"]
|
|
292
|
+
for (display, result) in histogram.items():
|
|
293
|
+
bitstring = AzureQuantumJob._qir_to_qiskit_bitstring(display)
|
|
294
|
+
count = result["count"]
|
|
311
295
|
probability = count / total_count
|
|
312
296
|
counts[bitstring] = count
|
|
313
297
|
probabilities[bitstring] = probability
|
|
314
|
-
|
|
298
|
+
|
|
299
|
+
formatted_shots = [AzureQuantumJob._qir_to_qiskit_bitstring(shot) for shot in shots]
|
|
300
|
+
|
|
301
|
+
histograms.append((total_count, {"counts": counts, "probabilities": probabilities, "memory": formatted_shots}))
|
|
315
302
|
return histograms
|
|
316
303
|
|
|
317
304
|
def _get_entry_point_names(self):
|
|
@@ -325,6 +312,26 @@ class AzureQuantumJob(JobV1):
|
|
|
325
312
|
entry_point_names.append(entry_point["entryPoint"])
|
|
326
313
|
return entry_point_names if len(entry_point_names) > 0 else ["main"]
|
|
327
314
|
|
|
315
|
+
def _get_headers(self):
|
|
316
|
+
headers = self._azure_job.details.metadata
|
|
317
|
+
if (not isinstance(headers, list)):
|
|
318
|
+
headers = [headers]
|
|
319
|
+
|
|
320
|
+
# This function will attempt to parse the header into a JSON object, and if the header is not a JSON object, we return the header itself
|
|
321
|
+
def tryParseJSON(header):
|
|
322
|
+
try:
|
|
323
|
+
json_object = json.loads(header)
|
|
324
|
+
except ValueError as e:
|
|
325
|
+
return header
|
|
326
|
+
return json_object
|
|
327
|
+
|
|
328
|
+
for header in headers:
|
|
329
|
+
del header['qiskit'] # we throw out the qiskit header as it is implied
|
|
330
|
+
for key in header.keys():
|
|
331
|
+
header[key] = tryParseJSON(header[key])
|
|
332
|
+
return headers
|
|
333
|
+
|
|
334
|
+
|
|
328
335
|
def _format_microsoft_v2_results(self) -> List[Dict[str, Any]]:
|
|
329
336
|
success = self._azure_job.details.status == "Succeeded"
|
|
330
337
|
|
|
@@ -339,10 +346,15 @@ class AzureQuantumJob(JobV1):
|
|
|
339
346
|
entry_point_names = self._get_entry_point_names()
|
|
340
347
|
|
|
341
348
|
results = self._translate_microsoft_v2_results()
|
|
342
|
-
|
|
349
|
+
|
|
343
350
|
if len(results) != len(entry_point_names):
|
|
344
|
-
raise ValueError("The number of experiment results does not match the number of
|
|
351
|
+
raise ValueError("The number of experiment results does not match the number of entry point names")
|
|
352
|
+
|
|
353
|
+
headers = self._get_headers()
|
|
345
354
|
|
|
355
|
+
if len(results) != len(headers):
|
|
356
|
+
raise ValueError("The number of experiment results does not match the number of headers")
|
|
357
|
+
|
|
346
358
|
status = self.status()
|
|
347
359
|
|
|
348
360
|
return [{
|
|
@@ -351,7 +363,5 @@ class AzureQuantumJob(JobV1):
|
|
|
351
363
|
"shots": total_count,
|
|
352
364
|
"name": name,
|
|
353
365
|
"status": status,
|
|
354
|
-
"header":
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
} for name, (total_count, result) in zip(entry_point_names, results)]
|
|
366
|
+
"header": header
|
|
367
|
+
} for name, (total_count, result), header in zip(entry_point_names, results, headers)]
|
azure/quantum/qiskit/provider.py
CHANGED
|
@@ -129,9 +129,9 @@ see https://aka.ms/AQ/Docs/AddProvider"
|
|
|
129
129
|
filtered_backends,
|
|
130
130
|
)
|
|
131
131
|
)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if len(default_backends) > 0:
|
|
132
|
+
# If default backends were found - return them, otherwise return the filtered_backends collection.
|
|
133
|
+
# The latter case could happen where there's no default backend defined for the specified target.
|
|
134
|
+
if len(default_backends) > 0:
|
|
135
135
|
return default_backends
|
|
136
136
|
|
|
137
137
|
return filtered_backends
|
|
@@ -277,7 +277,7 @@ see https://aka.ms/AQ/Docs/AddProvider"
|
|
|
277
277
|
warnings.warn(
|
|
278
278
|
f"Specified filters {unknown_filters} are not supported by the available backends."
|
|
279
279
|
)
|
|
280
|
-
|
|
280
|
+
|
|
281
281
|
backends = list(filter(filters, backends))
|
|
282
282
|
|
|
283
283
|
return backends
|
azure/quantum/target/ionq.py
CHANGED
|
@@ -12,10 +12,10 @@ from azure.quantum.target.target import (
|
|
|
12
12
|
from azure.quantum.job.job import Job
|
|
13
13
|
from azure.quantum.workspace import Workspace
|
|
14
14
|
from azure.quantum._client.models import CostEstimate, UsageEvent
|
|
15
|
+
from typing import Union
|
|
15
16
|
|
|
16
17
|
COST_1QUBIT_GATE_MAP = {
|
|
17
18
|
"ionq.simulator" : 0.0,
|
|
18
|
-
"ionq.qpu" : 0.00003,
|
|
19
19
|
"ionq.qpu.aria-1" : 0.0002205,
|
|
20
20
|
"ionq.qpu.aria-2" : 0.0002205,
|
|
21
21
|
"ionq.qpu.forte-1" : 0.0002205
|
|
@@ -23,7 +23,6 @@ COST_1QUBIT_GATE_MAP = {
|
|
|
23
23
|
|
|
24
24
|
COST_2QUBIT_GATE_MAP = {
|
|
25
25
|
"ionq.simulator" : 0.0,
|
|
26
|
-
"ionq.qpu" : 0.0003,
|
|
27
26
|
"ionq.qpu.aria-1" : 0.00098,
|
|
28
27
|
"ionq.qpu.aria-2" : 0.00098,
|
|
29
28
|
"ionq.qpu.forte-1" : 0.00098
|
|
@@ -31,7 +30,6 @@ COST_2QUBIT_GATE_MAP = {
|
|
|
31
30
|
|
|
32
31
|
MIN_PRICE_MAP = {
|
|
33
32
|
"ionq.simulator" : 0.0,
|
|
34
|
-
"ionq.qpu" : 1.0,
|
|
35
33
|
"ionq.qpu.aria-1" : 97.5,
|
|
36
34
|
"ionq.qpu.aria-2" : 97.5,
|
|
37
35
|
"ionq.qpu.forte-1" : 97.5
|
|
@@ -47,7 +45,6 @@ def int_to_bitstring(k: int, num_qubits: int, measured_qubit_ids: List[int]):
|
|
|
47
45
|
class IonQ(Target):
|
|
48
46
|
"""IonQ target."""
|
|
49
47
|
target_names = (
|
|
50
|
-
"ionq.qpu",
|
|
51
48
|
"ionq.simulator",
|
|
52
49
|
"ionq.qpu.aria-1",
|
|
53
50
|
"ionq.qpu.aria-2",
|
|
@@ -127,7 +124,7 @@ class IonQ(Target):
|
|
|
127
124
|
|
|
128
125
|
def estimate_cost(
|
|
129
126
|
self,
|
|
130
|
-
circuit: Dict[str, Any],
|
|
127
|
+
circuit: Union[Dict[str, Any], Any],
|
|
131
128
|
num_shots: int = None,
|
|
132
129
|
price_1q: float = None,
|
|
133
130
|
price_2q: float = None,
|
|
@@ -141,10 +138,6 @@ class IonQ(Target):
|
|
|
141
138
|
|
|
142
139
|
Specify pricing details for your area to get most accurate results.
|
|
143
140
|
By default, this function charges depending on the target:
|
|
144
|
-
ionq.qpu:
|
|
145
|
-
price_1q = 0.00003 USD for a single-qubit gate.
|
|
146
|
-
price_2q = 0.0003 USD for a two-qubit gate.
|
|
147
|
-
min_price = 1 USD, total minimum price per circuit.
|
|
148
141
|
ionq.qpu.aria-1:
|
|
149
142
|
price_1q = 0.00022 USD for a single-qubit gate.
|
|
150
143
|
price_2q = 0.00098 USD for a two-qubit gate.
|
|
@@ -182,20 +175,6 @@ class IonQ(Target):
|
|
|
182
175
|
)
|
|
183
176
|
shots = num_shots
|
|
184
177
|
|
|
185
|
-
def is_1q_gate(gate: Dict[str, Any]):
|
|
186
|
-
return "controls" not in gate and "control" not in gate
|
|
187
|
-
|
|
188
|
-
def is_multi_q_gate(gate):
|
|
189
|
-
return "controls" in gate or "control" in gate
|
|
190
|
-
|
|
191
|
-
def num_2q_gates(gate):
|
|
192
|
-
controls = gate.get("controls")
|
|
193
|
-
if controls is None or len(controls) == 1:
|
|
194
|
-
# Only one control qubit
|
|
195
|
-
return 1
|
|
196
|
-
# Multiple control qubits
|
|
197
|
-
return 6 * (len(controls) - 2)
|
|
198
|
-
|
|
199
178
|
# Get the costs for the gates depending on the provider if not specified
|
|
200
179
|
if price_1q is None:
|
|
201
180
|
price_1q = COST_1QUBIT_GATE_MAP[self.name]
|
|
@@ -206,10 +185,28 @@ class IonQ(Target):
|
|
|
206
185
|
if min_price is None:
|
|
207
186
|
min_price = MIN_PRICE_MAP[self.name]
|
|
208
187
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
188
|
+
if (isinstance(circuit, Dict)):
|
|
189
|
+
def is_1q_gate(gate: Dict[str, Any]):
|
|
190
|
+
return "controls" not in gate and "control" not in gate
|
|
191
|
+
|
|
192
|
+
def is_multi_q_gate(gate):
|
|
193
|
+
return "controls" in gate or "control" in gate
|
|
194
|
+
|
|
195
|
+
def num_2q_gates(gate):
|
|
196
|
+
controls = gate.get("controls")
|
|
197
|
+
if controls is None or len(controls) == 1:
|
|
198
|
+
# Only one control qubit
|
|
199
|
+
return 1
|
|
200
|
+
# Multiple control qubits
|
|
201
|
+
return 6 * (len(controls) - 2)
|
|
202
|
+
|
|
203
|
+
gates = circuit.get("circuit", [])
|
|
204
|
+
N_1q = sum(map(is_1q_gate, gates))
|
|
205
|
+
N_2q = sum(map(num_2q_gates, filter(is_multi_q_gate, gates)))
|
|
206
|
+
|
|
207
|
+
else:
|
|
208
|
+
N_1q, N_2q, _ = Target._calculate_qir_module_gate_stats(circuit)
|
|
209
|
+
|
|
213
210
|
price = (price_1q * N_1q + price_2q * N_2q) * shots
|
|
214
211
|
price = max(price, min_price)
|
|
215
212
|
|
|
@@ -12,6 +12,7 @@ from azure.quantum.target.target import (
|
|
|
12
12
|
from azure.quantum.job.job import Job
|
|
13
13
|
from azure.quantum.workspace import Workspace
|
|
14
14
|
from azure.quantum._client.models import CostEstimate, UsageEvent
|
|
15
|
+
from typing import Union
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class Quantinuum(Target):
|
|
@@ -98,7 +99,7 @@ class Quantinuum(Target):
|
|
|
98
99
|
|
|
99
100
|
def estimate_cost(
|
|
100
101
|
self,
|
|
101
|
-
circuit: str = None,
|
|
102
|
+
circuit: Union[str, Any] = None,
|
|
102
103
|
num_shots: int = None,
|
|
103
104
|
N_1q: int = None,
|
|
104
105
|
N_2q: int = None,
|
|
@@ -144,30 +145,35 @@ class Quantinuum(Target):
|
|
|
144
145
|
)
|
|
145
146
|
shots = num_shots
|
|
146
147
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
148
|
+
# If we use passthrough, else assume QIR
|
|
149
|
+
if (isinstance(circuit, str)):
|
|
150
|
+
if circuit is not None and (N_1q is None or N_2q is None or N_m is None):
|
|
151
|
+
try:
|
|
152
|
+
from qiskit.qasm2 import loads
|
|
153
|
+
from qiskit.converters.circuit_to_dag import circuit_to_dag
|
|
154
|
+
|
|
155
|
+
except ImportError:
|
|
156
|
+
raise ImportError(
|
|
157
|
+
"Missing dependency qiskit. Please run `pip install azure-quantum[qiskit]` " \
|
|
158
|
+
"to estimate the circuit cost. Alternatively, specify the number of one-qubit and two-qubit " \
|
|
159
|
+
"gates in the method input arguments.")
|
|
160
|
+
|
|
161
|
+
else:
|
|
162
|
+
from qiskit.dagcircuit.dagnode import DAGOpNode
|
|
163
|
+
circuit_obj = loads(string=circuit)
|
|
164
|
+
dag = circuit_to_dag(circuit=circuit_obj)
|
|
165
|
+
N_1q, N_2q, N_m = 0, 0, 0
|
|
166
|
+
for node in dag._multi_graph.nodes():
|
|
167
|
+
if isinstance(node, DAGOpNode):
|
|
168
|
+
if node.op.name in ["measure", "reset"]:
|
|
169
|
+
N_m += 1
|
|
170
|
+
elif node.op.num_qubits == 1:
|
|
171
|
+
N_1q += 1
|
|
172
|
+
else:
|
|
173
|
+
N_2q += 1
|
|
174
|
+
else:
|
|
175
|
+
N_1q, N_2q, N_m = Target._calculate_qir_module_gate_stats(circuit)
|
|
176
|
+
|
|
171
177
|
|
|
172
178
|
import re
|
|
173
179
|
is_emulator_regex = re.compile("^.*(-sim|-[0-9]*e)$")
|
|
@@ -29,7 +29,7 @@ class RigettiTarget(str, Enum):
|
|
|
29
29
|
QVM = "rigetti.sim.qvm"
|
|
30
30
|
"""A simulator target for Quil. See https://github.com/quil-lang/qvm for more info."""
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
ANKAA_9Q_3 = "rigetti.qpu.ankaa-9q-3"
|
|
33
33
|
|
|
34
34
|
def simulators() -> List[str]:
|
|
35
35
|
"""Returns a list of simulator targets"""
|
|
@@ -40,7 +40,7 @@ class RigettiTarget(str, Enum):
|
|
|
40
40
|
def qpus() -> List[str]:
|
|
41
41
|
"""Returns a list of QPU targets"""
|
|
42
42
|
return [
|
|
43
|
-
RigettiTarget.
|
|
43
|
+
RigettiTarget.ANKAA_9Q_3.value,
|
|
44
44
|
]
|
|
45
45
|
|
|
46
46
|
def num_qubits(target_name) -> int:
|
|
@@ -48,8 +48,8 @@ class RigettiTarget(str, Enum):
|
|
|
48
48
|
|
|
49
49
|
if target_name == RigettiTarget.QVM.value:
|
|
50
50
|
return 20
|
|
51
|
-
elif target_name == RigettiTarget.
|
|
52
|
-
return
|
|
51
|
+
elif target_name == RigettiTarget.ANKAA_9Q_3.value:
|
|
52
|
+
return 9
|
|
53
53
|
else:
|
|
54
54
|
raise ValueError(f"Unknown target {target_name}")
|
|
55
55
|
|
azure/quantum/target/target.py
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
# Licensed under the MIT License.
|
|
4
4
|
##
|
|
5
|
-
from typing import TYPE_CHECKING, Any, Dict, Optional, Union, Type, Protocol, runtime_checkable
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union, Type, Protocol, runtime_checkable
|
|
6
|
+
from dataclasses import dataclass
|
|
6
7
|
import io
|
|
7
8
|
import json
|
|
8
9
|
import abc
|
|
@@ -26,6 +27,14 @@ class QirRepresentable(Protocol):
|
|
|
26
27
|
def _repr_qir_(self, **kwargs: Any) -> bytes:
|
|
27
28
|
raise NotImplementedError
|
|
28
29
|
|
|
30
|
+
@dataclass
|
|
31
|
+
class GateStats:
|
|
32
|
+
one_qubit_gates: int
|
|
33
|
+
multi_qubit_gates: int
|
|
34
|
+
measurement_gates: int
|
|
35
|
+
|
|
36
|
+
def __iter__(self):
|
|
37
|
+
return iter((self.one_qubit_gates, self.multi_qubit_gates, self.measurement_gates))
|
|
29
38
|
|
|
30
39
|
class Target(abc.ABC, SessionHost):
|
|
31
40
|
|
|
@@ -327,6 +336,57 @@ target '{self.name}' of provider '{self.provider_id}' not found."
|
|
|
327
336
|
def _get_azure_provider_id(self) -> str:
|
|
328
337
|
return self.provider_id
|
|
329
338
|
|
|
339
|
+
@classmethod
|
|
340
|
+
def _calculate_qir_module_gate_stats(self, qir_module) -> GateStats:
|
|
341
|
+
try:
|
|
342
|
+
from pyqir import Module, is_qubit_type, is_result_type, entry_point, is_entry_point, Function
|
|
343
|
+
|
|
344
|
+
except ImportError:
|
|
345
|
+
raise ImportError(
|
|
346
|
+
"Missing optional 'qiskit' dependencies. \
|
|
347
|
+
To install run: pip install azure-quantum[qiskit]"
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
module: Module = qir_module
|
|
351
|
+
|
|
352
|
+
one_qubit_gates = 0
|
|
353
|
+
multi_qubit_gates = 0
|
|
354
|
+
measurement_gates = 0
|
|
355
|
+
|
|
356
|
+
function_entry_points: list[Function] = filter(is_entry_point, module.functions)
|
|
357
|
+
|
|
358
|
+
# Iterate over the blocks and their instructions
|
|
359
|
+
for function in function_entry_points:
|
|
360
|
+
for block in function.basic_blocks:
|
|
361
|
+
for instruction in block.instructions:
|
|
362
|
+
qubit_count = 0
|
|
363
|
+
result_count = 0
|
|
364
|
+
|
|
365
|
+
# If the instruction is of type quantum rt, do not include this is the price calculation
|
|
366
|
+
if len(instruction.operands) > 0 and "__quantum__rt" not in instruction.operands[-1].name:
|
|
367
|
+
# Check each operand in the instruction
|
|
368
|
+
for operand in instruction.operands:
|
|
369
|
+
value_type = operand.type
|
|
370
|
+
|
|
371
|
+
if is_qubit_type(value_type):
|
|
372
|
+
qubit_count += 1
|
|
373
|
+
elif is_result_type(value_type):
|
|
374
|
+
result_count += 1
|
|
375
|
+
|
|
376
|
+
# Determine the type of gate based on the counts
|
|
377
|
+
if qubit_count == 1 and result_count == 0:
|
|
378
|
+
one_qubit_gates += 1
|
|
379
|
+
if qubit_count >= 2 and result_count == 0:
|
|
380
|
+
multi_qubit_gates += 1
|
|
381
|
+
if result_count > 0:
|
|
382
|
+
measurement_gates += 1
|
|
383
|
+
|
|
384
|
+
return GateStats (
|
|
385
|
+
one_qubit_gates,
|
|
386
|
+
multi_qubit_gates,
|
|
387
|
+
measurement_gates
|
|
388
|
+
)
|
|
389
|
+
|
|
330
390
|
|
|
331
391
|
def _determine_shots_or_deprecated_num_shots(
|
|
332
392
|
shots: int = None,
|
azure/quantum/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: azure-quantum
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: Python client for Azure Quantum
|
|
5
5
|
Home-page: https://github.com/microsoft/azure-quantum-python
|
|
6
6
|
Author: Microsoft
|
|
@@ -10,47 +10,47 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Requires-Python: >=3.8
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: azure-core
|
|
14
|
-
Requires-Dist: azure-identity
|
|
15
|
-
Requires-Dist: azure-storage-blob
|
|
16
|
-
Requires-Dist: msrest
|
|
17
|
-
Requires-Dist: numpy
|
|
18
|
-
Requires-Dist: deprecated
|
|
19
|
-
Requires-Dist: Markdown
|
|
20
|
-
Requires-Dist: python-markdown-math
|
|
13
|
+
Requires-Dist: azure-core<2.0,>=1.30
|
|
14
|
+
Requires-Dist: azure-identity<2.0,>=1.17
|
|
15
|
+
Requires-Dist: azure-storage-blob==12.20
|
|
16
|
+
Requires-Dist: msrest<1.0,>=0.7.1
|
|
17
|
+
Requires-Dist: numpy<2.0,>=1.21.0
|
|
18
|
+
Requires-Dist: deprecated<2.0,>=1.2.12
|
|
19
|
+
Requires-Dist: Markdown>=3.4.1
|
|
20
|
+
Requires-Dist: python-markdown-math>=0.8
|
|
21
21
|
Provides-Extra: all
|
|
22
|
-
Requires-Dist: cirq-core
|
|
23
|
-
Requires-Dist: cirq-ionq
|
|
24
|
-
Requires-Dist: vcrpy
|
|
25
|
-
Requires-Dist: azure-devtools
|
|
26
|
-
Requires-Dist: graphviz
|
|
27
|
-
Requires-Dist: pulser
|
|
28
|
-
Requires-Dist: qiskit-ionq
|
|
29
|
-
Requires-Dist: qiskit-qir
|
|
30
|
-
Requires-Dist: qiskit
|
|
31
|
-
Requires-Dist: Markdown
|
|
32
|
-
Requires-Dist: python-markdown-math
|
|
33
|
-
Requires-Dist: qsharp
|
|
34
|
-
Requires-Dist: pyquil
|
|
22
|
+
Requires-Dist: cirq-core<=1.4.1,>=1.3.0; extra == "all"
|
|
23
|
+
Requires-Dist: cirq-ionq<=1.4.1,>=1.3.0; extra == "all"
|
|
24
|
+
Requires-Dist: vcrpy>=4.3.1; extra == "all"
|
|
25
|
+
Requires-Dist: azure-devtools<2.0,>=1.2.0; extra == "all"
|
|
26
|
+
Requires-Dist: graphviz>=0.20.1; extra == "all"
|
|
27
|
+
Requires-Dist: pulser<0.19,>=0.18; extra == "all"
|
|
28
|
+
Requires-Dist: qiskit-ionq<0.6,>=0.5; extra == "all"
|
|
29
|
+
Requires-Dist: qiskit-qir<0.6,>=0.5; extra == "all"
|
|
30
|
+
Requires-Dist: qiskit<2.0,>=1.0; extra == "all"
|
|
31
|
+
Requires-Dist: Markdown<4.0,>=3.4.1; extra == "all"
|
|
32
|
+
Requires-Dist: python-markdown-math<1.0,>=0.8.0; extra == "all"
|
|
33
|
+
Requires-Dist: qsharp<2.0,>=1.0.33; extra == "all"
|
|
34
|
+
Requires-Dist: pyquil>=3.3.2; extra == "all"
|
|
35
35
|
Provides-Extra: cirq
|
|
36
|
-
Requires-Dist: cirq-core
|
|
37
|
-
Requires-Dist: cirq-ionq
|
|
36
|
+
Requires-Dist: cirq-core<=1.4.1,>=1.3.0; extra == "cirq"
|
|
37
|
+
Requires-Dist: cirq-ionq<=1.4.1,>=1.3.0; extra == "cirq"
|
|
38
38
|
Provides-Extra: dev
|
|
39
|
-
Requires-Dist: vcrpy
|
|
40
|
-
Requires-Dist: azure-devtools
|
|
41
|
-
Requires-Dist: graphviz
|
|
39
|
+
Requires-Dist: vcrpy>=4.3.1; extra == "dev"
|
|
40
|
+
Requires-Dist: azure-devtools<2.0,>=1.2.0; extra == "dev"
|
|
41
|
+
Requires-Dist: graphviz>=0.20.1; extra == "dev"
|
|
42
42
|
Provides-Extra: pulser
|
|
43
|
-
Requires-Dist: pulser
|
|
43
|
+
Requires-Dist: pulser<0.19,>=0.18; extra == "pulser"
|
|
44
44
|
Provides-Extra: qiskit
|
|
45
|
-
Requires-Dist: qiskit-ionq
|
|
46
|
-
Requires-Dist: qiskit-qir
|
|
47
|
-
Requires-Dist: qiskit
|
|
48
|
-
Requires-Dist: Markdown
|
|
49
|
-
Requires-Dist: python-markdown-math
|
|
45
|
+
Requires-Dist: qiskit-ionq<0.6,>=0.5; extra == "qiskit"
|
|
46
|
+
Requires-Dist: qiskit-qir<0.6,>=0.5; extra == "qiskit"
|
|
47
|
+
Requires-Dist: qiskit<2.0,>=1.0; extra == "qiskit"
|
|
48
|
+
Requires-Dist: Markdown<4.0,>=3.4.1; extra == "qiskit"
|
|
49
|
+
Requires-Dist: python-markdown-math<1.0,>=0.8.0; extra == "qiskit"
|
|
50
50
|
Provides-Extra: qsharp
|
|
51
|
-
Requires-Dist: qsharp
|
|
51
|
+
Requires-Dist: qsharp<2.0,>=1.0.33; extra == "qsharp"
|
|
52
52
|
Provides-Extra: quil
|
|
53
|
-
Requires-Dist: pyquil
|
|
53
|
+
Requires-Dist: pyquil>=3.3.2; extra == "quil"
|
|
54
54
|
|
|
55
55
|

|
|
56
56
|
|
|
@@ -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=
|
|
5
|
+
azure/quantum/version.py,sha256=UKyDm7olfca_jl4kfZ2YJWPOicc_dGHFVc4HIlN0Fxo,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=
|
|
17
|
+
azure/quantum/_client/_version.py,sha256=qvePw7MpAjzl2NlBoHDo0GGUX4XuuZjihqAuUURVLNc,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
|
|
@@ -41,22 +41,22 @@ 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=
|
|
45
|
-
azure/quantum/qiskit/provider.py,sha256=
|
|
46
|
-
azure/quantum/qiskit/backends/__init__.py,sha256=
|
|
47
|
-
azure/quantum/qiskit/backends/backend.py,sha256=
|
|
48
|
-
azure/quantum/qiskit/backends/ionq.py,sha256=
|
|
44
|
+
azure/quantum/qiskit/job.py,sha256=zrm1HHW_9A9DG8XFO-y7xDZtsbuS64C8etFaF8XWotE,14888
|
|
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=nj4gYDPxp91uA_JfStnpJFU7hSw15Nsz8--9wmHFMXc,22024
|
|
48
|
+
azure/quantum/qiskit/backends/ionq.py,sha256=bDL7Oy85nK1iMbOlbhxOc8izBOqFGpZ593jCQ6PoMjg,14406
|
|
49
49
|
azure/quantum/qiskit/backends/microsoft.py,sha256=7Nw-z8KoIBOBXbP8aqhmhAeW9TENrwwkZk6LD31M9F0,3478
|
|
50
|
-
azure/quantum/qiskit/backends/qci.py,sha256=
|
|
51
|
-
azure/quantum/qiskit/backends/quantinuum.py,sha256=
|
|
52
|
-
azure/quantum/qiskit/backends/rigetti.py,sha256=
|
|
50
|
+
azure/quantum/qiskit/backends/qci.py,sha256=_t6IVUGe4LXzXSLLADwpvic2JTNxOSCsRl0s4zx3K7c,4656
|
|
51
|
+
azure/quantum/qiskit/backends/quantinuum.py,sha256=bwmhcZEnj71LMWT31six-WnZJ_b-YqP0VxzCZwnsa9g,13910
|
|
52
|
+
azure/quantum/qiskit/backends/rigetti.py,sha256=3XYr5C37MhGH6fm7LHX3UQ6BGYlSN9-q61Xd8WHEX5U,4112
|
|
53
53
|
azure/quantum/qiskit/results/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
54
|
azure/quantum/qiskit/results/resource_estimator.py,sha256=pAP5ZpVxdzNekQ_qXfSdSKYWWuqL_Vq7WK6pWU4wbEQ,814
|
|
55
55
|
azure/quantum/target/__init__.py,sha256=F0nIEJdlbczmxAdtvPDWf8J1Y33_XjPzloliHeWpJos,689
|
|
56
|
-
azure/quantum/target/ionq.py,sha256=
|
|
56
|
+
azure/quantum/target/ionq.py,sha256=cJ7jZHN8HSLvlxCSY6hNHf1dFog40PmVLfJ_PT5eVo4,8068
|
|
57
57
|
azure/quantum/target/params.py,sha256=oI-35HUEMCskNjpxCJU3tjL664K-TxqAg5LA5xU0nso,9130
|
|
58
|
-
azure/quantum/target/quantinuum.py,sha256=
|
|
59
|
-
azure/quantum/target/target.py,sha256=
|
|
58
|
+
azure/quantum/target/quantinuum.py,sha256=Fe84Mf927Bd4UrebOa0qx4qOH7SqOAlFE6zR42ioYec,7937
|
|
59
|
+
azure/quantum/target/target.py,sha256=GChB4kzTlETgLHlH8zIMPJX5W5m1GoOkrNqiCHw3R70,16281
|
|
60
60
|
azure/quantum/target/target_factory.py,sha256=jjZ9zxWaNDkcvslKV02GSP8rtXwStJ7EmVXQSOFh_j8,5266
|
|
61
61
|
azure/quantum/target/microsoft/__init__.py,sha256=36kM2YlWv69AzAfUA5wMdWyYRSaCMwX2Ajhffpzx67g,570
|
|
62
62
|
azure/quantum/target/microsoft/job.py,sha256=GM4OA-rxFUqQzsH8V59pVc4BmBaPYvd99E26pyPwxto,1249
|
|
@@ -71,8 +71,8 @@ azure/quantum/target/pasqal/result.py,sha256=SUvpnrtgvCGiepmNpyifW8b4p14-SZZ1ToC
|
|
|
71
71
|
azure/quantum/target/pasqal/target.py,sha256=DMt2uYeCeaUFh7vlnf687VOoRStXCWL-6Mk_Dub8anI,4833
|
|
72
72
|
azure/quantum/target/rigetti/__init__.py,sha256=I1vyzZBYGI540pauTqJd0RSSyTShGqkEL7Yjo25_RNY,378
|
|
73
73
|
azure/quantum/target/rigetti/result.py,sha256=65mtAZxfdNrTWNjWPqgfwt2BZN6Nllo4g_bls7-Nm68,2334
|
|
74
|
-
azure/quantum/target/rigetti/target.py,sha256=
|
|
75
|
-
azure_quantum-2.1.
|
|
76
|
-
azure_quantum-2.1.
|
|
77
|
-
azure_quantum-2.1.
|
|
78
|
-
azure_quantum-2.1.
|
|
74
|
+
azure/quantum/target/rigetti/target.py,sha256=ymfJX6khTfe6H26pxvbNgIVbd9cldP1OQ5CsF2PQHp0,7059
|
|
75
|
+
azure_quantum-2.1.2.dist-info/METADATA,sha256=v0yXxkGbBzJagpju4FMPhwjV1gKXhA4X86YvAOenDgw,7339
|
|
76
|
+
azure_quantum-2.1.2.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
77
|
+
azure_quantum-2.1.2.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
|
|
78
|
+
azure_quantum-2.1.2.dist-info/RECORD,,
|
|
File without changes
|