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

Update serialization tests with PauliWord order updates #688

Merged
merged 65 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
b15aeaf
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane-lig…
AmintorDusko Mar 18, 2024
65c8853
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane-lig…
AmintorDusko Mar 19, 2024
ebeb417
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane-lig…
AmintorDusko Mar 19, 2024
d664fd2
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane-lig…
AmintorDusko Mar 21, 2024
c942497
port PR changes so far, after traumatic rebase
AmintorDusko Mar 21, 2024
e503442
update vjp tests
AmintorDusko Mar 21, 2024
473c030
format
AmintorDusko Mar 21, 2024
e3ff0f7
update vjp tests
AmintorDusko Mar 21, 2024
87ed3ff
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane-lig…
AmintorDusko Mar 22, 2024
690402c
Merge branch 'master' into lq2-vjp
AmintorDusko Mar 22, 2024
016388b
update dev version
AmintorDusko Mar 22, 2024
3e8e2cd
format
AmintorDusko Mar 22, 2024
3032b65
add tests for vjp
AmintorDusko Mar 22, 2024
fc7b22a
Merge branch 'master' into lq2-vjp
AmintorDusko Mar 22, 2024
9e7c6ed
Auto update version
github-actions[bot] Mar 22, 2024
8dc40b1
Merge branch 'lq2-vjp' of https://github.com/PennyLaneAI/pennylane-li…
AmintorDusko Mar 22, 2024
a085bca
Merge branch 'master' into lq2-vjp
mudit2812 Apr 2, 2024
e597ada
Auto update version
github-actions[bot] Apr 2, 2024
27b00a6
Updated tests
mudit2812 Apr 2, 2024
47fa871
Updated serialization
mudit2812 Apr 2, 2024
3fbeea1
Unpinned cmake
mudit2812 Apr 2, 2024
424fb83
Update changelog
mudit2812 Apr 2, 2024
17c9b0f
Update .github/CHANGELOG.md
mudit2812 Apr 3, 2024
2bd881f
isort
mudit2812 Apr 3, 2024
08bea1c
black
mudit2812 Apr 3, 2024
bed5404
Run CI with updated PL branch
mudit2812 Apr 3, 2024
5a0823e
Merge branch 'master' into op-math-serialize
mudit2812 Apr 4, 2024
858dc24
Auto update version
github-actions[bot] Apr 4, 2024
57807f3
trigger ci
vincentmr Apr 5, 2024
7691b04
Added changes per review
mudit2812 Apr 8, 2024
1ce158b
Auto update version
github-actions[bot] Apr 8, 2024
3c198c3
Update requirements-dev.txt
mudit2812 Apr 8, 2024
ec55c7c
Merge branch 'master' into op-math-serialize
mudit2812 Apr 8, 2024
e44e9dc
Update pennylane_lightning/core/_serialize.py
mudit2812 Apr 9, 2024
45f3342
Merge branch 'master' into op-math-serialize
mudit2812 Apr 9, 2024
cdc2d9c
Auto update version
github-actions[bot] Apr 9, 2024
98c77ee
Trigger CI
mudit2812 Apr 9, 2024
d125a3c
Update overlapping wires prod serialization test
mudit2812 Apr 9, 2024
0287abd
Updated tests to work with new pauli word order
mudit2812 Apr 10, 2024
9dc4bb0
Added device_vjp tests
mudit2812 Apr 10, 2024
6586d83
Update serialize tests
mudit2812 Apr 17, 2024
aa110e8
Merge branch 'master' into pw-reorder
mudit2812 Apr 17, 2024
e7fe445
Auto update version
github-actions[bot] Apr 17, 2024
12a681e
Skipped tf test
mudit2812 Apr 17, 2024
0d6b00d
Merge branch 'master' into pw-reorder
mudit2812 Apr 18, 2024
1716ff9
Auto update version
github-actions[bot] Apr 18, 2024
d832c6d
Merge branch 'master' into pw-reorder
mudit2812 Apr 18, 2024
7c40d6a
Auto update version
github-actions[bot] Apr 18, 2024
62a8b91
Trigger CI
mudit2812 Apr 18, 2024
b3f7716
Updated torch test
mudit2812 Apr 18, 2024
5b2d2d0
Merge branch 'master' into pw-reorder
mudit2812 Apr 18, 2024
154e105
Update serialization tests; removed xfail
mudit2812 Apr 18, 2024
65662c7
Trigger CI
mudit2812 Apr 19, 2024
2c34cfb
Auto update version
github-actions[bot] Apr 19, 2024
daf5a8c
Merge branch 'master' into pw-reorder
mudit2812 Apr 19, 2024
2158c6d
Remove vjp tests
mudit2812 Apr 19, 2024
899569c
Trigger CI
mudit2812 Apr 19, 2024
c7b5781
Trigger CI
mudit2812 Apr 19, 2024
3ed8e36
Merge branch 'master' into pw-reorder
mudit2812 Apr 22, 2024
b05ddf9
[skip ci] Revert requirements file
mudit2812 Apr 22, 2024
7704d10
Merge branch 'master' into pw-reorder
maliasadi Apr 23, 2024
d4f5c08
Auto update version from '0.36.0-dev35' to '0.36.0-dev36'
ringo-but-quantum Apr 23, 2024
80e7d5f
Trigger CI
mudit2812 Apr 23, 2024
296ea6d
Trigger CI
mudit2812 Apr 23, 2024
5bd3134
Fix native mcm workflow following dynamic_one_shot refactor. (#694)
vincentmr Apr 24, 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
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.36.0-dev35"
__version__ = "0.36.0-dev36"
37 changes: 16 additions & 21 deletions tests/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@ def test_tensor_non_tensor_return(self, use_csingle, wires_map):

named_obs = NamedObsC64 if use_csingle else NamedObsC128
tensor_prod_obs = TensorProdObsC64 if use_csingle else TensorProdObsC128
first_s = tensor_prod_obs([named_obs("PauliX", [1]), named_obs("PauliZ", [0])])

s_expected = [
first_s,
tensor_prod_obs([named_obs("PauliZ", [0]), named_obs("PauliX", [1])]),
named_obs("Hadamard", [1]),
]

Expand All @@ -158,7 +157,6 @@ def test_tensor_non_tensor_return(self, use_csingle, wires_map):
)
assert s == s_expected

@pytest.mark.xfail(reason="Prod with overlapping wires not supported")
@pytest.mark.parametrize("use_csingle", [True, False])
@pytest.mark.parametrize("wires_map", [wires_dict, None])
def test_prod_return_with_overlapping_wires(self, use_csingle, wires_map):
Expand Down Expand Up @@ -283,7 +281,7 @@ def test_hamiltonian_return(self, use_csingle, wires_map):
named_obs("PauliY", [2]),
]
),
tensor_prod_obs([named_obs("PauliY", [2]), named_obs("PauliX", [0])]),
tensor_prod_obs([named_obs("PauliX", [0]), named_obs("PauliY", [2])]),
hermitian_obs(np.ones(64, dtype=c_dtype), [0, 1, 2]),
],
)
Expand Down Expand Up @@ -317,22 +315,23 @@ def test_hamiltonian_tensor_return(self, use_csingle, wires_map):
tape, wires_map
)

first_term = tensor_prod_obs(
[
hermitian_obs(np.eye(4, dtype=c_dtype).ravel(), [0, 1]),
named_obs("PauliY", [2]),
named_obs("PauliZ", [3]),
]
)
# Expression (ham @ obs) is converted internally by Pennylane
# where obs is appended to each term of the ham

s_expected = hamiltonian_obs(
np.array([0.3, 0.5, 0.4], dtype=r_dtype),
[
first_term,
tensor_prod_obs(
[
hermitian_obs(np.eye(4, dtype=c_dtype).ravel(), [0, 1]),
named_obs("PauliY", [2]),
named_obs("PauliZ", [3]),
]
),
tensor_prod_obs(
[
named_obs("PauliX", [0]),
named_obs("PauliY", [2]),
named_obs("PauliZ", [3]),
]
),
Expand Down Expand Up @@ -388,7 +387,7 @@ def test_hamiltonian_mix_return(self, use_csingle, wires_map):
named_obs("PauliY", [2]),
]
),
tensor_prod_obs([named_obs("PauliY", [2]), named_obs("PauliX", [0])]),
tensor_prod_obs([named_obs("PauliX", [0]), named_obs("PauliY", [2])]),
hermitian_obs(np.ones(64, dtype=c_dtype), [0, 1, 2]),
],
)
Expand All @@ -401,7 +400,7 @@ def test_hamiltonian_mix_return(self, use_csingle, wires_map):
hermitian_obs(np.eye(4, dtype=c_dtype).ravel(), [1, 2]),
]
),
tensor_prod_obs([named_obs("PauliX", [2]), named_obs("PauliY", [0])]),
tensor_prod_obs([named_obs("PauliY", [0]), named_obs("PauliX", [2])]),
],
)

Expand Down Expand Up @@ -441,7 +440,7 @@ def test_pauli_rep_single_term(self, use_csingle, wires_map):
s, _ = QuantumScriptSerializer(device_name, use_csingle).serialize_observables(
tape, wires_map
)
s_expected = tensor_prod_obs([named_obs("PauliZ", [1]), named_obs("PauliX", [0])])
s_expected = tensor_prod_obs([named_obs("PauliX", [0]), named_obs("PauliZ", [1])])
assert s[0] == s_expected

@pytest.mark.parametrize("use_csingle", [True, False])
Expand Down Expand Up @@ -482,11 +481,7 @@ def test_prod(self, use_csingle, wires_map):
assert isinstance(res[0], tensor_obs)

s_expected = tensor_obs(
[
named_obs("PauliZ", [0]),
named_obs("PauliX", [1]),
named_obs("Hadamard", [2]),
]
[named_obs("PauliZ", [0]), named_obs("PauliX", [1]), named_obs("Hadamard", [2])]
)
assert res[0] == s_expected

Expand Down Expand Up @@ -522,7 +517,7 @@ def test_sum(self, use_csingle, wires_map):
coeffs,
[
tensor_obs(
[named_obs("PauliZ", [1]), named_obs("PauliX", [0]), named_obs("PauliX", [2])]
[named_obs("PauliX", [0]), named_obs("PauliZ", [1]), named_obs("PauliX", [2])]
),
tensor_obs(
[named_obs("PauliZ", [0]), named_obs("PauliY", [1]), named_obs("Hadamard", [2])]
Expand Down
Loading