qiskit 1.2.3__cp38-abi3-macosx_10_9_universal2.whl → 1.2.4__cp38-abi3-macosx_10_9_universal2.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.
qiskit/VERSION.txt CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.2.4
Binary file
@@ -94,6 +94,12 @@ class BlueprintCircuit(QuantumCircuit, ABC):
94
94
 
95
95
  @property
96
96
  def data(self):
97
+ """The circuit data (instructions and context).
98
+
99
+ Returns:
100
+ QuantumCircuitData: a list-like object containing the :class:`.CircuitInstruction`\\ s
101
+ for each instruction.
102
+ """
97
103
  if not self._is_built:
98
104
  self._build()
99
105
  return super().data
@@ -110,12 +116,70 @@ class BlueprintCircuit(QuantumCircuit, ABC):
110
116
 
111
117
  @property
112
118
  def num_parameters(self) -> int:
119
+ """The number of parameter objects in the circuit."""
113
120
  if not self._is_built:
114
121
  self._build()
115
122
  return super().num_parameters
116
123
 
117
124
  @property
118
125
  def parameters(self) -> ParameterView:
126
+ """The parameters defined in the circuit.
127
+
128
+ This attribute returns the :class:`.Parameter` objects in the circuit sorted
129
+ alphabetically. Note that parameters instantiated with a :class:`.ParameterVector`
130
+ are still sorted numerically.
131
+
132
+ Examples:
133
+
134
+ The snippet below shows that insertion order of parameters does not matter.
135
+
136
+ .. code-block:: python
137
+
138
+ >>> from qiskit.circuit import QuantumCircuit, Parameter
139
+ >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant")
140
+ >>> circuit = QuantumCircuit(1)
141
+ >>> circuit.rx(b, 0)
142
+ >>> circuit.rz(elephant, 0)
143
+ >>> circuit.ry(a, 0)
144
+ >>> circuit.parameters # sorted alphabetically!
145
+ ParameterView([Parameter(a), Parameter(b), Parameter(elephant)])
146
+
147
+ Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers.
148
+ The literal "10" comes before "2" in strict alphabetical sorting.
149
+
150
+ .. code-block:: python
151
+
152
+ >>> from qiskit.circuit import QuantumCircuit, Parameter
153
+ >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")]
154
+ >>> circuit = QuantumCircuit(1)
155
+ >>> circuit.u(*angles, 0)
156
+ >>> circuit.draw()
157
+ ┌─────────────────────────────┐
158
+ q: ┤ U(angle_1,angle_2,angle_10) ├
159
+ └─────────────────────────────┘
160
+ >>> circuit.parameters
161
+ ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)])
162
+
163
+ To respect numerical sorting, a :class:`.ParameterVector` can be used.
164
+
165
+ .. code-block:: python
166
+
167
+ >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector
168
+ >>> x = ParameterVector("x", 12)
169
+ >>> circuit = QuantumCircuit(1)
170
+ >>> for x_i in x:
171
+ ... circuit.rx(x_i, 0)
172
+ >>> circuit.parameters
173
+ ParameterView([
174
+ ParameterVectorElement(x[0]), ParameterVectorElement(x[1]),
175
+ ParameterVectorElement(x[2]), ParameterVectorElement(x[3]),
176
+ ..., ParameterVectorElement(x[11])
177
+ ])
178
+
179
+
180
+ Returns:
181
+ The sorted :class:`.Parameter` objects in the circuit.
182
+ """
119
183
  if not self._is_built:
120
184
  self._build()
121
185
  return super().parameters
@@ -57,11 +57,11 @@ class PauliFeatureMap(NLocal):
57
57
 
58
58
  .. parsed-literal::
59
59
 
