From 6ca407e5b2f6f5dc318b9a2f7fc5389dd8233f38 Mon Sep 17 00:00:00 2001 From: Kotani-UT Date: Fri, 9 Aug 2024 14:07:08 +0900 Subject: [PATCH] add more tests for unitary gate --- test/python/test_gate.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/python/test_gate.py b/test/python/test_gate.py index ff08078..d8865d3 100644 --- a/test/python/test_gate.py +++ b/test/python/test_gate.py @@ -99,8 +99,10 @@ def test_2q_1param_gates(): assert(norm < 0.000001) def test_unitary(): - random_matrix = scipy.stats.unitary_group.rvs(8) - qis_mat = qiskit_gates.UnitaryGate(random_matrix).to_matrix() - qdd_mat = pyQDD.unitary(random_matrix).getEigenMatrix() - norm = np.linalg.norm(qdd_mat-qis_mat) - assert(norm < 0.000001) + for bit in range(3, 5): + for _ in range(10): + random_matrix = scipy.stats.unitary_group.rvs(2**bit) + qis_mat = qiskit_gates.UnitaryGate(random_matrix).to_matrix() + qdd_mat = pyQDD.unitary(random_matrix).getEigenMatrix() + norm = np.linalg.norm(qdd_mat-qis_mat) + assert(norm < 0.000001)