iqm-client 29.11.0__py3-none-any.whl → 29.13.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.
iqm/cirq_iqm/__init__.py CHANGED
@@ -13,16 +13,7 @@
13
13
  # limitations under the License.
14
14
  """Cirq adapter for IQM's quantum computers."""
15
15
 
16
- import warnings
17
-
18
16
  from .devices import * # noqa: F403*
19
17
  from .extended_qasm_parser import circuit_from_qasm
20
18
  from .iqm_gates import * # noqa: F403
21
19
  from .transpiler import transpile_insert_moves_into_circuit
22
-
23
- warnings.warn(
24
- DeprecationWarning(
25
- "The cirq-iqm package is deprecated and new versions of Cirq on IQM will be published as part of "
26
- "iqm-client. Please uninstall cirq-iqm and install iqm-client[cirq] to get the newest version."
27
- )
28
- )
@@ -58,9 +58,11 @@ class IQMBackendBase(BackendV2, ABC):
58
58
  # qubits, or else transpiling with optimization_level=0 will fail because of lacking resonator indices.
59
59
  qb_to_idx = {qb: idx for idx, qb in enumerate(architecture.qubits + architecture.computational_resonators)}
60
60
 
61
- self._target = IQMTarget(architecture, qb_to_idx, include_resonators=False)
61
+ self._target = IQMTarget(architecture, component_to_idx=qb_to_idx, include_resonators=False)
62
62
  self._fake_target_with_moves = (
63
- IQMTarget(architecture, qb_to_idx, include_resonators=True) if "move" in architecture.gates else None
63
+ IQMTarget(architecture, component_to_idx=qb_to_idx, include_resonators=True)
64
+ if "move" in architecture.gates
65
+ else None
64
66
  )
65
67
  self._qb_to_idx = qb_to_idx
66
68
  self._idx_to_qb = {v: k for k, v in qb_to_idx.items()}
@@ -135,7 +137,10 @@ class IQMBackendBase(BackendV2, ABC):
135
137
  return "iqm_default_scheduling"
136
138
 
137
139
  def restrict_to_qubits(
138
- self, qubits: list[int] | list[str], include_resonators: bool = False, include_fake_czs: bool = True
140
+ self,
141
+ qubits: list[int] | list[str],
142
+ include_resonators: bool = False,
143
+ include_fake_czs: bool = True,
139
144
  ) -> IQMTarget:
140
145
  """Generated a restricted transpilation target from this backend that only contains the given qubits.
141
146
 
@@ -153,7 +158,10 @@ class IQMBackendBase(BackendV2, ABC):
153
158
 
154
159
 
155
160
  def _restrict_dqa_to_qubits(
156
- architecture: DynamicQuantumArchitecture, qubits: list[str], include_resonators: bool, include_fake_czs: bool = True
161
+ architecture: DynamicQuantumArchitecture,
162
+ qubits: list[str],
163
+ include_resonators: bool,
164
+ include_fake_czs: bool = True,
157
165
  ) -> IQMTarget:
158
166
  """Generated a restricted transpilation target from this backend that only contains the given qubits.
159
167
 