60
- ┌───┐┌──────────────┐┌──────────┐ ┌───────────┐
61
- ┤ H ├┤ U1(2.0*x[0]) ├┤ RX(pi/2) ├──■───────────────────────────────────────■──┤ RX(-pi/2) ├
62
- ├───┤├──────────────┤├──────────┤┌─┴─┐┌─────────────────────────────────┐┌─┴─┐├───────────┤
63
- ┤ H ├┤ U1(2.0*x[1]) ├┤ RX(pi/2) ├┤ X ├┤ U1(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├┤ RX(-pi/2) ├
64
- └───┘└──────────────┘└──────────┘└───┘└─────────────────────────────────┘└───┘└───────────┘
60
+ ┌───┐┌─────────────┐┌──────────┐ ┌───────────┐
61
+ ┤ H ├┤ P(2.0*x[0]) ├┤ RX(pi/2) ├──■──────────────────────────────────────■──┤ RX(-pi/2) ├
62
+ ├───┤├─────────────┤├──────────┤┌─┴─┐┌────────────────────────────────┐┌─┴─┐├───────────┤
63
+ ┤ H ├┤ P(2.0*x[1]) ├┤ RX(pi/2) ├┤ X ├┤ P(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├┤ RX(-pi/2) ├
64
+ └───┘└─────────────┘└──────────┘└───┘└────────────────────────────────┘└───┘└───────────┘
65
65
 
66
66
  The circuit contains ``reps`` repetitions of this transformation.
67
67
 
@@ -71,37 +71,37 @@ class PauliFeatureMap(NLocal):
71
71
  Examples:
72
72
 
73
73
  >>> prep = PauliFeatureMap(2, reps=1, paulis=['ZZ'])
74
- >>> print(prep)
74
+ >>> print(prep.decompose())
75
75
  ┌───┐
76
- q_0: ┤ H ├──■───────────────────────────────────────■──
77
- ├───┤┌─┴─┐┌─────────────────────────────────┐┌─┴─┐
78
- q_1: ┤ H ├┤ X ├┤ U1(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├
79
- └───┘└───┘└─────────────────────────────────┘└───┘
76
+ q_0: ┤ H ├──■──────────────────────────────────────■──
77
+ ├───┤┌─┴─┐┌────────────────────────────────┐┌─┴─┐
78
+ q_1: ┤ H ├┤ X ├┤ P(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├
79
+ └───┘└───┘└────────────────────────────────┘└───┘
80
80
 
81
81
  >>> prep = PauliFeatureMap(2, reps=1, paulis=['Z', 'XX'])
82
- >>> print(prep)
83
- ┌───┐┌──────────────┐┌───┐ ┌───┐
84
- q_0: ┤ H ├┤ U1(2.0*x[0]) ├┤ H ├──■───────────────────────────────────────■──┤ H ├
85
- ├───┤├──────────────┤├───┤┌─┴─┐┌─────────────────────────────────┐┌─┴─┐├───┤
86
- q_1: ┤ H ├┤ U1(2.0*x[1]) ├┤ H ├┤ X ├┤ U1(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├┤ H ├
87
- └───┘└──────────────┘└───┘└───┘└─────────────────────────────────┘└───┘└───┘
82
+ >>> print(prep.decompose())
83
+ ┌───┐┌─────────────┐┌───┐ ┌───┐
84
+ q_0: ┤ H ├┤ P(2.0*x[0]) ├┤ H ├──■──────────────────────────────────────■──┤ H ├
85
+ ├───┤├─────────────┤├───┤┌─┴─┐┌────────────────────────────────┐┌─┴─┐├───┤
86
+ q_1: ┤ H ├┤ P(2.0*x[1]) ├┤ H ├┤ X ├┤ P(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├┤ H ├
87
+ └───┘└─────────────┘└───┘└───┘└────────────────────────────────┘└───┘└───┘
88
88
 
89
89
  >>> prep = PauliFeatureMap(2, reps=1, paulis=['ZY'])
90
- >>> print(prep)
91
- ┌───┐┌──────────┐ ┌───────────┐
92
- q_0: ┤ H ├┤ RX(pi/2) ├──■───────────────────────────────────────■──┤ RX(-pi/2) ├
93
- ├───┤└──────────┘┌─┴─┐┌─────────────────────────────────┐┌─┴─┐└───────────┘
94
- q_1: ┤ H ├────────────┤ X ├┤ U1(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├─────────────
95
- └───┘ └───┘└─────────────────────────────────┘└───┘
90
+ >>> print(prep.decompose())
91
+ ┌───┐┌──────────┐ ┌───────────┐
92
+ q_0: ┤ H ├┤ RX(pi/2) ├──■──────────────────────────────────────■──┤ RX(-pi/2) ├
93
+ ├───┤└──────────┘┌─┴─┐┌────────────────────────────────┐┌─┴─┐└───────────┘
94
+ q_1: ┤ H ├────────────┤ X ├┤ P(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├─────────────
95
+ └───┘ └───┘└────────────────────────────────┘└───┘
96
96
 
97
97
  >>> from qiskit.circuit.library import EfficientSU2
98
98
  >>> prep = PauliFeatureMap(3, reps=3, paulis=['Z', 'YY', 'ZXZ'])
99
99
  >>> wavefunction = EfficientSU2(3)
100
- >>> classifier = prep.compose(wavefunction)
100
+ >>> classifier = prep.compose(wavefunction).decompose()
101
101
  >>> classifier.num_parameters
102
102
  27
103
103
  >>> classifier.count_ops()
104
- OrderedDict([('cx', 39), ('rx', 36), ('u1', 21), ('h', 15), ('ry', 12), ('rz', 12)])
104
+ OrderedDict([('cx', 39), ('rx', 36), ('p', 21), ('h', 15), ('ry', 12), ('rz', 12)])
105
105
 
106
106
  References:
107
107
 
@@ -209,6 +209,11 @@ class PauliFeatureMap(NLocal):
209
209
 
210
210
  @property
211
211
  def entanglement_blocks(self):
212
+ """The blocks in the entanglement layers.
213
+
214
+ Returns:
215
+ The blocks in the entanglement layers.
216
+ """
212
217
  return [self.pauli_block(pauli) for pauli in self._paulis]
213
218
 
214
219
  @entanglement_blocks.setter
@@ -25,13 +25,13 @@ class ZFeatureMap(PauliFeatureMap):
25
25
 
26
26
  .. parsed-literal::
27
27
 
28
- ┌───┐┌──────────────┐┌───┐┌──────────────┐
29
- ┤ H ├┤ U1(2.0*x[0]) ├┤ H ├┤ U1(2.0*x[0]) ├
30
- ├───┤├──────────────┤├───┤├──────────────┤
31
- ┤ H ├┤ U1(2.0*x[1]) ├┤ H ├┤ U1(2.0*x[1]) ├
32
- ├───┤├──────────────┤├───┤├──────────────┤
33
- ┤ H ├┤ U1(2.0*x[2]) ├┤ H ├┤ U1(2.0*x[2]) ├
34
- └───┘└──────────────┘└───┘└──────────────┘
28
+ ┌───┐┌─────────────┐┌───┐┌─────────────┐
29
+ ┤ H ├┤ P(2.0*x[0]) ├┤ H ├┤ P(2.0*x[0]) ├
30
+ ├───┤├─────────────┤├───┤├─────────────┤
31
+ ┤ H ├┤ P(2.0*x[1]) ├┤ H ├┤ P(2.0*x[1]) ├
32
+ ├───┤├─────────────┤├───┤├─────────────┤
33
+ ┤ H ├┤ P(2.0*x[2]) ├┤ H ├┤ P(2.0*x[2]) ├
34
+ └───┘└─────────────┘└───┘└─────────────┘
35
35
 
36
36
  This is a sub-class of :class:`~qiskit.circuit.library.PauliFeatureMap` where the Pauli
37
37
  strings are fixed as `['Z']`. As a result the first order expansion will be a circuit without
@@ -39,36 +39,38 @@ class ZFeatureMap(PauliFeatureMap):
39
39
 
40
40
  Examples:
41
41
 
42
+ >>> from qiskit.circuit.library import ZFeatureMap
42
43
  >>> prep = ZFeatureMap(3, reps=3, insert_barriers=True)
43
- >>> print(prep)
44
- ┌───┐ ░ ┌──────────────┐ ░ ┌───┐ ░ ┌──────────────┐ ░ ┌───┐ ░ ┌──────────────┐
45
- q_0: ┤ H ├─░─┤ U1(2.0*x[0]) ├─░─┤ H ├─░─┤ U1(2.0*x[0]) ├─░─┤ H ├─░─┤ U1(2.0*x[0]) ├
46
- ├───┤ ░ ├──────────────┤ ░ ├───┤ ░ ├──────────────┤ ░ ├───┤ ░ ├──────────────┤
47
- q_1: ┤ H ├─░─┤ U1(2.0*x[1]) ├─░─┤ H ├─░─┤ U1(2.0*x[1]) ├─░─┤ H ├─░─┤ U1(2.0*x[1]) ├
48
- ├───┤ ░ ├──────────────┤ ░ ├───┤ ░ ├──────────────┤ ░ ├───┤ ░ ├──────────────┤
49
- q_2: ┤ H ├─░─┤ U1(2.0*x[2]) ├─░─┤ H ├─░─┤ U1(2.0*x[2]) ├─░─┤ H ├─░─┤ U1(2.0*x[2]) ├
50
- └───┘ ░ └──────────────┘ ░ └───┘ ░ └──────────────┘ ░ └───┘ ░ └──────────────┘
44
+ >>> print(prep.decompose())
45
+ ┌───┐ ░ ┌─────────────┐ ░ ┌───┐ ░ ┌─────────────┐ ░ ┌───┐ ░ ┌─────────────┐
46
+ q_0: ┤ H ├─░─┤ P(2.0*x[0]) ├─░─┤ H ├─░─┤ P(2.0*x[0]) ├─░─┤ H ├─░─┤ P(2.0*x[0]) ├
47
+ ├───┤ ░ ├─────────────┤ ░ ├───┤ ░ ├─────────────┤ ░ ├───┤ ░ ├─────────────┤
48
+ q_1: ┤ H ├─░─┤ P(2.0*x[1]) ├─░─┤ H ├─░─┤ P(2.0*x[1]) ├─░─┤ H ├─░─┤ P(2.0*x[1]) ├
49
+ ├───┤ ░ ├─────────────┤ ░ ├───┤ ░ ├─────────────┤ ░ ├───┤ ░ ├─────────────┤
50
+ q_2: ┤ H ├─░─┤ P(2.0*x[2]) ├─░─┤ H ├─░─┤ P(2.0*x[2]) ├─░─┤ H ├─░─┤ P(2.0*x[2]) ├
51
+ └───┘ ░ └─────────────┘ ░ └───┘ ░ └─────────────┘ ░ └───┘ ░ └─────────────┘
51
52
 
52
53
  >>> data_map = lambda x: x[0]*x[0] + 1 # note: input is an array
53
54
  >>> prep = ZFeatureMap(3, reps=1, data_map_func=data_map)
54
- >>> print(prep)
55
- ┌───┐┌───────────────────────┐
56
- q_0: ┤ H ├┤ U1(2.0*x[0]**2 + 2.0) ├
57
- ├───┤├───────────────────────┤
58
- q_1: ┤ H ├┤ U1(2.0*x[1]**2 + 2.0) ├
59
- ├───┤├───────────────────────┤
60
- q_2: ┤ H ├┤ U1(2.0*x[2]**2 + 2.0) ├
61
- └───┘└───────────────────────┘
62
-
63
- >>> classifier = ZFeatureMap(3, reps=1) + RY(3, reps=1)
64
- >>> print(classifier)
65
- ┌───┐┌──────────────┐┌──────────┐ ┌──────────┐
66
- q_0: ┤ H ├┤ U1(2.0*x[0]) ├┤ RY(θ[0]) ├─■──■─┤ RY(θ[3]) ├────────────
67
- ├───┤├──────────────┤├──────────┤ │ │ └──────────┘┌──────────┐
68
- q_1: H ├┤ U1(2.0*x[1]) ├┤ RY(θ[1]) ├─■──┼──────■──────┤ RY(θ[4]) ├
69
- ├───┤├──────────────┤├──────────┤ │ │ ├──────────┤
70
- q_2: ┤ H ├┤ U1(2.0*x[2]) ├┤ RY(θ[2]) ├────■──────■──────┤ RY(θ[5]) ├
71
- └───┘└──────────────┘└──────────┘ └──────────┘
55
+ >>> print(prep.decompose())
56
+ ┌───┐┌──────────────────────┐
57
+ q_0: ┤ H ├┤ P(2.0*x[0]**2 + 2.0) ├
58
+ ├───┤├──────────────────────┤
59
+ q_1: ┤ H ├┤ P(2.0*x[1]**2 + 2.0) ├
60
+ ├───┤├──────────────────────┤
61
+ q_2: ┤ H ├┤ P(2.0*x[2]**2 + 2.0) ├
62
+ └───┘└──────────────────────┘
63
+
64
+ >>> from qiskit.circuit.library import RealAmplitudes
65
+ >>> classifier = ZFeatureMap(3, reps=1).compose(RealAmplitudes(3, reps=1))
66
+ >>> print(classifier.decompose())
67
+ ┌───┐┌─────────────┐┌──────────┐ ┌──────────┐
68
+ q_0: H ├┤ P(2.0*x[0]) ├┤ RY(θ[0]) ├─■──■─┤ RY(θ[3]) ├────────────
69
+ ├───┤├─────────────┤├──────────┤ │ │ └──────────┘┌──────────┐
70
+ q_1: ┤ H ├┤ P(2.0*x[1]) ├┤ RY(θ[1]) ├─■──┼──────■──────┤ RY(θ[4]) ├
71
+ ├───┤├─────────────┤├──────────┤ │ │ ├──────────┤
72
+ q_2: ┤ H ├┤ P(2.0*x[2]) ├┤ RY(θ[2]) ├────■──────■──────┤ RY(θ[5]) ├
73
+ └───┘└─────────────┘└──────────┘ └──────────┘
72
74
 
73
75
  """
74
76
 
@@ -24,51 +24,73 @@ class ZZFeatureMap(PauliFeatureMap):
24
24
 
25
25
  .. parsed-literal::
26
26
 
27
- ┌───┐┌─────────────────┐
28
- ┤ H ├┤ U1(2.0*φ(x[0])) ├──■────────────────────────────■────────────────────────────────────
29
- ├───┤├─────────────────┤┌─┴─┐┌──────────────────────┐┌─┴─┐
30
- ┤ H ├┤ U1(2.0*φ(x[1])) ├┤ X ├┤ U1(2.0*φ(x[0],x[1])) ├┤ X ├──■────────────────────────────■──
31
- ├───┤├─────────────────┤└───┘└──────────────────────┘└───┘┌─┴─┐┌──────────────────────┐┌─┴─┐
32
- ┤ H ├┤ U1(2.0*φ(x[2])) ├──────────────────────────────────┤ X ├┤ U1(2.0*φ(x[1],x[2])) ├┤ X ├
33
- └───┘└─────────────────┘ └───┘└──────────────────────┘└───┘
27
+ ┌───┐┌────────────────┐
28
+ ┤ H ├┤ P(2.0*φ(x[0])) ├──■───────────────────────────■───────────────────────────────────
29
+ ├───┤├────────────────┤┌─┴─┐┌─────────────────────┐┌─┴─┐
30
+ ┤ H ├┤ P(2.0*φ(x[1])) ├┤ X ├┤ P(2.0*φ(x[0],x[1])) ├┤ X ├──■───────────────────────────■──
31
+ ├───┤├────────────────┤└───┘└─────────────────────┘└───┘┌─┴─┐┌─────────────────────┐┌─┴─┐
32
+ ┤ H ├┤ P(2.0*φ(x[2])) ├─────────────────────────────────┤ X ├┤ P(2.0*φ(x[1],x[2])) ├┤ X ├
33
+ └───┘└────────────────┘ └───┘└─────────────────────┘└───┘
34
34
 
35
35
  where :math:`\varphi` is a classical non-linear function, which defaults to :math:`\varphi(x) = x`
36
36
  if and :math:`\varphi(x,y) = (\pi - x)(\pi - y)`.
37
37
 
38
38
  Examples:
39
39
 
40
- >>> from qiskit.circuit.library import ZZFeatureMap
41
- >>> prep = ZZFeatureMap(2, reps=1)
42
- >>> print(prep)
43
- ┌───┐┌──────────────┐
44
- q_0: ┤ H ├┤ U1(2.0*x[0]) ├──■───────────────────────────────────────■──
45
- ├───┤├──────────────┤┌─┴─┐┌─────────────────────────────────┐┌─┴─┐
46
- q_1: ┤ H ├┤ U1(2.0*x[1]) ├┤ X ├┤ U1(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├
47
- └───┘└──────────────┘└───┘└─────────────────────────────────┘└───┘
48
-
49
- >>> from qiskit.circuit.library import EfficientSU2
50
- >>> classifier = ZZFeatureMap(3) + EfficientSU2(3)
51
- >>> classifier.num_parameters
52
- 15
53
- >>> classifier.parameters # 'x' for the data preparation, 'θ' for the SU2 parameters
54
- ParameterView([
55
- ParameterVectorElement(x[0]), ParameterVectorElement(x[1]),
56
- ParameterVectorElement(x[2]), ParameterVectorElement(θ[0]),
57
- ParameterVectorElement(θ[1]), ParameterVectorElement(θ[2]),
58
- ParameterVectorElement(θ[3]), ParameterVectorElement(θ[4]),
59
- ParameterVectorElement(θ[5]), ParameterVectorElement(θ[6]),
60
- ParameterVectorElement(θ[7]), ParameterVectorElement(θ[8]),
61
- ParameterVectorElement(θ[9]), ParameterVectorElement(θ[10]),
62
- ParameterVectorElement(θ[11]), ParameterVectorElement(θ[12]),
63
- ParameterVectorElement(θ[13]), ParameterVectorElement(θ[14]),
64
- ParameterVectorElement(θ[15]), ParameterVectorElement(θ[16]),
65
- ParameterVectorElement(θ[17]), ParameterVectorElement(θ[18]),
66
- ParameterVectorElement(θ[19]), ParameterVectorElement(θ[20]),
67
- ParameterVectorElement(θ[21]), ParameterVectorElement(θ[22]),
68
- ParameterVectorElement(θ[23])
69
- ])
70
- >>> classifier.count_ops()
40
+ .. code-block::
41
+
42
+ from qiskit.circuit.library import ZZFeatureMap
43
+ prep = ZZFeatureMap(2, reps=1)
44
+ print(prep.decompose())
45
+
46
+ .. parsed-literal::
47
+ ┌───┐┌─────────────┐
48
+ q_0: ┤ H ├┤ P(2.0*x[0]) ├──■──────────────────────────────────────■──
49
+ ├───┤├─────────────┤┌─┴─┐┌────────────────────────────────┐┌─┴─┐
50
+ q_1: H ├┤ P(2.0*x[1]) ├┤ X ├┤ P(2.0*(pi - x[0])*(pi - x[1])) ├┤ X ├
51
+ └───┘└─────────────┘└───┘└────────────────────────────────┘└───┘
52
+
53
+ .. code-block::
54
+
55
+ from qiskit.circuit.library import EfficientSU2
56
+ classifier = ZZFeatureMap(3).compose(EfficientSU2(3))
57
+ classifier.num_parameters
58
+
59
+ .. parsed-literal::
60
+
61
+ 27
62
+
63
+ .. code-block::
64
+
65
+ classifier.parameters # 'x' for the data preparation, 'θ' for the SU2 parameters
66
+
67
+ .. parsed-literal::
68
+
69
+ ParameterView([
70
+ ParameterVectorElement(x[0]), ParameterVectorElement(x[1]),
71
+ ParameterVectorElement(x[2]), ParameterVectorElement(θ[0]),
72
+ ParameterVectorElement(θ[1]), ParameterVectorElement(θ[2]),
73
+ ParameterVectorElement(θ[3]), ParameterVectorElement(θ[4]),
74
+ ParameterVectorElement(θ[5]), ParameterVectorElement(θ[6]),
75
+ ParameterVectorElement(θ[7]), ParameterVectorElement(θ[8]),
76
+ ParameterVectorElement(θ[9]), ParameterVectorElement(θ[10]),
77
+ ParameterVectorElement(θ[11]), ParameterVectorElement(θ[12]),
78
+ ParameterVectorElement(θ[13]), ParameterVectorElement(θ[14]),
79
+ ParameterVectorElement(θ[15]), ParameterVectorElement(θ[16]),
80
+ ParameterVectorElement(θ[17]), ParameterVectorElement(θ[18]),
81
+ ParameterVectorElement(θ[19]), ParameterVectorElement(θ[20]),
82
+ ParameterVectorElement(θ[21]), ParameterVectorElement(θ[22]),
83
+ ParameterVectorElement(θ[23])
84
+ ])
85
+
86
+ .. code-block::
87
+
88
+ classifier.count_ops()
89
+
90
+ .. parsed-literal::
91
+
71
92
  OrderedDict([('ZZFeatureMap', 1), ('EfficientSU2', 1)])
93
+
72
94
  """
73
95
 
74
96
  def __init__(
qiskit/qpy/__init__.py CHANGED
@@ -118,11 +118,11 @@ and how the feature will be internally handled.
118
118
 
119
119
  .. note::
120
120
 
121
- With versions of Qiskit before 1.2.3, the ``use_symengine=True`` argument to :func:`.qpy.dump`
121
+ With versions of Qiskit before 1.2.4, the ``use_symengine=True`` argument to :func:`.qpy.dump`
122
122
  could cause problems with backwards compatibility if there were :class:`.ParameterExpression`
123
123
  objects to serialize. In particular:
124
124
 
125
- * When the loading version of Qiskit is 1.2.3 or greater, QPY files generated with any version
125
+ * When the loading version of Qiskit is 1.2.4 or greater, QPY files generated with any version
126
126
  of Qiskit >= 0.46.0 can be loaded. If a version of Qiskit between 0.45.0 and 0.45.3 was used
127
127
  to generate the files, and the non-default argument ``use_symengine=True`` was given to
128
128
  :func:`.qpy.dump`, the file can only be read if the version of ``symengine`` used in the
@@ -134,7 +134,7 @@ and how the feature will be internally handled.
134
134
  used in the generating environment.
135
135
 
136
136
  To recover a QPY file that fails with ``symengine`` version-related errors during a call to
137
- :func:`.qpy.load`, try first to use Qiskit >= 1.2.3 to load the file. If this still fails,
137
+ :func:`.qpy.load`, first attempt to use Qiskit >= 1.2.4 to load the file. If this still fails,
138
138
  it is likely because Qiskit 0.45.x was used to generate the file with ``use_symengine=True``.
139
139
  In this case, use Qiskit 0.45.3 with ``symengine==0.9.2`` to load the file, and then re-export
140
140
  it to QPY setting ``use_symengine=False``. The resulting file can then be loaded by any later
qiskit/qpy/common.py CHANGED
@@ -322,7 +322,7 @@ def load_symengine_payload(payload: bytes) -> symengine.Expr:
322
322
  major = payload[2]
323
323
  minor = payload[3]
324
324
  if int(symengine_version[1]) != minor:
325
- if major != "0":
325
+ if major != 0:
326
326
  raise exceptions.QpyError(
327
327
  "Qiskit doesn't support loading a symengine payload generated with symengine >= 1.0"
328
328
  )
qiskit/qpy/interface.py CHANGED
@@ -149,7 +149,7 @@ def dump(
149
149
  If serializing a :class:`.QuantumCircuit` or :class:`.ScheduleBlock` that contain
150
150
  :class:`.ParameterExpression` objects with ``version`` set low with the intent to
151
151
  load the payload using a historical release of Qiskit, it is safest to set the
152
- ``use_symengine`` flag to ``False``. Versions of Qiskit prior to 1.2.3 cannot load
152
+ ``use_symengine`` flag to ``False``. Versions of Qiskit prior to 1.2.4 cannot load
153
153
  QPY files containing ``symengine``-serialized :class:`.ParameterExpression` objects
154
154
  unless the version of ``symengine`` used between the loading and generating
155
155
  environments matches.
@@ -191,7 +191,7 @@ def circuit_drawer(
191
191
  .. plot::
192
192
  :include-source:
193
193
 
194
- from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
194
+ from qiskit import QuantumCircuit
195
195
  qc = QuantumCircuit(1, 1)
196
196
  qc.h(0)
197
197
  qc.measure(0, 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qiskit
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
5
5
  Author-email: Qiskit Development Team <qiskit@us.ibm.com>
6
6
  License: Apache 2.0
@@ -1,10 +1,10 @@
1
1
  qiskit/version.py,sha256=MiraFeJt5GQEspFyvP3qJedHen2C1e8dNEttzg0u7YU,2498
2
2
  qiskit/__init__.py,sha256=h_3PcAndCRLW2AhP-GzbxjFzpwd4RpSZ-cQg062et_w,5420
3
- qiskit/_accelerate.abi3.so,sha256=aZVqaJMfdbU-_yh8vMK2ok-_aBk7RqIQf3QkDehbn1Y,12273680
3
+ qiskit/_accelerate.abi3.so,sha256=eB3kRsCLLmwZJqvEh_6JGCRytrRGKxybgUYM-xiAJuw,12273680
4
4
  qiskit/user_config.py,sha256=I7QCF9W2IDpleWunxDjgYGySsVUlq57gfj_137o0Dac,10109
5
5
  qiskit/_numpy_compat.py,sha256=ZlnDTF2KBTKcVF489ZuxoBk6r9KLsMuhAlozFhOn0a8,2815
6
6
  qiskit/exceptions.py,sha256=78bbfww9680_v4CaNgepavY5DwGTN7_j47Ckob3lLPM,5619
7
- qiskit/VERSION.txt,sha256=2C80rpqkG8Sgy1KaGsCJj-0J1rR5-xzETLZsNPFe6E0,6
7
+ qiskit/VERSION.txt,sha256=VjoLTuw8d7vDSsYw1PpSFPXGcmrgFGhAT9cERzEQCE4,6
8
8
  qiskit/visualization/circuit_visualization.py,sha256=6R-A96Uwb_RZOovsSB0LGVsC7lP5IhtLNp6VP2yVBwE,698
9
9
  qiskit/visualization/counts_visualization.py,sha256=rgoEqV0gucL9Auz33wf1LiRWR3yFQzjK94zzBF830iY,16791
10
10
  qiskit/visualization/pass_manager_visualization.py,sha256=19m4pUdYG0csZgQbuxfFP-zfoVGnk0pJr0HVToD1Y04,10886
@@ -36,7 +36,7 @@ qiskit/visualization/pulse_v2/generators/__init__.py,sha256=wbrSLBT-R1BeDDkCdk75
36
36
  qiskit/visualization/pulse_v2/generators/chart.py,sha256=Y2na3oCE4--YbZ802VC6LhV0QG3f8X_eelSrbbcjsq8,6147
37
37
  qiskit/visualization/pulse_v2/generators/frame.py,sha256=sCqwaXoY99lNclGmK4GwiBckHOXezfLVKhPz7w7tPII,13932
38
38
  qiskit/visualization/pulse_v2/generators/snapshot.py,sha256=pJxWrZQQ67qaM4aChcrTJNh0xxKfaZ9e0q6SGXIO9G8,4128
39
- qiskit/visualization/circuit/circuit_visualization.py,sha256=Dt3RofFMU1kiq_kWdIQPdbZsfTnuukLtRmICV5U9L8I,29047
39
+ qiskit/visualization/circuit/circuit_visualization.py,sha256=XGDeeFx9MR_tjblQ1GrcB9mIq9XgAnPtvHensQnnnqw,29011
40
40
  qiskit/visualization/circuit/matplotlib.py,sha256=jMDl-I7mCmlFKc1eafr5SruvXgOcjJTme6N_GVtg6Rw,79426
41
41
  qiskit/visualization/circuit/__init__.py,sha256=nsSvXY3I5Htg52GHr2SyXMx9cb__jrX7dWj9x5esyTw,573
42
42
  qiskit/visualization/circuit/text.py,sha256=U-rCvw9X-d64POxx_I9lWMt7pQgXA9BLeuHp_0XGPH8,71164
@@ -294,7 +294,7 @@ qiskit/circuit/tools/pi_check.py,sha256=6gwDvgfhud2I9nW3UikG4w4GFzPF-na0w6AoPevY
294
294
  qiskit/circuit/tools/__init__.py,sha256=_Rpdz9Yqiksplpw9CSGq0gOAJDIxoXQ26BRkHi1x0HY,540
295
295
  qiskit/circuit/library/pauli_evolution.py,sha256=FaOisdii-aAUVUfHWX60UEwqcAoE-CjwtY3U7xeAyRQ,6547
296
296
  qiskit/circuit/library/hidden_linear_function.py,sha256=Mr5EP9KI96NSvQJWyh4aRh5QPijnbc2-bIWvGv_4w5M,3531
297
- qiskit/circuit/library/blueprintcircuit.py,sha256=EkhYypixeVotvJSJEVWxl9RfnOYJEcZRb0v4xz_IhuU,7061
297
+ qiskit/circuit/library/blueprintcircuit.py,sha256=Iqh8gGTfAHwBzeCW1Iy1foUnBBCLAD_wDMWw77LKjeI,9938
298
298
  qiskit/circuit/library/graph_state.py,sha256=6XZC3YfhKb65-9poGAkY26w63Ggkle8Hi4H6lYLeTPM,3153
299
299
  qiskit/circuit/library/iqp.py,sha256=MAQZQZ5UTetDSPkin1cRdjOXkie_JCMH1Y--v-1etRw,3265
300
300
  qiskit/circuit/library/fourier_checking.py,sha256=VTCOhfzEqfyLJaV5iceRoK9wm5LPwyzT9YNHCC5U4b8,3543
@@ -325,9 +325,9 @@ qiskit/circuit/library/generalized_gates/mcmt.py,sha256=LtaUhbBBXOWB_TKwNryHcMch
325
325
  qiskit/circuit/library/basis_change/qft.py,sha256=qE3t_0WQq6I8NbuhLoXuQy1bbROuDZ9ykbLdkOgEGs4,11772
326
326
  qiskit/circuit/library/basis_change/__init__.py,sha256=JFOleW2bg9vOFdWs2RbrFDpUPx47DWmPP6pG1spSS7s,548
327
327
  qiskit/circuit/library/data_preparation/state_preparation.py,sha256=2TL97DdkliXwRlOc-ETOidGc_zVZRu9E9VOUFEal1JE,14150
328
- qiskit/circuit/library/data_preparation/z_feature_map.py,sha256=9tMS0ScFzMMjgMRC3kle1dAs0iuYZm45xZHKT1dS6A4,6347
329
- qiskit/circuit/library/data_preparation/zz_feature_map.py,sha256=KixkX4byMfcynaSZdaXg9__ungnQN4ZIL3tvo1ZMxPk,6409
330
- qiskit/circuit/library/data_preparation/pauli_feature_map.py,sha256=tyMuysstqiQLqB7s6Sgs796DVk9g8ljm1lZXq1WtwXs,12605
328
+ qiskit/circuit/library/data_preparation/z_feature_map.py,sha256=0f3I2VuUIQceIjNvgdT8ETaRk2Oa3VQBsMaJaTWIKmI,6418
329
+ qiskit/circuit/library/data_preparation/zz_feature_map.py,sha256=gZArFjYLOC-DDhlB-XwrxBHrA1NRv4BSg_K-5pFSKOc,6553
330
+ qiskit/circuit/library/data_preparation/pauli_feature_map.py,sha256=sTREVDZDI50ASdRUTLfSp-J3y_tTDrMf5imvyZBk4cc,12718
331
331
  qiskit/circuit/library/data_preparation/__init__.py,sha256=NYQYKqo_y2H9S5JlAcmyKGys_72PCe8G6auMrf8if-s,2336
332
332
  qiskit/circuit/library/data_preparation/initializer.py,sha256=0MGo6PVqXachVpr-YEWqR2HeJq6qvPhSV5AQbEOCWYo,4453
333
333
  qiskit/circuit/library/boolean_logic/quantum_xor.py,sha256=mE7NEFn792_VNSe9R-v-qLXsgsISMyNbpI5m_CHbdHI,2311
@@ -721,9 +721,9 @@ qiskit/primitives/base/base_result.py,sha256=eG0KLfVRNOBp6HqmjLJ1ADF7iVL8yt4ruRj
721
721
  qiskit/primitives/base/estimator_result.py,sha256=YUNMS8uKaHVGBn4j2QKJBijh3nsQkE0nvgqOsNFV9V0,1478
722
722
  qiskit/primitives/base/base_primitive_job.py,sha256=E9JZPlHeDU-Zx2ccje73dpEAkt0rCYD1yrMb-WEmgbk,2834
723
723
  qiskit/primitives/base/validation.py,sha256=KMWbPhGUSyr1XYSoh11YgNBabjgtgVpbTFYu9-0TvjU,8846
724
- qiskit/qpy/interface.py,sha256=lyxrRhdfq_zmXvx_LLC6pVivaC7c65F29jMgSth7tfA,13020
725
- qiskit/qpy/__init__.py,sha256=J_coMXYyDz98OQVLn5Gt44HIwxTXncJcVuq3WLREEa0,58055
726
- qiskit/qpy/common.py,sha256=LVkAX4dQhqwWZn7bLd-cHBOdYjoF1HMqh6ilbqYUZ_Q,12259
724
+ qiskit/qpy/interface.py,sha256=vbCxqs12ra0lp_jyKTsvHG_Ho9290mcxCwvCRYZ7gWI,13020
725
+ qiskit/qpy/__init__.py,sha256=bJVt7Y7MW1H9ibYtZlRialbEJq74F0Xcy7zm_2t26X4,58059
726
+ qiskit/qpy/common.py,sha256=TRrtOTxjMn2s59qktUFlSCbT5JUdSKuR0R2VdYtZrZk,12257
727
727
  qiskit/qpy/type_keys.py,sha256=_2FKRgX1H6B5L6UOt3RCBzbeecNh0LPISZUr75felQg,15761
728
728
  qiskit/qpy/formats.py,sha256=88GCscjzqnU8LTZ5yf0a1BiA0_wjjWVGpC3qVkhEa_k,11269
729
729
  qiskit/qpy/exceptions.py,sha256=YOwVSKR74VYOrXS5hBdln7EZ0ett0qsSQSALJDoJxwA,1847
@@ -812,9 +812,9 @@ qiskit/compiler/__init__.py,sha256=Far4-zXOyDGCqdNmFP4Q8zV47meApMw6sbIdd1t_wM4,9
812
812
  qiskit/compiler/assembler.py,sha256=e6LEZ5gZKj5YkFvEUQswmgg5Q5z0wC1BsN-22Su-W-4,26709
813
813
  qiskit/compiler/transpiler.py,sha256=LZYdnfqb2UDufn_Tdl1tVgT-_BY_zzEF7YDW182-FuE,24018
814
814
  qiskit/compiler/scheduler.py,sha256=wjIqDBNkspcLMEuHxHxCUREKiq3FMx9xfo0Ug_QPBYA,4411
815
- qiskit-1.2.3.dist-info/RECORD,,
816
- qiskit-1.2.3.dist-info/WHEEL,sha256=9DIIBb2tgWMKudTFkR4mtJw_7f-Z0kFUVrhe3NnWRgA,112
817
- qiskit-1.2.3.dist-info/entry_points.txt,sha256=dCqiF7i6g_s6cYnXX7UUO1MM63xFFb5DCHYEYyGAeCc,3556
818
- qiskit-1.2.3.dist-info/top_level.txt,sha256=_vjFXLv7qrHyJJOC2-JXfG54o4XQygW9GuQPxgtSt9Q,7
819
- qiskit-1.2.3.dist-info/LICENSE.txt,sha256=IXrBXbzaJ4LgBPUVKIbYR5iMY2eqoMT8jDVTY8Ib0iQ,11416
820
- qiskit-1.2.3.dist-info/METADATA,sha256=uJFlGfioiX6dSgqCRxX7AUhwNo-xgtgEtapA-W2cWGo,12873
815
+ qiskit-1.2.4.dist-info/RECORD,,
816
+ qiskit-1.2.4.dist-info/WHEEL,sha256=9DIIBb2tgWMKudTFkR4mtJw_7f-Z0kFUVrhe3NnWRgA,112
817
+ qiskit-1.2.4.dist-info/entry_points.txt,sha256=dCqiF7i6g_s6cYnXX7UUO1MM63xFFb5DCHYEYyGAeCc,3556
818
+ qiskit-1.2.4.dist-info/top_level.txt,sha256=_vjFXLv7qrHyJJOC2-JXfG54o4XQygW9GuQPxgtSt9Q,7
819
+ qiskit-1.2.4.dist-info/LICENSE.txt,sha256=IXrBXbzaJ4LgBPUVKIbYR5iMY2eqoMT8jDVTY8Ib0iQ,11416
820
+ qiskit-1.2.4.dist-info/METADATA,sha256=FgL3OFv3K24kIO1CvFT1R6IMmGc88RRtZe0ERwSr5M0,12873
File without changes