diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 663c213e6989..da72fe0c9c5b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -49,6 +49,7 @@ Fixed - Fixed swap mapper using qubits after measurement (#691). - Fixed error in cpp simulator for 3+ qubit operations (#698). - Fixed issue with combining or extending circuits that contain CompositeGate (#710). +- Fixed the random unitary generation from the Haar measure (#760). `0.5.6`_ - 2018-07-06 ===================== diff --git a/qiskit/tools/qi/qi.py b/qiskit/tools/qi/qi.py index 2ebd25ec522c..14c5b98f13c1 100644 --- a/qiskit/tools/qi/qi.py +++ b/qiskit/tools/qi/qi.py @@ -18,6 +18,7 @@ import numpy as np import scipy.linalg as la +from scipy.stats import unitary_group from qiskit import QISKitError from qiskit.tools.qi.pauli import pauli_group @@ -335,8 +336,7 @@ def random_unitary_matrix(length): Returns: ndarray: U (length, length) unitary ndarray. """ - q_matrix = la.qr(__ginibre_matrix(length))[0] # Get only the first element - return q_matrix + return unitary_group.rvs(length) def random_density_matrix(length, rank=None, method='Hilbert-Schmidt'):