@@ -170,7 +178,10 @@ def _restrict_dqa_to_qubits(
170
178
  new_gates = {}
171
179
  for gate_name, gate_info in architecture.gates.items():
172
180
  new_implementations = {}
173
- for implementation_name, implementation_info in gate_info.implementations.items():
181
+ for (
182
+ implementation_name,
183
+ implementation_info,
184
+ ) in gate_info.implementations.items():
174
185
  new_loci = tuple(locus for locus in implementation_info.loci if all(q in qubits for q in locus))
175
186
  if new_loci:
176
187
  new_implementations[implementation_name] = GateImplementationInfo(loci=new_loci)
@@ -186,7 +197,12 @@ def _restrict_dqa_to_qubits(
186
197
  computational_resonators=[q for q in qubits if q in architecture.computational_resonators],
187
198
  gates=new_gates,
188
199
  )
189
- return IQMTarget(new_arch, {name: idx for idx, name in enumerate(qubits)}, include_resonators, include_fake_czs)
200
+ return IQMTarget(
201
+ new_arch,
202
+ component_to_idx={name: idx for idx, name in enumerate(qubits)},
203
+ include_resonators=include_resonators,
204
+ include_fake_czs=include_fake_czs,
205
+ )
190
206
 
191
207
 
192
208
  class IQMTarget(Target):
@@ -322,5 +338,8 @@ class IQMTarget(Target):
322
338
  """
323
339
  qubits_str = [self.iqm_idx_to_component[q] if isinstance(q, int) else str(q) for q in qubits]
324
340
  return _restrict_dqa_to_qubits(
325
- self.iqm_dqa, qubits_str, self.iqm_includes_resonators, self.iqm_includes_fake_czs
341
+ self.iqm_dqa,
342
+ qubits_str,
343
+ self.iqm_includes_resonators,
344
+ self.iqm_includes_fake_czs,
326
345
  )
@@ -103,7 +103,9 @@ class IQMNaiveResonatorMoving(TransformationPass):
103
103
  )
104
104
  try:
105
105
  routed_iqm_circuit = transpile_insert_moves(
106
- iqm_circuit, self.architecture, existing_moves=self.existing_moves_handling
106
+ iqm_circuit,
107
+ self.architecture,
108
+ existing_moves=self.existing_moves_handling,
107
109
  )
108
110
  routed_circuit = deserialize_instructions(
109
111
  list(routed_iqm_circuit.instructions), self.component_to_idx, layout
@@ -121,7 +123,11 @@ class IQMNaiveResonatorMoving(TransformationPass):
121
123
 
122
124
  # Create the new DAG and make sure that the qubits are properly ordered.
123
125
  ordered_qubits = [layout.get_physical_bits()[i] for i in range(len(layout.get_physical_bits()))]
124
- new_dag = circuit_to_dag(routed_circuit, qubit_order=ordered_qubits, clbit_order=routed_circuit.clbits)
126
+ new_dag = circuit_to_dag(
127
+ routed_circuit,
128
+ qubit_order=ordered_qubits,
129
+ clbit_order=routed_circuit.clbits,
130
+ )
125
131
 
126
132
  # Reinsert the symbolic parameters.
127
133
  for node in new_dag.topological_op_nodes():
@@ -208,6 +214,11 @@ def transpile_to_IQM( # noqa: PLR0913
208
214
 
209
215
  Works with both the Crystal and Star architectures.
210
216
 
217
+ Note: When transpiling a circuit with MOVE gates, you might need to set the `optimization_level` lower.
218
+ If the `optimization_level` is set too high, the transpiler might add single qubit gates onto the resonator,
219
+ which is not supported by the IQM Star architectures. If this in undesired, it is best to have the transpiler
220
+ add the MOVE gates automatically, rather than manually adding them to the circuit.
221
+
211
222
  Args:
212
223
  circuit: The circuit to be transpiled without MOVE gates.
213
224
  backend: The target backend to compile to. Does not require a resonator.
@@ -233,7 +244,7 @@ def transpile_to_IQM( # noqa: PLR0913
233
244
  restrict_to_qubits = [backend.qubit_name_to_index(q) if isinstance(q, str) else q for q in restrict_to_qubits]
234
245
 
235
246
  if target is None:
236
- if circuit.count_ops().get("move", 0) > 0:
247
+ if circuit.count_ops().get("move", 0) > 0 or circuit.num_qubits > backend.num_qubits:
237
248
  target = backend.target_with_resonators
238
249
  # Create a sensible initial layout if none is provided
239
250
  if initial_layout is None:
@@ -263,5 +274,10 @@ def transpile_to_IQM( # noqa: PLR0913
263
274
  + "`ignore_barriers`, and `existing_moves_handling` arguments."
264
275
  )
265
276
  qiskit_transpiler_kwargs["scheduling_method"] = scheduling_method
266
- new_circuit = transpile(circuit, target=target, initial_layout=initial_layout, **qiskit_transpiler_kwargs)
277
+ new_circuit = transpile(
278
+ circuit,
279
+ target=target,
280
+ initial_layout=initial_layout,
281
+ **qiskit_transpiler_kwargs,
282
+ )
267
283
  return new_circuit
@@ -22,7 +22,11 @@ from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary
22
22
  from qiskit.circuit.library import RGate, UnitaryGate
23
23
  from qiskit.dagcircuit import DAGCircuit
24
24
  from qiskit.transpiler.basepasses import TransformationPass
25
- from qiskit.transpiler.passes import BasisTranslator, Optimize1qGatesDecomposition, RemoveBarriers
25
+ from qiskit.transpiler.passes import (
26
+ BasisTranslator,
27
+ Optimize1qGatesDecomposition,
28
+ RemoveBarriers,
29
+ )
26
30
  from qiskit.transpiler.passmanager import PassManager
27
31
 
28
32
  TOLERANCE = 1e-10 # The tolerance for equivalence checking against zero.
@@ -73,12 +77,16 @@ class IQMOptimizeSingleQubitGates(TransformationPass):
73
77
  for node in dag.topological_op_nodes():
74
78
  if node.name == "u":
75
79
  # convert into PRX + RZ
76
- qubit_index = dag.find_bit(node.qargs[0])[0]
80
+ qubit_index = dag.find_bit(node.qargs[0]).index
77
81
  if isinstance(node.op.params[0], float) and math.isclose(node.op.params[0], 0, abs_tol=TOLERANCE):
78
82
  dag.remove_op_node(node)
79
83
  else:
80
84
  dag.substitute_node(
81
- node, RGate(node.op.params[0], np.pi / 2 - node.op.params[2] - rz_angles[qubit_index])
85
+ node,
86
+ RGate(
87
+ node.op.params[0],
88
+ np.pi / 2 - node.op.params[2] - rz_angles[qubit_index],
89
+ ),
82
90
  )
83
91
  phase = node.op.params[1] + node.op.params[2]
84
92
  dag.global_phase += phase / 2
@@ -89,7 +97,7 @@ class IQMOptimizeSingleQubitGates(TransformationPass):
89
97
  # are arbitrary so we could set rz_angles to any values here, but zeroing the
90
98
  # angles results in fewest changes to the circuit.
91
99
  for qubit in node.qargs:
92
- rz_angles[dag.find_bit(qubit)[0]] = 0
100
+ rz_angles[dag.find_bit(qubit).index] = 0
93
101
  elif node.name == "barrier":
94
102
  # TODO barriers are meant to restrict circuit optimization, so strictly speaking
95
103
  # we should output any accumulated ``rz_angles`` here as explicit z rotations (like
@@ -100,7 +108,10 @@ class IQMOptimizeSingleQubitGates(TransformationPass):
100
108
  pass
101
109
  elif node.name == "move":
102
110
  # acts like iSWAP with RZ, moving it to the other component
103
- qb, res = dag.find_bit(node.qargs[0])[0], dag.find_bit(node.qargs[1])[0]
111
+ qb, res = (
112
+ dag.find_bit(node.qargs[0]).index,
113
+ dag.find_bit(node.qargs[1]).index,
114
+ )
104
115
  rz_angles[res], rz_angles[qb] = rz_angles[qb], rz_angles[res]
105
116
  elif node.name in {"cz", "delay"}:
106
117
  pass # commutes with RZ gates
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-client
3
- Version: 29.11.0
3
+ Version: 29.13.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
@@ -227,6 +227,8 @@ Requires-Dist: iqm-station-control-client <10,>=9 ; extra == 'cirq'
227
227
  Requires-Dist: iqm-exa-common <27,>=26 ; extra == 'cirq'
228
228
  Requires-Dist: cirq-core[contrib] ~=1.2 ; extra == 'cirq'
229
229
  Requires-Dist: ply ==3.11 ; extra == 'cirq'
230
+ Requires-Dist: llvmlite >=0.44.0 ; extra == 'cirq'
231
+ Requires-Dist: numba >=0.61.0 ; extra == 'cirq'
230
232
  Provides-Extra: cli
231
233
  Requires-Dist: iqm-station-control-client <10,>=9 ; extra == 'cli'
232
234
  Requires-Dist: iqm-exa-common <27,>=26 ; extra == 'cli'
@@ -238,8 +240,8 @@ Requires-Dist: python-daemon >=2.3.0 ; extra == 'cli'
238
240
  Provides-Extra: qiskit
239
241
  Requires-Dist: iqm-station-control-client <10,>=9 ; extra == 'qiskit'
240
242
  Requires-Dist: iqm-exa-common <27,>=26 ; extra == 'qiskit'
241
- Requires-Dist: qiskit <1.3,>=1.0 ; extra == 'qiskit'
242
- Requires-Dist: qiskit-aer <0.16,>=0.13.1 ; extra == 'qiskit'
243
+ Requires-Dist: qiskit <=1.4.2,>=1.0 ; extra == 'qiskit'
244
+ Requires-Dist: qiskit-aer <0.18,>=0.13.1 ; extra == 'qiskit'
243
245
 
244
246
  IQM Client
245
247
  ###########
@@ -1,4 +1,4 @@
1
- iqm/cirq_iqm/__init__.py,sha256=QpdI1542qLHx9eTMy3CFJ7oj2BwVZ_LWKe6KxQAh5Zc,1107
1
+ iqm/cirq_iqm/__init__.py,sha256=1zTyxtF39OD11D00ZujgqciJ_9GBDYe-PVBLqZp4NaA,831
2
2
  iqm/cirq_iqm/extended_qasm_parser.py,sha256=csDzfHLhy_9maGbappLbnFo2NHQjQeyd-1F8P380Mbk,1917
3
3
  iqm/cirq_iqm/iqm_gates.py,sha256=xnZex5ZfNOk_WSsFjVCRybc14FlGNbmwOs3mIfOE_F8,2488
4
4
  iqm/cirq_iqm/iqm_sampler.py,sha256=MLHB5FiBXsTCnxjlNJV8LhrIuZ2RS6946zEhI6OBmh4,11456
@@ -33,14 +33,14 @@ iqm/iqm_client/cli/cli.py,sha256=YhTgOGrvNXPwCdCKHcwLHeE_6C3n91MxFhvgQYT78C4,286
33
33
  iqm/iqm_client/cli/models.py,sha256=Hu-t6c_07Cth3AuQBo0CDTcWVQg1xbJCpy_94V0o64U,1199
34
34
  iqm/iqm_client/cli/token_manager.py,sha256=e8M3UihnawxGlajAw5AP6x4TEH5PaCRQ4ADNnRw4wUI,6967
35
35
  iqm/qiskit_iqm/__init__.py,sha256=Mv9V_r8ZcmGC8Ke5S8-7yLOx02vjZ1qiVx8mtbOpwnY,1420
36
- iqm/qiskit_iqm/iqm_backend.py,sha256=LhyhccB9u_Y4lyFTzAQkYfX7CI_hbBx3CQHwbwR3wlA,13975
36
+ iqm/qiskit_iqm/iqm_backend.py,sha256=WMGBg1jbtTvrmJ7ZrXVixgfb6Hm5qKa-2xi5R8cl0IM,14237
37
37
  iqm/qiskit_iqm/iqm_circuit.py,sha256=fFQW8SRlgZjqZUOLfyuJhhXEDp5I1jopFWa1k4rb7ac,1384
38
38
  iqm/qiskit_iqm/iqm_circuit_validation.py,sha256=vE5CNyJOQ7OMRpQV-xsO1uf_NNFE8v6-TSzboFSrGYM,1721
39
39
  iqm/qiskit_iqm/iqm_job.py,sha256=Q26hk4JuZP48Xw3qVk4b44LrHbgNQp-mq_itF9umkqg,11666
40
40
  iqm/qiskit_iqm/iqm_move_layout.py,sha256=pHqV1G4bri3rFEsMBN6FrtQ0FXVNQG-Ymm4v7zdnilQ,10787
41
- iqm/qiskit_iqm/iqm_naive_move_pass.py,sha256=HoLPgkRK7X2g8KM2ML5-rggNE5HIfGEzq4vkthYSPyg,12398
41
+ iqm/qiskit_iqm/iqm_naive_move_pass.py,sha256=OQpKiiw-UoNdcjyqJ1Oay9zMsg5IihU-r4ZboXQptkA,12983
42
42
  iqm/qiskit_iqm/iqm_provider.py,sha256=5L2-GFbTqMlW7JTagRxl2pV2kw0KKA4hw2YGLYsoUvk,16640
43
- iqm/qiskit_iqm/iqm_transpilation.py,sha256=2bwvVd8NwBRU6gwlPOsovhyAmUnm8thKokvkuCwfWC8,8915
43
+ iqm/qiskit_iqm/iqm_transpilation.py,sha256=2PyDAOukJpvSIVXmuYB8EWhmzlJHBUpzFPbW5VhfApg,9113
44
44
  iqm/qiskit_iqm/move_gate.py,sha256=QU9RKKVvbGq33qcIi9AKLcvQVQMibkgW4ibjzk-oVy4,2808
45
45
  iqm/qiskit_iqm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  iqm/qiskit_iqm/qiskit_to_iqm.py,sha256=9JGcR_7K1Y5W6_PBP1bVCZqy7khCOa-BU9m1I9MJB5k,15056
@@ -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.11.0.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
60
- iqm_client-29.11.0.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
61
- iqm_client-29.11.0.dist-info/METADATA,sha256=yvcSPUwsECazAvq9XipwpCL511HB2NGswPmSdlflKn4,17591
62
- iqm_client-29.11.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
63
- iqm_client-29.11.0.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
64
- iqm_client-29.11.0.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
65
- iqm_client-29.11.0.dist-info/RECORD,,
59
+ iqm_client-29.13.0.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
60
+ iqm_client-29.13.0.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
61
+ iqm_client-29.13.0.dist-info/METADATA,sha256=C4YQqf3isnS5OXicwWmY_VlKZxSoflJRm8X0eXzuCs0,17693
62
+ iqm_client-29.13.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
63
+ iqm_client-29.13.0.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
64
+ iqm_client-29.13.0.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
65
+ iqm_client-29.13.0.dist-info/RECORD,,