Skip to content

Commit

Permalink
Update state_preparation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirmay authored Apr 9, 2024
1 parent d9a071d commit a9866bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions qiskit/circuit/library/data_preparation/state_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def __init__(
raise ValueError(
"num_qubits must be an integer greater than or equal to log2(M)."
)
self.M = M
self._M = M
self._num_qubits = self._get_num_qubits(num_qubits, params)

def _define(self):
Expand All @@ -503,7 +503,7 @@ def _define(self):
qreg = QuantumRegister(self.num_qubits(), "q")
qc = QuantumCircuit(self.num_qubits())

M = self.M
M = self.M()
num_qubits = self.num_qubits()

if (M & (M - 1)) == 0: # if M is an integer power of 2
Expand Down Expand Up @@ -538,7 +538,7 @@ def num_qubits(self):

def __repr__(self):
"""Returns a string representation of the gate."""
return f"Generalized_Uniform_Superposition_Gate(M={self.M}, num_qubits={self._num_qubits})"
return f"Generalized_Uniform_Superposition_Gate(M={self.M()}, num_qubits={self._num_qubits})"

def broadcast_arguments(self, qargs, cargs):
"""Validates and handles the arguments."""
Expand Down

0 comments on commit a9866bb

Please sign in to comment.