Skip to content

Commit

Permalink
adding copy argument to __array__ (#12979) (#12987)
Browse files Browse the repository at this point in the history
(cherry picked from commit 06392c5)

Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
  • Loading branch information
mergify[bot] and alexanderivrii authored Aug 20, 2024
1 parent 7e2e835 commit 21da5e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qiskit/circuit/library/basis_change/qft.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,10 @@ def __init__(
"""
super().__init__(name="qft", num_qubits=num_qubits, params=[])

def __array__(self, dtype=complex):
def __array__(self, dtype=complex, copy=None):
"""Return a numpy array for the QFTGate."""
if copy is False:
raise ValueError("unable to avoid copy while creating an array as requested")
n = self.num_qubits
nums = np.arange(2**n)
outer = np.outer(nums, nums)
Expand Down

0 comments on commit 21da5e3

Please sign in to comment.