Skip to content

Commit 0bdd2dc

Browse files
authored
Fix power() in subclass test for QuantumCircuit change (qiskit-community#172)
1 parent da55fb0 commit 0bdd2dc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

qiskit_algorithms/gradients/reverse/derive_circuit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2022, 2023.
3+
# (C) Copyright IBM 2022, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -148,7 +148,7 @@ def derive_circuit(
148148
gradient = []
149149
for product_rule_term in itertools.product(*summands):
150150
summand_circuit = QuantumCircuit(*circuit.qregs)
151-
c = 1
151+
c = complex(1)
152152
for i, term in enumerate(product_rule_term):
153153
c *= term[0]
154154
summand_circuit.data.append([term[1], *op_context[i]])

test/test_amplitude_estimators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2018, 2023.
3+
# (C) Copyright IBM 2018, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -47,7 +47,9 @@ def __init__(self, probability):
4747
self.angle = 2 * np.arcsin(np.sqrt(probability))
4848
self.ry(2 * self.angle, 0)
4949

50-
def power(self, power, matrix_power=False):
50+
# Disable for pylint needed for Qiskit < 1.1.0 where annotated does not exist
51+
# pylint: disable=unused-argument
52+
def power(self, power, matrix_power=False, annotated: bool = False):
5153
if matrix_power:
5254
return super().power(power, True)
5355

0 commit comments

Comments
 (0)