qiskit 1.1.0__cp38-abi3-win_amd64.whl → 1.1.0rc1__cp38-abi3-win_amd64.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
qiskit/qpy/__init__.py CHANGED
@@ -11,9 +11,9 @@
11
11
  # that they have been altered from the originals.
12
12
 
13
13
  """
14
- =====================================
14
+ ###########################################################
15
15
  QPY serialization (:mod:`qiskit.qpy`)
16
- =====================================
16
+ ###########################################################
17
17
 
18
18
  .. currentmodule:: qiskit.qpy
19
19
 
@@ -32,8 +32,9 @@ which will preserve the Qiskit object exactly but will only work for a single Qi
32
32
  version (it is also
33
33
  `potentially insecure <https://docs.python.org/3/library/pickle.html#module-pickle>`__).
34
34
 
35
- Basic Usage
36
- ===========
35
+ *********
36
+ Using QPY
37
+ *********
37
38
 
38
39
  Using QPY is defined to be straightforward and mirror the user API of the
39
40
  serializers in Python's standard library, ``pickle`` and ``json``. There are
@@ -247,8 +248,9 @@ of QPY in qiskit-terra 0.18.0.
247
248
 
248
249
  .. _qpy_format:
249
250
 
251
+ **********
250
252
  QPY Format
251
- ==========
253
+ **********
252
254
 
253
255
  The QPY serialization format is a portable cross-platform binary
254
256
  serialization format for :class:`~qiskit.circuit.QuantumCircuit` objects in Qiskit. The basic
@@ -301,14 +303,14 @@ circuits in the data.
301
303
  .. _qpy_version_12:
302
304
 
303
305
  Version 12
304
- ----------
306
+ ==========
305
307
 
306
308
  Version 12 adds support for:
307
309
 
308
310
  * circuits containing memory-owning :class:`.expr.Var` variables.
309
311
 
310
312
  Changes to HEADER
311
- ~~~~~~~~~~~~~~~~~
313
+ -----------------
312
314
 
313
315
  The HEADER struct for an individual circuit has added three ``uint32_t`` counts of the input,
314
316
  captured and locally declared variables in the circuit. The new form looks like:
@@ -334,7 +336,7 @@ that, the data continues with custom definitions and instructions as in prior ve
334
336
 
335
337
 
336
338
  EXPR_VAR_DECLARATION
337
- ~~~~~~~~~~~~~~~~~~~~
339
+ --------------------
338
340
 
339
341
  An ``EXPR_VAR_DECLARATION`` defines an :class:`.expr.Var` instance that is standalone; that is, it
340
342
  represents a self-owned memory location rather than wrapping a :class:`.Clbit` or
@@ -365,7 +367,7 @@ Type code Meaning
365
367
 
366
368
 
367
369
  Changes to EXPR_VAR
368
- ~~~~~~~~~~~~~~~~~~~
370
+ -------------------
369
371
 
370
372
  The EXPR_VAR variable has gained a new type code and payload, in addition to the pre-existing ones:
371
373
 
@@ -398,7 +400,7 @@ Qiskit class Type code Payload
398
400
  .. _qpy_version_11:
399
401
 
400
402
  Version 11
401
- ----------
403
+ ==========
402
404
 
403
405
  Version 11 is identical to Version 10 except for the following.
404
406
  First, the names in the CUSTOM_INSTRUCTION blocks
@@ -416,7 +418,7 @@ MODIFIER struct.
416
418
  .. _modifier_qpy:
417
419
 
418
420
  MODIFIER
419
- ~~~~~~~~
421
+ --------
420
422
 
421
423
  This represents :class:`~qiskit.circuit.annotated_operation.Modifier`
422
424
 
@@ -439,7 +441,7 @@ operation, and in the third case the field ``power`` represents the power of the
439
441
  .. _qpy_version_10:
440
442
 
441
443
  Version 10
442
- ----------
444
+ ==========
443
445
 
444
446
  Version 10 adds support for:
445
447
 
@@ -452,7 +454,7 @@ is introduced, mapped to each symbolic library as follows: ``p`` refers to sympy
452
454
  encoding and ``e`` refers to symengine encoding.
453
455
 
454
456
  Changes to FILE_HEADER
455
- ~~~~~~~~~~~~~~~~~~~~~~
457
+ ----------------------
456
458
 
457
459
  The contents of FILE_HEADER after V10 are defined as a C struct as:
458
460
 
@@ -468,7 +470,7 @@ The contents of FILE_HEADER after V10 are defined as a C struct as:
468
470
  } FILE_HEADER_V10;
469
471
 
470
472
  Changes to LAYOUT
471
- ~~~~~~~~~~~~~~~~~
473
+ -----------------
472
474
 
473
475
  The ``LAYOUT`` struct is updated to have an additional ``input_qubit_count`` field.
474
476
  With version 10 the ``LAYOUT`` struct is now:
@@ -491,14 +493,14 @@ and ``_output_qubit_list`` in the :class:`~.TranspileLayout` object are ``None``
491
493
  .. _qpy_version_9:
492
494
 
493
495
  Version 9
494
- ---------
496
+ =========
495
497
 
496
498
  Version 9 adds support for classical :class:`~.expr.Expr` nodes and their associated
497
499
  :class:`~.types.Type`\\ s.
498
500
 
499
501
 
500
502
  EXPRESSION
501
- ~~~~~~~~~~
503
+ ----------
502
504
 
503
505
  An :class:`~.expr.Expr` node is represented by a stream of variable-width data. A node itself is
504
506
  represented by (in order in the byte stream):
@@ -530,7 +532,7 @@ Qiskit class Type code Payload
530
532
 
531
533
 
532
534
  EXPR_TYPE
533
- ~~~~~~~~~
535
+ ---------
534
536
 
535
537
  A :class:`~.types.Type` is encoded by a single-byte ASCII ``char`` that encodes the kind of type,
536
538
  followed by a payload that varies depending on the type. The defined codes are:
@@ -545,7 +547,7 @@ Qiskit class Type code Payload
545
547
 
546
548
 
547
549
  EXPR_VAR
548
- ~~~~~~~~
550
+ --------
549
551
 
550
552
  This represents a runtime variable of a :class:`~.expr.Var` node. These are a type code, followed
551
553
  by a type-code-specific payload:
@@ -562,7 +564,7 @@ Python class Type code Payload
562
564
 
563
565
 
564
566
  EXPR_VALUE
565
- ~~~~~~~~~~
567
+ ----------
566
568
 
567
569
  This represents a literal object in the classical type system, such as an integer. Currently there
568
570
  are very few such literals. These are encoded as a type code, followed by a type-code-specific
@@ -580,7 +582,7 @@ Python type Type code Payload
580
582
 
581
583
 
582
584
  Changes to INSTRUCTION
583
- ~~~~~~~~~~~~~~~~~~~~~~
585
+ ----------------------
584
586
 
585
587
  To support the use of :class:`~.expr.Expr` nodes in the fields :attr:`.IfElseOp.condition`,
586
588
  :attr:`.WhileLoopOp.condition` and :attr:`.SwitchCaseOp.target`, the INSTRUCTION struct is changed
@@ -627,7 +629,7 @@ Value Effects
627
629
 
628
630
 
629
631
  Changes to INSTRUCTION_PARAM
630
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
632
+ ----------------------------
631
633
 
632
634
  A new type code ``x`` is added that defines an EXPRESSION parameter.
633
635
 
@@ -635,7 +637,7 @@ A new type code ``x`` is added that defines an EXPRESSION parameter.
635
637
  .. _qpy_version_8:
636
638
 
637
639
  Version 8
638
- ---------
640
+ =========
639
641
 
640
642
  Version 8 adds support for handling a :class:`~.TranspileLayout` stored in the
641
643
  :attr:`.QuantumCircuit.layout` attribute. In version 8 immediately following the
@@ -644,7 +646,7 @@ calibrations block at the end of the circuit payload there is now the
644
646
  :class:`~.TranspileLayout` class.
645
647
 
646
648
  LAYOUT
647
- ~~~~~~
649
+ ------
648
650
 
649
651
  .. code-block:: c
650
652
 
@@ -666,7 +668,7 @@ are ``initial_layout_size`` ``INITIAL_LAYOUT_BIT`` structs to define the
666
668
  :attr:`.TranspileLayout.initial_layout` attribute.
667
669
 
668
670
  INITIAL_LAYOUT_BIT
669
- ~~~~~~~~~~~~~~~~~~
671
+ ------------------
670
672
 
671
673
  .. code-block:: c
672
674
 
@@ -692,7 +694,7 @@ circuit.
692
694
  .. _qpy_version_7:
693
695
 
694
696
  Version 7
695
- ---------
697
+ =========
696
698
 
697
699
  Version 7 adds support for :class:`.~Reference` instruction and serialization of
698
700
  a :class:`.~ScheduleBlock` program while keeping its reference to subroutines::
@@ -738,7 +740,7 @@ condition of an INSTRUCTION field <qpy_instructions>`.
738
740
  .. _qpy_version_6:
739
741
 
740
742
  Version 6
741
- ---------
743
+ =========
742
744
 
743
745
  Version 6 adds support for :class:`.~ScalableSymbolicPulse`. These objects are saved and read
744
746
  like `SymbolicPulse` objects, and the class name is added to the data to correctly handle
@@ -765,7 +767,7 @@ identical to :ref:`qpy_version_5`.
765
767
  .. _qpy_version_5:
766
768
 
767
769
  Version 5
768
- ---------
770
+ =========
769
771
 
770
772
  Version 5 changes from :ref:`qpy_version_4` by adding support for :class:`.~ScheduleBlock`
771
773
  and changing two payloads the INSTRUCTION metadata payload and the CUSTOM_INSTRUCTION block.
@@ -800,7 +802,7 @@ immediately follows the file header block to represent the program type stored i
800
802
  .. _qpy_schedule_block:
801
803
 
802
804
  SCHEDULE_BLOCK
803
- ~~~~~~~~~~~~~~
805
+ --------------
804
806
 
805
807
  :class:`~.ScheduleBlock` is first supported in QPY Version 5. This allows
806
808
  users to save pulse programs in the QPY binary format as follows:
@@ -825,7 +827,7 @@ no extra option is required to save the schedule block.
825
827
  .. _qpy_schedule_block_header:
826
828
 
827
829
  SCHEDULE_BLOCK_HEADER
828
- ~~~~~~~~~~~~~~~~~~~~~
830
+ ---------------------
829
831
 
830
832
  :class:`~.ScheduleBlock` block starts with the following header:
831
833
 
@@ -844,7 +846,7 @@ attached to the schedule.
844
846
  .. _qpy_schedule_alignments:
845
847
 
846
848
  SCHEDULE_BLOCK_ALIGNMENTS
847
- ~~~~~~~~~~~~~~~~~~~~~~~~~
849
+ -------------------------
848
850
 
849
851
  Then, alignment context of the schedule block starts with ``char``
850
852
  representing the supported context type followed by the :ref:`qpy_sequence` block representing
@@ -862,7 +864,7 @@ stored in the context parameters.
862
864
  .. _qpy_schedule_instructions:
863
865
 
864
866
  SCHEDULE_BLOCK_INSTRUCTIONS
865
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
867
+ ---------------------------
866
868
 
867
869
  This alignment block is further followed by ``num_element`` length of block elements which may
868
870
  consist of nested schedule blocks and schedule instructions.
@@ -887,7 +889,7 @@ The mapping of type char to the instruction subclass is defined as follows:
887
889
  .. _qpy_schedule_operands:
888
890
 
889
891
  SCHEDULE_BLOCK_OPERANDS
890
- ~~~~~~~~~~~~~~~~~~~~~~~
892
+ -----------------------
891
893
 
892
894
  The operands of these instances can be serialized through the standard QPY value serialization
893
895
  mechanism, however there are special object types that only appear in the schedule operands.
@@ -904,7 +906,7 @@ Special objects start with the following type key:
904
906
  .. _qpy_schedule_channel:
905
907
 
906
908
  CHANNEL
907
- ~~~~~~~
909
+ -------
908
910
 
909
911
  Channel block starts with channel subtype ``char`` that maps an object data to
910
912
  :class:`~qiskit.pulse.channels.Channel` subclass. Mapping is defined as follows:
@@ -921,7 +923,7 @@ The key is immediately followed by the channel index serialized as the INSTRUCTI
921
923
  .. _qpy_schedule_waveform:
922
924
 
923
925
  Waveform
924
- ~~~~~~~~
926
+ --------
925
927
 
926
928
  Waveform block starts with WAVEFORM header:
927
929
 
@@ -943,7 +945,7 @@ INSTRUCTION_PARAM pack struct, which can be string or ``None``.
943
945
  .. _qpy_schedule_symbolic_pulse:
944
946
 
945
947
  SymbolicPulse
946
- ~~~~~~~~~~~~~
948
+ -------------
947
949
 
948
950
  SymbolicPulse block starts with SYMBOLIC_PULSE header:
949
951
 
@@ -977,7 +979,7 @@ INSTRUCTION_PARAM pack struct, which can be string or ``None``.
977
979
  .. _qpy_mapping:
978
980
 
979
981
  MAPPING
980
- ~~~~~~~
982
+ -------
981
983
 
982
984
  The MAPPING is a representation for arbitrary mapping object. This is a fixed length
983
985
  :ref:`qpy_sequence` of key-value pair represented by the MAP_ITEM payload.
@@ -999,7 +1001,7 @@ QPY serializable ``type``.
999
1001
  .. _qpy_circuit_calibrations:
1000
1002
 
1001
1003
  CIRCUIT_CALIBRATIONS
1002
- ~~~~~~~~~~~~~~~~~~~~
1004
+ --------------------
1003
1005
 
1004
1006
  The CIRCUIT_CALIBRATIONS block is a dictionary to define pulse calibrations of the custom
1005
1007
  instruction set. This block starts with the following CALIBRATION header:
@@ -1034,7 +1036,7 @@ Finally, :ref:`qpy_schedule_block` payload is packed for each CALIBRATION_DEF en
1034
1036
  .. _qpy_instruction_v5:
1035
1037
 
1036
1038
  INSTRUCTION
1037
- ~~~~~~~~~~~
1039
+ -----------
1038
1040
 
1039
1041
  The INSTRUCTION block was modified to add two new fields ``num_ctrl_qubits`` and ``ctrl_state``
1040
1042
  which are used to model the :attr:`.ControlledGate.num_ctrl_qubits` and
@@ -1060,7 +1062,7 @@ The rest of the instruction payload is the same. You can refer to
1060
1062
  :ref:`qpy_instructions` for the details of the full payload.
1061
1063
 
1062
1064
  CUSTOM_INSTRUCTION
1063
- ~~~~~~~~~~~~~~~~~~
1065
+ ------------------
1064
1066
 
1065
1067
  The CUSTOM_INSTRUCTION block in QPY version 5 adds a new field
1066
1068
  ``base_gate_size`` which is used to define the size of the
@@ -1103,7 +1105,7 @@ indicate the custom instruction is a custom :class:`~.ControlledGate`.
1103
1105
  .. _qpy_version_4:
1104
1106
 
1105
1107
  Version 4
1106
- ---------
1108
+ =========
1107
1109
 
1108
1110
  Version 4 is identical to :ref:`qpy_version_3` except that it adds 2 new type strings
1109
1111
  to the INSTRUCTION_PARAM struct, ``z`` to represent ``None`` (which is encoded as
@@ -1133,7 +1135,7 @@ part of the circuit or not.
1133
1135
  .. _qpy_range_pack:
1134
1136
 
1135
1137
  RANGE
1136
- ~~~~~
1138
+ -----
1137
1139
 
1138
1140
  A RANGE is a representation of a ``range`` object. It is defined as:
1139
1141
 
@@ -1148,7 +1150,7 @@ A RANGE is a representation of a ``range`` object. It is defined as:
1148
1150
  .. _qpy_sequence:
1149
1151
 
1150
1152
  SEQUENCE
1151
- ~~~~~~~~
1153
+ --------
1152
1154
 
1153
1155
  A SEQUENCE is a representation of an arbitrary sequence object. As sequence are just fixed length
1154
1156
  containers of arbitrary python objects their QPY can't fully represent any sequence,
@@ -1170,7 +1172,7 @@ into proper type, e.g. ``tuple``, afterwards.
1170
1172
  .. _qpy_version_3:
1171
1173
 
1172
1174
  Version 3
1173
- ---------
1175
+ =========
1174
1176
 
1175
1177
  Version 3 of the QPY format is identical to :ref:`qpy_version_2` except that it defines
1176
1178
  a struct format to represent a :class:`~qiskit.circuit.library.PauliEvolutionGate`
@@ -1185,7 +1187,7 @@ as follows:
1185
1187
  .. _pauli_evo_qpy:
1186
1188
 
1187
1189
  PAULI_EVOLUTION
1188
- ~~~~~~~~~~~~~~~
1190
+ ---------------
1189
1191
 
1190
1192
  This represents the high level :class:`~qiskit.circuit.library.PauliEvolutionGate`
1191
1193
 
@@ -1213,7 +1215,7 @@ the :class:`.EvolutionSynthesis` class used by the gate.
1213
1215
  .. _qpy_pauli_sum_op:
1214
1216
 
1215
1217
  SPARSE_PAULI_OP_LIST_ELEM
1216
- ~~~~~~~~~~~~~~~~~~~~~~~~~
1218
+ -------------------------
1217
1219
 
1218
1220
  This represents an instance of :class:`.SparsePauliOp`.
1219
1221
 
@@ -1237,7 +1239,7 @@ parameters are defined below as :ref:`qpy_param_vector`.
1237
1239
  .. _qpy_param_vector:
1238
1240
 
1239
1241
  PARAMETER_VECTOR_ELEMENT
1240
- ~~~~~~~~~~~~~~~~~~~~~~~~
1242
+ ------------------------
1241
1243
 
1242
1244
  A PARAMETER_VECTOR_ELEMENT represents a :class:`~qiskit.circuit.ParameterVectorElement`
1243
1245
  object the data for a INSTRUCTION_PARAM. The contents of the PARAMETER_VECTOR_ELEMENT are
@@ -1259,7 +1261,7 @@ the parameter's vector name.
1259
1261
 
1260
1262
 
1261
1263
  PARAMETER_EXPR
1262
- ~~~~~~~~~~~~~~
1264
+ --------------
1263
1265
 
1264
1266
  Additionally, since QPY format version v3 distinguishes between a
1265
1267
  :class:`~qiskit.circuit.Parameter` and :class:`~qiskit.circuit.ParameterVectorElement`
@@ -1313,14 +1315,14 @@ and size will be 0 as the value will just be the same as the key. If
1313
1315
  .. _qpy_version_2:
1314
1316
 
1315
1317
  Version 2
1316
- ---------
1318
+ =========
1317
1319
 
1318
1320
  Version 2 of the QPY format is identical to version 1 except for the HEADER
1319
1321
  section is slightly different. You can refer to the :ref:`qpy_version_1` section
1320
1322
  for the details on the rest of the payload format.
1321
1323
 
1322
1324
  HEADER
1323
- ~~~~~~
1325
+ ------
1324
1326
 
1325
1327
  The contents of HEADER are defined as a C struct are:
1326
1328
 
@@ -1350,10 +1352,10 @@ object which is represented by a PARAM struct (see below), ``e`` defines a
1350
1352
  .. _qpy_version_1:
1351
1353
 
1352
1354
  Version 1
1353
- ---------
1355
+ =========
1354
1356
 
1355
1357
  HEADER
1356
- ~~~~~~
1358
+ ------
1357
1359
 
1358
1360
  The contents of HEADER as defined as a C struct are:
1359
1361
 
@@ -1373,7 +1375,7 @@ This is immediately followed by ``name_size`` bytes of utf8 data for the name
1373
1375
  of the circuit.
1374
1376
 
1375
1377
  METADATA
1376
- ~~~~~~~~
1378
+ --------
1377
1379
 
1378
1380
  The METADATA field is a UTF8 encoded JSON string. After reading the HEADER
1379
1381
  (which is a fixed size at the start of the QPY file) and the ``name`` string
@@ -1383,7 +1385,7 @@ the metadata for the circuit.
1383
1385
  .. _qpy_registers:
1384
1386
 
1385
1387
  REGISTERS
1386
- ~~~~~~~~~
1388
+ ---------
1387
1389
 
1388
1390
  The contents of REGISTERS is a number of REGISTER object. If num_registers is
1389
1391
  > 0 then after reading METADATA you read that number of REGISTER structs defined
@@ -1433,7 +1435,7 @@ the register ``qr`` would be a standalone register. While something like::
1433
1435
  .. _qpy_custom_definition:
1434
1436
 
1435
1437
  CUSTOM_DEFINITIONS
1436
- ~~~~~~~~~~~~~~~~~~
1438
+ ------------------
1437
1439
 
1438
1440
  This section specifies custom definitions for any of the instructions in the circuit.
1439
1441
 
@@ -1473,7 +1475,7 @@ it will be a :class:`~qiskit.circuit.Instruction` object.
1473
1475
  .. _qpy_instructions:
1474
1476
 
1475
1477
  INSTRUCTIONS
1476
- ~~~~~~~~~~~~
1478
+ ------------
1477
1479
 
1478
1480
  The contents of INSTRUCTIONS is a list of INSTRUCTION metadata objects
1479
1481
 
@@ -1549,7 +1551,7 @@ and in QPY :ref:`qpy_version_3` ``'v'`` represents a
1549
1551
  .. _qpy_param_struct:
1550
1552
 
1551
1553
  PARAMETER
1552
- ~~~~~~~~~
1554
+ ---------
1553
1555
 
1554
1556
  A PARAMETER represents a :class:`~qiskit.circuit.Parameter` object the data for
1555
1557
  a INSTRUCTION_PARAM. The contents of the PARAMETER are defined as:
@@ -1567,7 +1569,7 @@ parameter name.
1567
1569
  .. _qpy_param_expr:
1568
1570
 
1569
1571
  PARAMETER_EXPR
1570
- ~~~~~~~~~~~~~~
1572
+ --------------
1571
1573
 
1572
1574
  A PARAMETER_EXPR represents a :class:`~qiskit.circuit.ParameterExpression`
1573
1575
  object that the data for an INSTRUCTION_PARAM. The contents of a PARAMETER_EXPR
@@ -1606,7 +1608,7 @@ Finally, if type is ``i`` it represents an integer which is an ``int64_t``.
1606
1608
  .. _qpy_complex:
1607
1609
 
1608
1610
  COMPLEX
1609
- ~~~~~~~
1611
+ -------
1610
1612
 
1611
1613
  When representing a double precision complex value in QPY the following
1612
1614
  struct is used:
@@ -144,13 +144,13 @@ class Pauli(BasePauli):
144
144
 
145
145
  .. code-block:: python
146
146
 
147
- P = Pauli('-iXYZ')
147
+ p = Pauli('-iXYZ')
148
148
 
149
149
  print('P[0] =', repr(P[0]))
150
150
  print('P[1] =', repr(P[1]))
151
151
  print('P[2] =', repr(P[2]))
152
152
  print('P[:] =', repr(P[:]))
153
- print('P[::-1] =', repr(P[::-1]))
153
+ print('P[::-1] =, repr(P[::-1]))
154
154
  """
