Skip to content

Commit

Permalink
Check for real matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
trbromley committed Mar 19, 2021
1 parent 212b0ae commit 9646a23
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# pylint: disable=protected-access,cell-var-from-loop
from unittest import mock
from scipy.stats import unitary_group
from scipy.stats import unitary_group, ortho_group

import numpy as np
import pennylane as qml
Expand Down Expand Up @@ -1215,11 +1215,15 @@ def test_pauliz_hadamard(self, theta, phi, varphi, monkeypatch, qubit_device_3_w
assert np.allclose(var, expected, atol=tol, rtol=0)


@pytest.mark.parametrize("real", [True, False])
@pytest.mark.parametrize("wires", range(2, 10))
def test_qubit_unitary(wires):
def test_qubit_unitary(wires, real):
"""Test if lightning.qubit successful applies an arbitrary unitary"""

unitary = unitary_group.rvs(2 ** wires, random_state=0)
if real:
unitary = ortho_group.rvs(2 ** wires, random_state=0)
else:
unitary = unitary_group.rvs(2 ** wires, random_state=0)

dev = qml.device("lightning.qubit", wires=wires)

Expand Down

0 comments on commit 9646a23

Please sign in to comment.