Skip to content

Commit

Permalink
fix numpy==True method in QuantumState
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Dec 8, 2023
1 parent 292e63a commit 6909e26
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/qibo/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,16 @@ def state(self, numpy: bool = False):
"""State's tensor representation as a backend tensor.
Args:
numpy (bool, optional): If ``True`` the returned tensor will be a numpy array,
numpy (bool, optional): If ``True`` the returned tensor will be a ``numpy`` array,
otherwise it will follow the backend tensor type.
Defaults to ``False``.
Returns:
The state in the computational basis.
"""
if numpy:
return np.array(self._state)
return np.array(self._state.tolist())

return self._state

def probabilities(self, qubits: Optional[Union[list, set]] = None):
Expand Down

0 comments on commit 6909e26

Please sign in to comment.