155
155
 
156
156
  # Set the max Pauli string size before truncation
@@ -736,11 +736,8 @@ class Pauli(BasePauli):
736
736
  n_qubits = num_qubits
737
737
  if layout is None:
738
738
  layout = list(range(self.num_qubits))
739
- else:
740
- if any(x < 0 or x >= n_qubits for x in layout):
741
- raise QiskitError("Provided layout contains indices outside the number of qubits.")
742
- if len(set(layout)) != len(layout):
743
- raise QiskitError("Provided layout contains duplicate indices.")
739
+ elif any(x >= n_qubits for x in layout):
740
+ raise QiskitError("Provided layout contains indices outside the number of qubits.")
744
741
  new_op = type(self)("I" * n_qubits)
745
742
  return new_op.compose(self, qargs=layout)
746
743
 
@@ -1139,6 +1139,7 @@ class SparsePauliOp(LinearOp):
1139
1139
  specified will be applied without any expansion. If layout is
1140
1140
  None, the operator will be expanded to the given number of qubits.
1141
1141
 
1142
+
1142
1143
  Returns:
1143
1144
  A new :class:`.SparsePauliOp` with the provided layout applied
1144
1145
  """
@@ -1158,15 +1159,10 @@ class SparsePauliOp(LinearOp):
1158
1159
  f"applied to a {n_qubits} qubit operator"
1159
1160
  )
1160
1161
  n_qubits = num_qubits
1162
+ if layout is not None and any(x >= n_qubits for x in layout):
1163
+ raise QiskitError("Provided layout contains indices outside the number of qubits.")
1161
1164
  if layout is None:
1162
1165
  layout = list(range(self.num_qubits))
1163
- else:
1164
- if any(x < 0 or x >= n_qubits for x in layout):
1165
- raise QiskitError("Provided layout contains indices outside the number of qubits.")
1166
- if len(set(layout)) != len(layout):
1167
- raise QiskitError("Provided layout contains duplicate indices.")
1168
- if self.num_qubits == 0:
1169
- return type(self)(["I" * n_qubits] * self.size, self.coeffs)
1170
1166
  new_op = type(self)("I" * n_qubits)
1171
1167
  return new_op.compose(self, qargs=layout)
1172
1168
 
qiskit/result/__init__.py CHANGED
@@ -17,9 +17,6 @@ Experiment Results (:mod:`qiskit.result`)
17
17
 
18
18
  .. currentmodule:: qiskit.result
19
19
 
20
- Core classes
21
- ============
22
-
23
20
  .. autosummary::
24
21
  :toctree: ../stubs/
25
22
 
@@ -27,9 +24,6 @@ Core classes
27
24
  ResultError
28
25
  Counts
29
26
 
30
- Marginalization
31
- ===============
32
-
33
27
  .. autofunction:: marginal_counts
34
28
  .. autofunction:: marginal_distribution
35
29
  .. autofunction:: marginal_memory
@@ -19,22 +19,13 @@ Circuit Scheduler (:mod:`qiskit.scheduler`)
19
19
 
20
20
  A circuit scheduler compiles a circuit program to a pulse program.
21
21
 
22
- Core API
23
- ========
24
-
25
22
  .. autoclass:: ScheduleConfig
26
23
 
27
24
  .. currentmodule:: qiskit.scheduler.schedule_circuit
28
25
  .. autofunction:: schedule_circuit
29
26
  .. currentmodule:: qiskit.scheduler
30
27
 
31
- Pulse scheduling methods
32
- ========================
33
-
34
- .. currentmodule:: qiskit.scheduler.methods
35
- .. autofunction:: as_soon_as_possible
36
- .. autofunction:: as_late_as_possible
37
- .. currentmodule:: qiskit.scheduler
28
+ .. automodule:: qiskit.scheduler.methods
38
29
  """
