Skip to content

Commit

Permalink
finally fix this issue
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Mar 14, 2024
1 parent 05c1966 commit 07d28fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/qibo/backends/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,11 @@ def _append_zeros(self, state, qubits, results):
"""Helper method for collapse."""
for q, r in zip(qubits, results):
state = self.np.expand_dims(state, q)
if r:
state = self.np.concatenate([self.np.zeros_like(state), state], q)
else:
state = self.np.concatenate([state, self.np.zeros_like(state)], q)
state = (
self.np.concatenate([self.np.zeros_like(state), state], q)
if r == 1
else self.np.concatenate([state, self.np.zeros_like(state)], q)
)
return state

def collapse_state(self, state, qubits, shot, nqubits, normalize=True):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_backends_clifford.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import pytest

from qibo import Circuit, gates, get_backend, set_backend
from qibo import Circuit, gates, set_backend
from qibo.backends import (
CliffordBackend,
GlobalBackend,
Expand Down

0 comments on commit 07d28fa

Please sign in to comment.