diff --git a/.gitignore b/.gitignore index 56fb6c78d2..1027fc4ff3 100644 --- a/.gitignore +++ b/.gitignore @@ -134,6 +134,7 @@ dmypy.json # tmp files tmp/ +tmp.npy # Mac .DS_Store diff --git a/src/qibo/result.py b/src/qibo/result.py index 007fb2ea36..39babb81f3 100644 --- a/src/qibo/result.py +++ b/src/qibo/result.py @@ -68,7 +68,7 @@ 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``. @@ -76,7 +76,8 @@ def state(self, numpy: bool = False): 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):