39
30
  from qiskit.scheduler import schedule_circuit
40
31
  from qiskit.scheduler.config import ScheduleConfig
@@ -10,6 +10,13 @@
10
10
  # copyright notice, and modified files need to carry a notice indicating
11
11
  # that they have been altered from the originals.
12
12
 
13
- """Scheduling methods."""
13
+ """
14
+ .. currentmodule:: qiskit.scheduler.methods
15
+
16
+ Pulse scheduling methods.
17
+
18
+ .. autofunction:: as_soon_as_possible
19
+ .. autofunction:: as_late_as_possible
20
+ """
14
21
 
15
22
  from qiskit.scheduler.methods.basic import as_soon_as_possible, as_late_as_possible
@@ -99,7 +99,12 @@ Decomposition of general :math:`2^n \times 2^n` unitary matrices for any number
99
99
 
100
100
  .. autofunction:: qs_decomposition
101
101
 
102
- The Approximate Quantum Compiler is available as the module :mod:`qiskit.synthesis.unitary.aqc`.
102
+ The Approximate Quantum Compiler is available here:
103
+
104
+ .. autosummary::
105
+ :toctree: ../stubs/
106
+
107
+ qiskit.synthesis.unitary.aqc
103
108
 
104
109
  One-Qubit Synthesis
