qiskit 1.1.0__cp38-abi3-win32.whl → 1.1.0rc1__cp38-abi3-win32.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.
Files changed (41) hide show
  1. qiskit/VERSION.txt +1 -1
  2. qiskit/_accelerate.pyd +0 -0
  3. qiskit/assembler/__init__.py +10 -5
  4. qiskit/circuit/__init__.py +150 -17
  5. qiskit/circuit/_classical_resource_map.py +0 -3
  6. qiskit/circuit/classical/expr/__init__.py +1 -1
  7. qiskit/circuit/classical/types/__init__.py +4 -5
  8. qiskit/circuit/classicalfunction/__init__.py +0 -1
  9. qiskit/circuit/library/__init__.py +19 -3
  10. qiskit/circuit/quantumcircuit.py +151 -1065
  11. qiskit/converters/__init__.py +2 -17
  12. qiskit/passmanager/passmanager.py +11 -11
  13. qiskit/primitives/__init__.py +5 -11
  14. qiskit/primitives/containers/__init__.py +0 -1
  15. qiskit/primitives/containers/bit_array.py +0 -1
  16. qiskit/primitives/containers/shape.py +3 -3
  17. qiskit/providers/__init__.py +17 -49
  18. qiskit/providers/basic_provider/__init__.py +23 -2
  19. qiskit/providers/fake_provider/__init__.py +1 -1
  20. qiskit/providers/models/__init__.py +2 -2
  21. qiskit/qobj/converters/pulse_instruction.py +6 -6
  22. qiskit/qpy/__init__.py +60 -58
  23. qiskit/quantum_info/operators/symplectic/pauli.py +4 -7
  24. qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +3 -7
  25. qiskit/result/__init__.py +0 -6
  26. qiskit/scheduler/__init__.py +1 -10
  27. qiskit/scheduler/methods/__init__.py +8 -1
  28. qiskit/synthesis/__init__.py +6 -1
  29. qiskit/transpiler/passes/__init__.py +2 -4
  30. qiskit/transpiler/passes/basis/basis_translator.py +2 -2
  31. qiskit/transpiler/passes/routing/commuting_2q_gate_routing/commuting_2q_gate_router.py +1 -8
  32. qiskit/transpiler/passes/routing/star_prerouting.py +5 -5
  33. qiskit/utils/__init__.py +2 -3
  34. qiskit/utils/parallel.py +15 -24
  35. qiskit/visualization/gate_map.py +1 -9
  36. {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/METADATA +1 -1
  37. {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/RECORD +41 -41
  38. {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/LICENSE.txt +0 -0
  39. {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/WHEEL +0 -0
  40. {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/entry_points.txt +0 -0
  41. {qiskit-1.1.0.dist-info → qiskit-1.1.0rc1.dist-info}/top_level.txt +0 -0
@@ -17,27 +17,12 @@ Circuit Converters (:mod:`qiskit.converters`)
17
17
 
18
18
  .. currentmodule:: qiskit.converters
19
19
 
20
- QuantumCircuit -> circuit components
21
- ====================================
22
-
23
- .. autofunction:: circuit_to_instruction
24
- .. autofunction:: circuit_to_gate
25
-
26
- QuantumCircuit <-> DagCircuit
27
- =============================
28
-
29
20
  .. autofunction:: circuit_to_dag
30
21
  .. autofunction:: dag_to_circuit
31
-
32
- QuantumCircuit <-> DagDependency
33
- ================================
34
-
22
+ .. autofunction:: circuit_to_instruction
23
+ .. autofunction:: circuit_to_gate
35
24
  .. autofunction:: dagdependency_to_circuit
36
25
  .. autofunction:: circuit_to_dagdependency
37
-
38
- DagCircuit <-> DagDependency
39
- ============================
40
-
41
26
  .. autofunction:: dag_to_dagdependency
42
27
  .. autofunction:: dagdependency_to_dag
43
28
  """
@@ -21,7 +21,7 @@ from typing import Any
21
21
 
22
22
  import dill
23
23
 
24
- from qiskit.utils.parallel import parallel_map, should_run_in_parallel
24
+ from qiskit.utils.parallel import parallel_map
25
25
  from .base_tasks import Task, PassManagerIR
26
26
  from .exceptions import PassManagerError
27
27
  from .flow_controllers import FlowControllerLinear
@@ -225,16 +225,16 @@ class BasePassManager(ABC):
225
225
  in_programs = [in_programs]
226
226
  is_list = False
227
227
 
228
- # If we're not going to run in parallel, we want to avoid spending time `dill` serialising
229
- # ourselves, since that can be quite expensive.
230
- if len(in_programs) == 1 or not should_run_in_parallel(num_processes):
231
- out = [
232
- _run_workflow(program=program, pass_manager=self, callback=callback, **kwargs)
233
- for program in in_programs
234
- ]
235
- if len(in_programs) == 1 and not is_list:
236
- return out[0]
237
- return out
228
+ if len(in_programs) == 1:
229
+ out_program = _run_workflow(
230
+ program=in_programs[0],
231
+ pass_manager=self,
232
+ callback=callback,
233
+ **kwargs,
234
+ )
235
+ if is_list:
236
+ return [out_program]
237
+ return out_program
238
238
 
239
239
  del callback
240
240
  del kwargs
@@ -51,7 +51,7 @@ define a computation unit of work for the estimator to complete:
51
51
  * a collection parameter value sets to bind the circuit against, :math:`\theta_k`.
52
52
 
53
53
  Running an estimator returns a :class:`~qiskit.primitives.BasePrimitiveJob` object, where calling
54
- the method :meth:`~qiskit.primitives.BasePrimitiveJob.result` results in expectation value estimates
54
+ the method :meth:`~qiskit.primitives.BasePrimitiveJob.result` results in expectation value estimates
55
55
  and metadata for each pub:
56
56
 
57
57
  .. math::
@@ -95,7 +95,7 @@ Here is an example of how an estimator is used.
95
95
  # [<psi2(theta2)|H2|psi2(theta2)>] ]
96
96
  job2 = estimator.run(
97
97
  [
98
- (psi1, [H1, H3], [theta1, theta3]),
98
+ (psi1, [H1, H3], [theta1, theta3]),
99
99
  (psi2, H2, theta2)
100
100
  ],
101
101
  precision=0.01
@@ -103,7 +103,7 @@ Here is an example of how an estimator is used.
103
103
  job_result = job2.result()
104
104
  print(f"The primitive-job finished with result {job_result}")
105
105
 
106
-
106
+
107
107
  Overview of SamplerV2
108
108
  =====================
109
109
 
@@ -220,8 +220,8 @@ Here is an example of how the estimator is used.
220
220
  # <psi2(theta2)|H2|psi2(theta2)>,
221
221
  # <psi1(theta3)|H3|psi1(theta3)> ]
222
222
  job2 = estimator.run(
223
- [psi1, psi2, psi1],
224
- [H1, H2, H3],
223
+ [psi1, psi2, psi1],
224
+ [H1, H2, H3],
225
225
  [theta1, theta2, theta3]
226
226
  )
227
227
  job_result = job2.result()
@@ -417,10 +417,8 @@ Results V2
417
417
  DataBin
418
418
  PrimitiveResult
419
419
  PubResult
420
- SamplerPubResult
421
420
  BasePrimitiveJob
422
421
  PrimitiveJob
423
- Shaped
424
422
 
425
423
  Estimator V1
426
424
  ------------
@@ -466,16 +464,12 @@ from .containers import (
466
464
  DataBin,
467
465
  PrimitiveResult,
468
466
  PubResult,
469
- SamplerPubResult,
470
467
  EstimatorPubLike,
471
468
  SamplerPubLike,
472
469
  BindingsArrayLike,
473
470
  ObservableLike,
474
471
  ObservablesArrayLike,
475
- Shaped,
476
472
  )
477
-
478
-
479
473
  from .estimator import Estimator
480
474
  from .primitive_job import BasePrimitiveJob, PrimitiveJob
481
475
  from .sampler import Sampler
@@ -24,4 +24,3 @@ from .primitive_result import PrimitiveResult
24
24
  from .pub_result import PubResult
25
25
  from .sampler_pub import SamplerPubLike
26
26
  from .sampler_pub_result import SamplerPubResult
27
- from .shape import Shaped
@@ -130,7 +130,6 @@ class BitArray(ShapedMixin):
130
130
  return f"BitArray({desc})"
131
131
 
132
132
  def __getitem__(self, indices):
133
- """Slices the array along an existing axis of the array."""
134
133
  if isinstance(indices, tuple) and len(indices) >= self.ndim + 2:
135
134
  raise ValueError(
136
135
  "BitArrays cannot be sliced along the bits axis, see slice_bits() instead."
@@ -59,15 +59,15 @@ class ShapedMixin(Shaped):
59
59
  return f"{type(self).__name__}(<{self.shape}>)"
60
60
 
61
61
  @property
62
- def shape(self) -> tuple[int, ...]:
62
+ def shape(self):
63
63
  return self._shape
64
64
 
65
65
  @property
66
- def ndim(self) -> int:
66
+ def ndim(self):
67
67
  return len(self._shape)
68
68
 
69
69
  @property
70
- def size(self) -> int:
70
+ def size(self):
71
71
  return int(np.prod(self._shape, dtype=int))
72
72
 
73
73
 
@@ -131,6 +131,7 @@ Exceptions
131
131
  .. autoexception:: JobTimeoutError
132
132
  .. autoexception:: BackendConfigurationError
133
133
 
134
+ =====================
134
135
  Writing a New Backend
135
136
  =====================
136
137
 
@@ -163,7 +164,7 @@ For a simple example of a provider, see the
163
164
  `qiskit-aqt-provider <https://github.com/Qiskit-Partners/qiskit-aqt-provider>`__
164
165
 
165
166
  Provider
166
- --------
167
+ ========
167
168
 
168
169
  A provider class serves a single purpose: to get backend objects that enable
169
170
  executing circuits on a device or simulator. The expectation is that any
@@ -194,7 +195,7 @@ authentication (if required) are present in the class and that the backends
194
195
  method matches the required interface. The rest is up to the specific provider on how to implement.
195
196
 
196
197
  Backend
197
- -------
198
+ =======
198
199
 
199
200
  The backend classes are the core to the provider. These classes are what
200
201
  provide the interface between Qiskit and the hardware or simulator that will
@@ -275,8 +276,8 @@ example would be something like::
275
276
  return MyJob(self. job_handle, job_json, circuit)
276
277
 
277
278
 
278
- Backend's Transpiler Interface
279
- ------------------------------
279
+ Transpiler Interface
280
+ --------------------
280
281
 
281
282
  The key piece of the :class:`~qiskit.providers.Backend` object is how it describes itself to the
282
283
  compiler. This is handled with the :class:`~qiskit.transpiler.Target` class which defines
@@ -452,45 +453,8 @@ This way if these two compilation steps are **required** for running or providin
452
453
  efficient output on ``Mybackend`` the transpiler will be able to perform these
453
454
  custom steps without any manual user input.
454
455
 
455
- .. _providers-guide-real-time-variables:
456
-
457
- Real-time variables
458
- ^^^^^^^^^^^^^^^^^^^
459
-
460
- The transpiler will automatically handle real-time typed classical variables (see
461
- :mod:`qiskit.circuit.classical`) and treat the :class:`.Store` instruction as a built-in
462
- "directive", similar to :class:`.Barrier`. No special handling from backends is necessary to permit
463
- this.
464
-
465
- If your backend is *unable* to handle classical variables and storage, we recommend that you comment
466
- on this in your documentation, and insert a check into your :meth:`~.BackendV2.run` method (see
467
- :ref:`providers-guide-backend-run`) to eagerly reject circuits containing them. You can examine
468
- :attr:`.QuantumCircuit.num_vars` for the presence of variables at the top level. If you accept
469
- :ref:`control-flow operations <circuit-control-flow-repr>`, you might need to recursively search the
470
- internal :attr:`~.ControlFlowOp.blocks` of each for scope-local variables with
471
- :attr:`.QuantumCircuit.num_declared_vars`.
472
-
473
- For example, a function to check for the presence of any manual storage locations, or manual stores
474
- to memory::
475
-
476
- from qiskit.circuit import Store, ControlFlowOp, QuantumCircuit
477
-
478
- def has_realtime_logic(circuit: QuantumCircuit) -> bool:
479
- if circuit.num_vars:
480
- return True
481
- for instruction in circuit.data:
482
- if isinstance(instruction.operation, Store):
483
- return True
484
- elif isinstance(instruction.operation, ControlFlowOp):
485
- for block in instruction.operation.blocks:
486
- if has_realtime_logic(block):
487
- return True
488
- return False
489
-
490
- .. _providers-guide-backend-run:
491
-
492
- Backend.run Method
493
- ------------------
456
+ Run Method
457
+ ----------
494
458
 
495
459
  Of key importance is the :meth:`~qiskit.providers.BackendV2.run` method, which
496
460
  is used to actually submit circuits to a device or simulator. The run method
@@ -520,8 +484,8 @@ An example run method would be something like::
520
484
  job_handle = submit_to_backend(job_jsonb)
521
485
  return MyJob(self. job_handle, job_json, circuit)
522
486
 
523
- Backend Options
524
- ---------------
487
+ Options
488
+ -------
525
489
 
526
490
  There are often several options for a backend that control how a circuit is run.
527
491
  The typical example of this is something like the number of ``shots`` which is
@@ -551,7 +515,7 @@ for a full list of validation options.
551
515
 
552
516
 
553
517
  Job
554
- ---
518
+ ===
555
519
 
556
520
  The output from the :obj:`~qiskit.providers.BackendV2.run` method is a :class:`~qiskit.providers.JobV1`
557
521
  object. Each provider is expected to implement a custom job subclass that
@@ -648,7 +612,7 @@ and for a sync job::
648
612
  return JobStatus.DONE
649
613
 
650
614
  Primitives
651
- ----------
615
+ ==========
652
616
 
653
617
  While not directly part of the provider interface, the :mod:`qiskit.primitives`
654
618
  module is tightly coupled with providers. Specifically the primitive
@@ -676,8 +640,12 @@ implementations. Also the built-in implementations: :class:`~.Sampler`,
676
640
  :class:`~.Estimator`, :class:`~.BackendSampler`, and :class:`~.BackendEstimator`
677
641
  can serve as references/models on how to implement these as well.
678
642
 
679
- Migrating from BackendV1 to BackendV2
680
- =====================================
643
+ ======================================
644
+ Migrating between Backend API Versions
645
+ ======================================
646
+
647
+ BackendV1 -> BackendV2
648
+ ======================
681
649
 
682
650
  The :obj:`~BackendV2` class re-defined user access for most properties of a
683
651
  backend to make them work with native Qiskit data structures and have flatter
@@ -27,15 +27,36 @@ via the `BasicProvider` provider, e.g.:
27
27
  backend = BasicProvider().get_backend('basic_simulator')
28
28
 
29
29
 
30
- Classes
31
- =======
30
+ Simulators
31
+ ==========
32
32
 
33
33
  .. autosummary::
34
34
  :toctree: ../stubs/
35
35
 
36
36
  BasicSimulator
37
+
38
+ Provider
39
+ ========
40
+
41
+ .. autosummary::
42
+ :toctree: ../stubs/
43
+
37
44
  BasicProvider
45
+
46
+ Job Class
47
+ =========
48
+
49
+ .. autosummary::
50
+ :toctree: ../stubs/
51
+
38
52
  BasicProviderJob
53
+
54
+ Exceptions
55
+ ==========
56
+
57
+ .. autosummary::
58
+ :toctree: ../stubs/
59
+
39
60
  BasicProviderError
40
61
  """
41
62
 
@@ -24,7 +24,7 @@ The fake provider module in Qiskit contains fake (simulated) backend classes
24
24
  useful for testing the transpiler and other backend-facing functionality.
25
25
 
26
26
  Example Usage
27
- -------------
27
+ =============
28
28
 
29
29
  Here is an example of using a simulated backend for transpilation and running.
30
30
 
@@ -19,8 +19,8 @@ Backend Objects (:mod:`qiskit.providers.models`)
19
19
 
20
20
  Qiskit schema-conformant objects used by the backends and providers.
21
21
 
22
- Classes
23
- =======
22
+ Backend Objects
23
+ ===============
24
24
 
25
25
  .. autosummary::
26
26
  :toctree: ../stubs/
@@ -234,7 +234,7 @@ class InstructionToQobjConverter:
234
234
  "name": "setf",
235
235
  "t0": time_offset + instruction.start_time,
236
236
  "ch": instruction.channel.name,
237
- "frequency": instruction.frequency / 10**9,
237
+ "frequency": instruction.frequency / 1e9,
238
238
  }
239
239
  return self._qobj_model(**command_dict)
240
240
 
@@ -257,7 +257,7 @@ class InstructionToQobjConverter:
257
257
  "name": "shiftf",
258
258
  "t0": time_offset + instruction.start_time,
259
259
  "ch": instruction.channel.name,
260
- "frequency": instruction.frequency / 10**9,
260
+ "frequency": instruction.frequency / 1e9,
261
261
  }
262
262
  return self._qobj_model(**command_dict)
263
263
 
@@ -746,7 +746,7 @@ class QobjToInstructionConverter:
746
746
  .. note::
747
747
 
748
748
  We assume frequency value is expressed in string with "GHz".
749
- Operand value is thus scaled by a factor of 10^9.
749
+ Operand value is thus scaled by a factor of 1e9.
750
750
 
751
751
  Args:
752
752
  instruction: SetFrequency qobj instruction
@@ -755,7 +755,7 @@ class QobjToInstructionConverter:
755
755
  Qiskit Pulse set frequency instructions
756
756
  """
757
757
  channel = self.get_channel(instruction.ch)
758
- frequency = self.disassemble_value(instruction.frequency) * 10**9
758
+ frequency = self.disassemble_value(instruction.frequency) * 1e9
759
759
 
760
760
  yield instructions.SetFrequency(frequency, channel)
761
761
 
@@ -768,7 +768,7 @@ class QobjToInstructionConverter:
768
768
  .. note::
769
769
 
770
770
  We assume frequency value is expressed in string with "GHz".
771
- Operand value is thus scaled by a factor of 10^9.
771
+ Operand value is thus scaled by a factor of 1e9.
772
772
 
773
773
  Args:
774
774
  instruction: ShiftFrequency qobj instruction
@@ -777,7 +777,7 @@ class QobjToInstructionConverter:
777
777
  Qiskit Pulse shift frequency schedule instructions
778
778
  """
779
779
  channel = self.get_channel(instruction.ch)
780
- frequency = self.disassemble_value(instruction.frequency) * 10**9
780
+ frequency = self.disassemble_value(instruction.frequency) * 1e9
781
781
 
782
782
  yield instructions.ShiftFrequency(frequency, channel)
783
783