Skip to content

Commit

Permalink
add more tests for unitary gate
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotani-UT committed Aug 9, 2024
1 parent d211250 commit 6ca407e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/python/test_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6ca407e

Please sign in to comment.