From a9866bb63507cc17a9b58e42983a5d4b99a9401c Mon Sep 17 00:00:00 2001 From: Hirmay Sandesara <56473003+Hirmay@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:49:27 +0530 Subject: [PATCH] Update state_preparation.py --- .../circuit/library/data_preparation/state_preparation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qiskit/circuit/library/data_preparation/state_preparation.py b/qiskit/circuit/library/data_preparation/state_preparation.py index 5c295bb6635..7c3ff7a61a2 100644 --- a/qiskit/circuit/library/data_preparation/state_preparation.py +++ b/qiskit/circuit/library/data_preparation/state_preparation.py @@ -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): @@ -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 @@ -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."""