Skip to content

Commit

Permalink
Fixed the random unitary generation from the Haar measure (#760) (#760)
Browse files Browse the repository at this point in the history
* fix #519 use scipy.stats.unitary_group

* Update CHANGELOG
  • Loading branch information
ikkoham authored and delapuente committed Aug 9, 2018
1 parent 5c418c5 commit b2c5251
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====================
Expand Down
4 changes: 2 additions & 2 deletions qiskit/tools/qi/qi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'):
Expand Down

0 comments on commit b2c5251

Please sign in to comment.