Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding copy argument to QFTGate.__array__ (backport #12979) #12987

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading