Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test_templates module + Fix LQ decomposition of StatePrep Ops + Fix LQ decomposition strategy of QFT and GroverOperator #684

Merged
merged 25 commits into from
Apr 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
41d77fd
Add test for QSVT.
vincentmr Apr 16, 2024
e890a52
Auto update version
github-actions[bot] Apr 16, 2024
243b121
Update changelog.
vincentmr Apr 16, 2024
3a59e7e
Add tests for embedding, layer and stateprep templates.
vincentmr Apr 16, 2024
8667022
Parametrize tests over n_qubits.
vincentmr Apr 16, 2024
ca467db
Add qchem template tests.
vincentmr Apr 16, 2024
92744f3
Add a few misc template tests.
vincentmr Apr 16, 2024
31f73ea
Merge branch 'master' into feature/test_templates
vincentmr Apr 17, 2024
a776b81
Auto update version
github-actions[bot] Apr 17, 2024
369739e
trigger ci
vincentmr Apr 17, 2024
a4985de
Fix serialize.
vincentmr Apr 17, 2024
103bad1
Fix formatting.
vincentmr Apr 17, 2024
fc89d8d
Update tests/test_templates.py
vincentmr Apr 17, 2024
ecb49e0
Update tests/test_templates.py
vincentmr Apr 17, 2024
7aaef8a
Add xfail condition for AmplitudeEmbedding.
vincentmr Apr 17, 2024
1412d42
Fix pytest.skip top cond.
vincentmr Apr 17, 2024
1f9ed97
Update tests/test_templates.py
vincentmr Apr 17, 2024
3c5395c
Update pennylane_lightning/core/_serialize.py
vincentmr Apr 17, 2024
cea50c1
Add breaking tests for if not observable
vincentmr Apr 17, 2024
1a65c8f
trigger ci
vincentmr Apr 17, 2024
8dc58ab
Merge branch 'master' into feature/test_templates
vincentmr Apr 17, 2024
201d14a
Auto update version
github-actions[bot] Apr 17, 2024
50b7fa9
Fix decompositions with `LightningQubit` (#687)
mudit2812 Apr 18, 2024
b10c6fb
Merge branch 'master' into feature/test_templates
maliasadi Apr 18, 2024
a0c6265
Fix test params
vincentmr Apr 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix test params
  • Loading branch information
vincentmr committed Apr 18, 2024
commit a0c6265e524897407551b1df13081f7b4f8c846c
41 changes: 20 additions & 21 deletions tests/test_templates.py
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_preprocess_grover_operator_decomposition(self, wires):
class TestAngleEmbedding:
"""Test the AngleEmbedding algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_angleembedding(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -104,14 +104,13 @@ class TestAmplitudeEmbedding:
"""Test the AmplitudeEmbedding algorithm."""

@pytest.mark.parametrize("first_op", [False, True])
@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 10, 2))
def test_amplitudeembedding(self, first_op, n_qubits):
if not first_op:
if device_name == "lightning.qubit":
pytest.xfail(f"{device_name} too slow.")
pytest.xfail(
f"Operation StatePrep cannot be used after other Operations have already been applied on a {device_name} device."
)
if device_name != "lightning.qubit":
pytest.xfail(
f"Operation StatePrep cannot be used after other Operations have already been applied on a {device_name} device."
)

dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -133,7 +132,7 @@ def circuit(f=None):
class TestBasisEmbedding:
"""Test the BasisEmbedding algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_basisembedding(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -153,7 +152,7 @@ def circuit(feature_vector):
class TestDisplacementSqueezingEmbedding:
"""Test the DisplacementEmbedding and SqueezingEmbedding algorithms."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
@pytest.mark.parametrize("template", [qml.DisplacementEmbedding, qml.SqueezingEmbedding])
def test_displacementembedding(self, n_qubits, template):
dev = qml.device(device_name, wires=n_qubits)
Expand All @@ -172,7 +171,7 @@ def circuit(feature_vector):
class TestIQPEmbedding:
"""Test the IQPEmbedding algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_iqpembedding(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -192,7 +191,7 @@ def circuit(feature_vector):
class TestQAOAEmbedding:
"""Test the QAOAEmbedding algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_qaoaembedding(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand Down Expand Up @@ -232,7 +231,7 @@ def circuit(weights):
class TestRandomLayers:
"""Test the RandomLayers algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_randomlayers(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit", wires=n_qubits)
Expand All @@ -252,7 +251,7 @@ def circuit(weights):
class TestStronglyEntanglingLayers:
"""Test the StronglyEntanglingLayers algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_stronglyentanglinglayers(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -273,7 +272,7 @@ def circuit(weights):
class TestSimplifiedTwoDesign:
"""Test the SimplifiedTwoDesign algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_simplifiedtwodesign(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -296,7 +295,7 @@ def circuit(init_weights, weights):
class TestBasicEntanglerLayers:
"""Test the BasicEntanglerLayers algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_basicentanglerlayers(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand Down Expand Up @@ -612,7 +611,7 @@ def circuit(params):
class TestApproxTimeEvolution:
"""Test the ApproxTimeEvolution algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_approxtimeevolution(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -634,7 +633,7 @@ def circuit(time):
class TestQDrift:
"""Test the QDrift algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_qdrift(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit", wires=n_qubits)
Expand All @@ -656,7 +655,7 @@ def circuit(time):
class TestTrotterProduct:
"""Test the TrotterProduct algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_trotterproduct(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand All @@ -678,7 +677,7 @@ def circuit(time):
class TestQuantumPhaseEstimation:
"""Test the QuantumPhaseEstimation algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 12, 2))
def test_quantumphaseestimation(self, n_qubits):
phase = 5
target_wires = [0]
Expand Down Expand Up @@ -710,7 +709,7 @@ def circuit():
class TestQFT:
"""Test the QFT algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_qft(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand Down Expand Up @@ -769,7 +768,7 @@ def circuit(basis_state):
class TestQSVT:
"""Test the QSVT algorithm."""

@pytest.mark.parametrize("n_qubits", range(2, 14, 2))
@pytest.mark.parametrize("n_qubits", range(2, 20, 2))
def test_qsvt(self, n_qubits):
dev = qml.device(device_name, wires=n_qubits)
dq = qml.device("default.qubit")
Expand Down
Loading