def measure(self) -> np.ndarray:
        """Measure the state in the computational basis.

        Returns:
            A [2]*bits array of qubit states, either 0 or 1
        """
        # TODO: Can we do this within backend?
        probs = np.real(bk.evaluate(self.probabilities()))
        indices = np.asarray(list(np.ndindex(*[2] * self.qubit_nb)))
        res = np.random.choice(probs.size, p=probs.ravel())
        res = indices[res]
        return res
def measure ( self ) -> np . ndarray : probs = np . real ( bk . evaluate ( self . probabilities ( ) ) ) indices = np . asarray ( list ( np . ndindex ( * [ 2 ] * self . qubit_nb ) ) ) res = np . random . choice ( probs . size , p = probs . ravel ( ) ) res = indices [ res ] return res
Measure the state in the computational basis.

        Returns:
            A [2]*bits array of qubit states, either 0 or 1