mirror of https://github.com/Qiskit/qiskit.git
seeding the randomness in test/python/circuit/test_isometry.py (#6559)
* seed test * the test added in #6482 * remove repeated code * simpler call * hardcore seed Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
13370342bc
commit
fcec842f1d
|
@ -35,17 +35,17 @@ class TestIsometry(QiskitTestCase):
|
|||
|
||||
@data(
|
||||
np.eye(2, 2),
|
||||
random_unitary(2).data,
|
||||
random_unitary(2, seed=868540).data,
|
||||
np.eye(4, 4),
|
||||
random_unitary(4).data[:, 0],
|
||||
random_unitary(4, seed=16785).data[:, 0],
|
||||
np.eye(4, 4)[:, 0:2],
|
||||
random_unitary(4).data,
|
||||
np.eye(4, 4)[:, np.random.permutation(np.eye(4, 4).shape[1])][:, 0:2],
|
||||
np.eye(8, 8)[:, np.random.permutation(np.eye(8, 8).shape[1])],
|
||||
random_unitary(8).data[:, 0:4],
|
||||
random_unitary(8).data,
|
||||
random_unitary(16).data,
|
||||
random_unitary(16).data[:, 0:8],
|
||||
random_unitary(4, seed=660477).data,
|
||||
np.eye(4, 4)[:, np.random.RandomState(seed=719010).permutation(4)][:, 0:2],
|
||||
np.eye(8, 8)[:, np.random.RandomState(seed=544326).permutation(8)],
|
||||
random_unitary(8, seed=247924).data[:, 0:4],
|
||||
random_unitary(8, seed=765720).data,
|
||||
random_unitary(16, seed=278663).data,
|
||||
random_unitary(16, seed=406498).data[:, 0:8],
|
||||
)
|
||||
def test_isometry(self, iso):
|
||||
"""Tests for the decomposition of isometries from m to n qubits"""
|
||||
|
@ -73,17 +73,17 @@ class TestIsometry(QiskitTestCase):
|
|||
|
||||
@data(
|
||||
np.eye(2, 2),
|
||||
random_unitary(2).data,
|
||||
random_unitary(2, seed=99506).data,
|
||||
np.eye(4, 4),
|
||||
random_unitary(4).data[:, 0],
|
||||
random_unitary(4, seed=673459).data[:, 0],
|
||||
np.eye(4, 4)[:, 0:2],
|
||||
random_unitary(4).data,
|
||||
np.eye(4, 4)[:, np.random.permutation(np.eye(4, 4).shape[1])][:, 0:2],
|
||||
np.eye(8, 8)[:, np.random.permutation(np.eye(8, 8).shape[1])],
|
||||
random_unitary(8).data[:, 0:4],
|
||||
random_unitary(8).data,
|
||||
random_unitary(16).data,
|
||||
random_unitary(16).data[:, 0:8],
|
||||
random_unitary(4, seed=124090).data,
|
||||
np.eye(4, 4)[:, np.random.RandomState(seed=889848).permutation(4)][:, 0:2],
|
||||
np.eye(8, 8)[:, np.random.RandomState(seed=94795).permutation(8)],
|
||||
random_unitary(8, seed=986292).data[:, 0:4],
|
||||
random_unitary(8, seed=632121).data,
|
||||
random_unitary(16, seed=623107).data,
|
||||
random_unitary(16, seed=889326).data[:, 0:8],
|
||||
)
|
||||
def test_isometry_tolerance(self, iso):
|
||||
"""Tests for the decomposition of isometries from m to n qubits with a custom tolerance"""
|
||||
|
@ -112,17 +112,17 @@ class TestIsometry(QiskitTestCase):
|
|||
|
||||
@data(
|
||||
np.eye(2, 2),
|
||||
random_unitary(2).data,
|
||||
random_unitary(2, seed=272225).data,
|
||||
np.eye(4, 4),
|
||||
random_unitary(4).data[:, 0],
|
||||
random_unitary(4, seed=592640).data[:, 0],
|
||||
np.eye(4, 4)[:, 0:2],
|
||||
random_unitary(4).data,
|
||||
np.eye(4, 4)[:, np.random.permutation(np.eye(4, 4).shape[1])][:, 0:2],
|
||||
np.eye(8, 8)[:, np.random.permutation(np.eye(8, 8).shape[1])],
|
||||
random_unitary(8).data[:, 0:4],
|
||||
random_unitary(8).data,
|
||||
random_unitary(16).data,
|
||||
random_unitary(16).data[:, 0:8],
|
||||
random_unitary(4, seed=714210).data,
|
||||
np.eye(4, 4)[:, np.random.RandomState(seed=719934).permutation(4)][:, 0:2],
|
||||
np.eye(8, 8)[:, np.random.RandomState(seed=284469).permutation(8)],
|
||||
random_unitary(8, seed=656745).data[:, 0:4],
|
||||
random_unitary(8, seed=583813).data,
|
||||
random_unitary(16, seed=101363).data,
|
||||
random_unitary(16, seed=583429).data[:, 0:8],
|
||||
)
|
||||
def test_isometry_inverse(self, iso):
|
||||
"""Tests for the inverse of isometries from m to n qubits"""
|
||||
|
|
Loading…
Reference in New Issue