105
110
  ===================
@@ -154,10 +154,8 @@ The synthesis transpiler plugin documentation can be found in the
154
154
  HLSConfig
155
155
  SolovayKitaev
156
156
 
157
- Post Layout
158
- ===========
159
-
160
- These are post qubit selection.
157
+ Post Layout (Post transpile qubit selection)
158
+ ============================================
161
159
 
162
160
  .. autosummary::
163
161
  :toctree: ../stubs/
@@ -97,8 +97,8 @@ class BasisTranslator(TransformationPass):
97
97
 
98
98
  When this error occurs it typically means that either the target basis
99
99
  is not universal or there are additional equivalence rules needed in the
100
- :class:`~.EquivalenceLibrary` instance being used by the
101
- :class:`~.BasisTranslator` pass. You can refer to
100
+ :clas:~.EquivalenceLibrary` instance being used by the
101
+ :class:~.BasisTranslator` pass. You can refer to
102
102
  :ref:`custom_basis_gates` for details on adding custom equivalence rules.
103
103
  """
104
104
 
@@ -160,13 +160,8 @@ class Commuting2qGateRouter(TransformationPass):
160
160
  if len(dag.qubits) != next(iter(dag.qregs.values())).size:
161
161
  raise TranspilerError("Circuit has qubits not contained in the qubit register.")
162
162
 
163
- # Fix output permutation -- copied from ElidePermutations
164
- input_qubit_mapping = {qubit: index for index, qubit in enumerate(dag.qubits)}
165
- self.property_set["original_layout"] = Layout(input_qubit_mapping)
166
- if self.property_set["original_qubit_indices"] is None:
167
- self.property_set["original_qubit_indices"] = input_qubit_mapping
168
-
169
163
  new_dag = dag.copy_empty_like()
164
+
170
165
  current_layout = Layout.generate_trivial_layout(*dag.qregs.values())
171
166
 
172
167
  # Used to keep track of nodes that do not decompose using swap strategies.
@@ -188,8 +183,6 @@ class Commuting2qGateRouter(TransformationPass):
188
183
 
189
184
  self._compose_non_swap_nodes(accumulator, current_layout, new_dag)
190
185
 
191
- self.property_set["virtual_permutation_layout"] = current_layout
192
-
193
186
  return new_dag
194
187
 
195
188
  def _compose_non_swap_nodes(
@@ -329,13 +329,13 @@ class StarPreRouting(TransformationPass):
329
329
  last_2q_gate = None
330
330
 
331
331
  int_digits = floor(log10(len(processing_order))) + 1
332
- processing_order_index_map = {
333
- node: f"a{str(index).zfill(int(int_digits))}"
334
- for index, node in enumerate(processing_order)
335
- }
332
+ processing_order_s = set(processing_order)
336
333
 
337
334
  def tie_breaker_key(node):
338
- return processing_order_index_map.get(node, node.sort_key)
335
+ if node in processing_order_s:
336
+ return "a" + str(processing_order.index(node)).zfill(int(int_digits))
337
+ else:
338
+ return node.sort_key
339
339
 
340
340
  for node in dag.topological_op_nodes(key=tie_breaker_key):
341
341
  block_id = node_to_block_id.get(node, None)