Skip to content

Commit 0ce111f

Browse files
authored
Update numpy_backend.py
1 parent c6ba6a6 commit 0ce111f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

backends/numpy_backend.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def run_circuit(self, circuit: QuantumCircuit) -> np.ndarray:
5656
qubit_last_op_time: Dict[int, float] = {q_id: 0.0 for q_id in range(circuit.num_qubits)}
5757
current_rho_tensor = self._create_initial_density_matrix(circuit.num_qubits)
5858
qubit_map = {q_id: q_id for q_id in range(circuit.num_qubits)}
59-
# Ensure circuit._components is handled by type checking or
60-
# defined in the QuantumCircuit class.
59+
# Ensure circuit._components is handled by type checking
6160
for component in getattr(circuit, "_components", []):
6261
gate_duration = 0.0
6362
if isinstance(component, GateOperation):
@@ -112,8 +111,6 @@ def get_measurements(self, rho_matrix: np.ndarray, num_shots: int) -> Dict[str,
112111
probabilities = self.get_probabilities(rho_matrix)
113112
num_qubits = int(np.log2(rho_matrix.shape[0]))
114113
outcomes = np.random.choice(len(rho_matrix), size=num_shots, p=probabilities)
115-
116-
# Fixed: Explicit type annotation for the dictionary to satisfy mypy
117114
counts: Dict[str, int] = {}
118115
for outcome in outcomes:
119116
bitstring = bin(int(outcome))[2:].zfill(num_qubits)

0 commit comments

Comments
 (0)