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

Migrate lightning.qubit to the new API #646

Merged
merged 290 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
290 commits
Select commit Hold shift + click to select a range
dc3149f
fix reset state
AmintorDusko Feb 21, 2024
378e376
Update pennylane_lightning/lightning_qubit/_state_vector.py
AmintorDusko Feb 21, 2024
7a5c010
Update pennylane_lightning/lightning_qubit/_state_vector.py
AmintorDusko Feb 21, 2024
b23eabf
Update pennylane_lightning/lightning_qubit/_state_vector.py
AmintorDusko Feb 21, 2024
112d2ff
remove LightningQubit2 references
AmintorDusko Feb 21, 2024
1a8fe19
remove unnecessary modules
AmintorDusko Feb 21, 2024
9ded798
merging Serializer classes
AmintorDusko Feb 21, 2024
2e43fd6
update serialize tests
AmintorDusko Feb 21, 2024
f80c363
update measurements with new serialize class
AmintorDusko Feb 21, 2024
4f4b29e
remove outdated test
AmintorDusko Feb 21, 2024
44e8a0d
Merge branch 'lightning-qubit2-add-simulate' into lightning-qubit2-in…
albi3ro Feb 21, 2024
341d47c
register with setup.py, state vector fixes
albi3ro Feb 21, 2024
c8f3b48
merge
albi3ro Feb 21, 2024
1f78bef
remove obsolete tests
AmintorDusko Feb 22, 2024
b7ccb84
remove unused dtype input from simulate
AmintorDusko Feb 22, 2024
58032ef
update measurements
AmintorDusko Feb 22, 2024
a3b696e
update state_vector
AmintorDusko Feb 22, 2024
cd7c67c
update lightning_qubit2
AmintorDusko Feb 22, 2024
910246b
format
AmintorDusko Feb 22, 2024
af6cfef
pylint
AmintorDusko Feb 22, 2024
dd31965
Update pennylane_lightning/lightning_qubit/_state_vector.py
AmintorDusko Feb 22, 2024
15498f8
Merge branch 'lightning-qubit2-add-simulate' into lightning-qubit2-in…
albi3ro Feb 22, 2024
44bc987
remove old comment
AmintorDusko Feb 22, 2024
5a5b20a
some review suggestions
AmintorDusko Feb 22, 2024
dcdd9ff
Merge branch 'master' into lightning-qubit2-add-simulate
AmintorDusko Feb 22, 2024
a64cf78
Auto update version
github-actions[bot] Feb 22, 2024
ad1e3a4
remove print
AmintorDusko Feb 22, 2024
aec5c07
update state vector class
AmintorDusko Feb 22, 2024
286fd4c
add state vector class tests
AmintorDusko Feb 22, 2024
4ee6609
adding measurement tests
albi3ro Feb 22, 2024
c262650
Merge branch 'lightning-qubit2-add-simulate' of https://github.com/Pe…
albi3ro Feb 22, 2024
e8b606e
update state vector and tests
AmintorDusko Feb 23, 2024
7ab3ade
move and rename test files, and format
AmintorDusko Feb 23, 2024
36c6b79
Merge branch 'master' into lightning-qubit2-add-simulate
AmintorDusko Feb 23, 2024
9aa3e35
Auto update version
github-actions[bot] Feb 23, 2024
b9fa21d
skip measurements class for other devices and in the absence of binaries
AmintorDusko Feb 23, 2024
48c6724
format
AmintorDusko Feb 23, 2024
2a67020
add LightningQubit2 to init and format
AmintorDusko Feb 23, 2024
a716611
update measurements class
AmintorDusko Feb 23, 2024
261cb6d
expand measurement class testing
AmintorDusko Feb 23, 2024
aca8468
garbage collection
AmintorDusko Feb 23, 2024
80e3494
typo
AmintorDusko Feb 23, 2024
3aa71fb
Merge branch 'master' into lightning-qubit2-add-simulate
AmintorDusko Feb 26, 2024
a284d78
update coverage and StateVector class
AmintorDusko Feb 26, 2024
43f72f6
expand measurements class coverage
AmintorDusko Feb 26, 2024
2a973d9
Auto update version
github-actions[bot] Feb 26, 2024
f42f298
add coverage for n-controlled operations
AmintorDusko Feb 27, 2024
9cd5471
add map to standard wires to get_final_state for safety
AmintorDusko Feb 27, 2024
cd3096c
update jax config import
AmintorDusko Feb 27, 2024
099e180
Merge branch 'master' into lightning-qubit2-add-simulate
AmintorDusko Feb 27, 2024
98db9db
Auto update version
github-actions[bot] Feb 27, 2024
4f746d0
trigger CI
AmintorDusko Feb 27, 2024
0395945
update state vector class and tests for improved coverage
AmintorDusko Feb 28, 2024
4a863ba
update measurement class tests
AmintorDusko Feb 28, 2024
4374680
Merge branch 'master' into lightning-qubit2-add-simulate
AmintorDusko Feb 28, 2024
4b44e4f
update dev version
AmintorDusko Feb 28, 2024
812f283
Merge branch 'lightning-qubit2-add-simulate' into lightning-qubit2-in…
AmintorDusko Feb 28, 2024
3a87ca8
add cpp binary available variable
AmintorDusko Feb 28, 2024
62c43f0
remove device definition
AmintorDusko Feb 28, 2024
7956c16
Merge branch 'master' into lightning-qubit2-add-simulate
AmintorDusko Feb 28, 2024
dd192da
merge master
AmintorDusko Feb 28, 2024
2d26288
update dev version
AmintorDusko Feb 28, 2024
3427562
Auto update version
github-actions[bot] Feb 28, 2024
98a0d32
Merge branch 'lightning-qubit2-add-simulate' into lightning-qubit2-in…
AmintorDusko Feb 29, 2024
dcfb190
reduce dependency on DefaultQubit for tests
AmintorDusko Feb 29, 2024
6660818
update LightningQubit2
AmintorDusko Feb 29, 2024
8a9b9a5
clean test_measurements_class.py
AmintorDusko Feb 29, 2024
36d810e
isort+black
AmintorDusko Feb 29, 2024
816955f
review suggestion
AmintorDusko Feb 29, 2024
940644c
fix docs
AmintorDusko Feb 29, 2024
4a3f95f
Merge branch 'lightning-qubit2-add-simulate' into lightning-qubit2-in…
AmintorDusko Feb 29, 2024
3922c32
Add qml.var support.
vincentmr Mar 4, 2024
140654a
Merge branch 'master' into lightning-qubit2-add-simulate
AmintorDusko Mar 4, 2024
5b31b07
Add probs support.
vincentmr Mar 5, 2024
b54d3ea
increase tolerance
AmintorDusko Mar 5, 2024
e1e9c05
Merge branch 'master' into lightning-qubit2-add-simulate
AmintorDusko Mar 5, 2024
3703b94
Auto update version
github-actions[bot] Mar 5, 2024
8519c1c
isort
AmintorDusko Mar 5, 2024
60aef32
Add double-obs tests.
vincentmr Mar 5, 2024
6308ba2
Pin pytest version (#624)
AmintorDusko Mar 4, 2024
3a08c62
Version Bump (#626)
github-actions[bot] Mar 4, 2024
daab5ad
increase tolerance
AmintorDusko Mar 5, 2024
078c8d8
Introduce isort. (#623)
vincentmr Mar 5, 2024
4ecf2fb
Auto update version
github-actions[bot] Mar 5, 2024
3bab48b
isort
AmintorDusko Mar 5, 2024
11f6a1b
Add qml.var support.
vincentmr Mar 4, 2024
186e53b
Add probs support.
vincentmr Mar 5, 2024
0222336
Add measurement tests with wires.
vincentmr Mar 5, 2024
6ea2ee8
Merge remote-tracking branch 'origin/lightning-qubit2-add-simulate' i…
vincentmr Mar 5, 2024
0d7db96
Merge remote-tracking branch 'origin/lightning-qubit2-interface' into…
vincentmr Mar 5, 2024
bdc28f8
review suggestions
AmintorDusko Mar 5, 2024
45b5448
remove unused imports
AmintorDusko Mar 5, 2024
25374dd
Introduce _new_API and fix/skip few tests.
vincentmr Mar 5, 2024
e57642c
Fix few more tests.
vincentmr Mar 5, 2024
1c8f20c
Skip shots, adjoint, vjp with new API.
vincentmr Mar 5, 2024
5e80afb
remove diagonalization gate application from state vector
AmintorDusko Mar 5, 2024
96618ca
pytest.skip tests
vincentmr Mar 5, 2024
437e300
Merge branch 'lightning-qubit2-add-simulate' into lightning-qubit2-ad…
vincentmr Mar 5, 2024
edd65a8
Merge branch 'master' into lightning-qubit2-add-measurements
AmintorDusko Mar 6, 2024
24976a9
Auto update version
github-actions[bot] Mar 6, 2024
1c75bbf
Merge branch 'lightning-qubit2-add-measurements' into lightning-qubit…
vincentmr Mar 6, 2024
fda2b3e
Fix format
vincentmr Mar 6, 2024
8e20f9a
Merge remote-tracking branch 'origin/lightning-qubit2-add-measurement…
vincentmr Mar 6, 2024
4adccf2
Fix no-bin interface.
vincentmr Mar 6, 2024
09f3bfa
WIP
vincentmr Mar 5, 2024
aa1d1a8
Initial shots support + fix test_measurement tests.
vincentmr Mar 6, 2024
e844ccb
Merge branch 'master' into lightning-qubit2-add-jacobian
AmintorDusko Mar 6, 2024
095fc5c
update
albi3ro Feb 16, 2024
3a93d1d
adding tests from add-simulate branch
albi3ro Feb 16, 2024
d172e61
merge conflicts
albi3ro Feb 16, 2024
5eb9fa4
create state vector on initialization
albi3ro Feb 16, 2024
ff1eef5
remove import of modifier from lightning
albi3ro Feb 16, 2024
369700a
Update pennylane_lightning/lightning_qubit/lightning_qubit2.py
albi3ro Feb 16, 2024
a2056f1
minor test updates
albi3ro Feb 21, 2024
07041bc
register with setup.py, state vector fixes
albi3ro Feb 21, 2024
7229bbf
add LightningQubit2 to init and format
AmintorDusko Feb 23, 2024
3cca273
add cpp binary available variable
AmintorDusko Feb 28, 2024
be6fb51
reduce dependency on DefaultQubit for tests
AmintorDusko Feb 29, 2024
d6fdb79
update LightningQubit2
AmintorDusko Feb 29, 2024
1d45164
Fixing rebase artifacts
mudit2812 Mar 6, 2024
57869f4
Add fewLQ2 tests.
vincentmr Mar 6, 2024
b0cf5ef
Merge remote-tracking branch 'origin/lightning-qubit2-interface' into…
vincentmr Mar 6, 2024
13130c4
remove adjoint diff support from supports derivatives
albi3ro Mar 6, 2024
7d24981
Merge remote-tracking branch 'origin/lightning-qubit2-interface' into…
vincentmr Mar 6, 2024
dd354f4
Merge branch 'lightning-qubit2-upgrade-API' into lightning-qubit2-add…
vincentmr Mar 6, 2024
968acff
Remove print from test_apply
vincentmr Mar 6, 2024
4981e8b
Add expval/var tests.
vincentmr Mar 6, 2024
4eccac3
Remove duplicate class data.
vincentmr Mar 6, 2024
11227a9
Include LQ2 in linux ests.
vincentmr Mar 6, 2024
e61f534
Merge branch 'lightning-qubit2-upgrade-API' into lightning-qubit2-add…
vincentmr Mar 6, 2024
6da12f4
Add _group_measurements support.
vincentmr Mar 6, 2024
bc870e5
--cov-append
vincentmr Mar 6, 2024
ee01c2f
Add mcmc capability + tests.
vincentmr Mar 6, 2024
2c52cf1
Auto update version
github-actions[bot] Mar 7, 2024
bc89bd1
Merge branch 'master' into lightning-qubit2-add-jacobian
AmintorDusko Mar 7, 2024
357973a
update dev version
AmintorDusko Mar 7, 2024
85128b5
add LightningAdjointJacobian class
AmintorDusko Mar 7, 2024
f95e16b
add unit tests for the LightningAdjointJacobian class
AmintorDusko Mar 7, 2024
724532b
format
AmintorDusko Mar 7, 2024
e938f97
add changelog for PR #613
AmintorDusko Mar 7, 2024
a95b5b1
[skip ci] Added skeleton file for LQ2 unit tests
mudit2812 Mar 7, 2024
a1d5f14
update changelog
AmintorDusko Mar 7, 2024
74dec3a
Merge branch 'master' into lightning-qubit2-interface
mudit2812 Mar 7, 2024
424c8e9
update adjoint Jacobian
AmintorDusko Mar 7, 2024
c91ff39
Auto update version
github-actions[bot] Mar 7, 2024
b005b9b
codefactor
AmintorDusko Mar 7, 2024
1d6afc2
Add shots tests and fix bugs in LQ, LQ2.
vincentmr Mar 7, 2024
7dd8b84
Lightning qubit2 upgrade api (#628)
vincentmr Mar 7, 2024
2747a84
fix processing_fn_expval
AmintorDusko Mar 7, 2024
4959e77
make a proper new_tape
AmintorDusko Mar 7, 2024
0c306b8
Added init tests; Added skeleton tests for helpers
mudit2812 Mar 7, 2024
9e6cc02
Fix more bug with shots.
vincentmr Mar 7, 2024
75c116a
trigger CI
AmintorDusko Mar 7, 2024
fa2ade4
Merge remote-tracking branch 'origin/lightning-qubit2-interface' into…
vincentmr Mar 7, 2024
84d7239
Change pennylane branch for CI.
vincentmr Mar 7, 2024
e3bc241
Update .github/CHANGELOG.md
AmintorDusko Mar 7, 2024
ef35f9d
Update pennylane_lightning/lightning_qubit/_adjoint_jacobian.py
AmintorDusko Mar 7, 2024
e159b55
Update pennylane_lightning/lightning_qubit/_adjoint_jacobian.py
AmintorDusko Mar 7, 2024
4363687
Add probs support.
vincentmr Mar 5, 2024
c1d2ee6
Add double-obs tests.
vincentmr Mar 5, 2024
5535a68
Add qml.var support.
vincentmr Mar 4, 2024
9f5e70f
Add probs support.
vincentmr Mar 5, 2024
ef33d29
Add measurement tests with wires.
vincentmr Mar 5, 2024
1fdab8c
pytest.skip tests
vincentmr Mar 5, 2024
3d9eb6f
Fix format
vincentmr Mar 6, 2024
c3d3395
update
albi3ro Feb 16, 2024
aae5771
adding tests from add-simulate branch
albi3ro Feb 16, 2024
a92d73a
merge conflicts
albi3ro Feb 16, 2024
d7b38a2
create state vector on initialization
albi3ro Feb 16, 2024
6a73755
remove import of modifier from lightning
albi3ro Feb 16, 2024
0ec5089
Update pennylane_lightning/lightning_qubit/lightning_qubit2.py
albi3ro Feb 16, 2024
5646c82
minor test updates
albi3ro Feb 21, 2024
5bae4ac
register with setup.py, state vector fixes
albi3ro Feb 21, 2024
56d76a2
add LightningQubit2 to init and format
AmintorDusko Feb 23, 2024
8f85bab
add cpp binary available variable
AmintorDusko Feb 28, 2024
e2929a5
reduce dependency on DefaultQubit for tests
AmintorDusko Feb 29, 2024
b38c242
update LightningQubit2
AmintorDusko Feb 29, 2024
9480844
Fixing rebase artifacts
mudit2812 Mar 6, 2024
76fb7d9
remove adjoint diff support from supports derivatives
albi3ro Mar 6, 2024
c9f72d0
[skip ci] Added skeleton file for LQ2 unit tests
mudit2812 Mar 7, 2024
86ade7b
Lightning qubit2 upgrade api (#628)
vincentmr Mar 7, 2024
6d134d6
Added init tests; Added skeleton tests for helpers
mudit2812 Mar 7, 2024
5736055
Resolving rebase artifacts
mudit2812 Mar 7, 2024
283cf5b
Refactor shots test.
vincentmr Mar 7, 2024
72a42d8
Merge remote-tracking branch 'origin/lightning-qubit2-upgrade-API' in…
vincentmr Mar 7, 2024
f66419a
Merge remote-tracking branch 'origin/lightning-qubit2-interface' into…
vincentmr Mar 7, 2024
0dd4229
Added tests; integrated jacobian
mudit2812 Mar 8, 2024
413e684
Merge branch 'master' into lightning-qubit2-interface
mudit2812 Mar 8, 2024
62d0aa7
Update pennylane_lightning/lightning_qubit/lightning_qubit2.py
mudit2812 Mar 8, 2024
41772f6
Auto update version
github-actions[bot] Mar 8, 2024
4f6f609
Small update to simulate_and_jacobian
mudit2812 Mar 8, 2024
9275c27
Merge remote-tracking branch 'origin/lightning-qubit2-interface' into…
vincentmr Mar 8, 2024
c6c360e
Merge remote-tracking branch 'origin/master' into lightning-qubit2-ad…
vincentmr Mar 18, 2024
7c4db25
Auto update version
github-actions[bot] Mar 18, 2024
02394dd
Rerun isort.
vincentmr Mar 18, 2024
3f24255
Uncomment integration tests.
vincentmr Mar 18, 2024
62411b6
Reformat
vincentmr Mar 18, 2024
791600e
Delete symlink
vincentmr Mar 18, 2024
a39f7a6
Fix pylint.
vincentmr Mar 18, 2024
b15aeaf
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane-lig…
AmintorDusko Mar 18, 2024
12ba757
Run linux tests in parallel (when possible).
vincentmr Mar 18, 2024
147e75e
Run double obs tests with shots.
vincentmr Mar 18, 2024
d4416f8
Revert linux tests
vincentmr Mar 18, 2024
349400b
Fix bg in diag_gates.
vincentmr Mar 18, 2024
f96b4d7
Call isort/black with python -m
vincentmr Mar 18, 2024
ccd5fec
Merge branch 'lightning-qubit2-add-shots' into lightning-qubit-new-api
AmintorDusko Mar 18, 2024
de17699
update dev version
AmintorDusko Mar 18, 2024
ad66e76
Add docstrings, rm C_DTYPE.
vincentmr Mar 18, 2024
e1a1c68
Merge branch 'master' into lightning-qubit2-add-shots
vincentmr Mar 18, 2024
70c5494
Auto update version
github-actions[bot] Mar 18, 2024
cff6f25
Merge branch 'lightning-qubit2-add-shots' of https://github.com/Penny…
AmintorDusko Mar 19, 2024
65c8853
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane-lig…
AmintorDusko Mar 19, 2024
e8f65db
Merge branch 'lightning-qubit2-add-shots' into lightning-qubit-new-api
AmintorDusko Mar 19, 2024
4a2aaa2
Merge branch 'master' into lightning-qubit-new-api
AmintorDusko Mar 19, 2024
f91a1d8
comment isort check
AmintorDusko Mar 19, 2024
c52fd10
trigger ci
vincentmr Mar 19, 2024
4873022
Update tests/test_expval.py
vincentmr Mar 19, 2024
3481ef2
Init mcmc params to None in measurements.
vincentmr Mar 19, 2024
cad382a
Reformat with python3.11
vincentmr Mar 19, 2024
c175572
Reformat black
vincentmr Mar 19, 2024
ebeb417
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane-lig…
AmintorDusko Mar 19, 2024
0f83b9f
Merge branch 'lightning-qubit2-add-shots' of https://github.com/Penny…
AmintorDusko Mar 19, 2024
7731a75
Merge branch 'lightning-qubit2-add-shots' into lightning-qubit-new-api
AmintorDusko Mar 19, 2024
37e1e58
Merge branch 'master' into lightning-qubit-new-api
AmintorDusko Mar 19, 2024
16d019e
Auto update version
github-actions[bot] Mar 19, 2024
0c8ffc4
Merge branch 'lightning-qubit-new-api' of https://github.com/PennyLan…
AmintorDusko Mar 19, 2024
2cf45e9
update QuantumScriptSerializer
AmintorDusko Mar 19, 2024
f63d6af
remove LightningQubit2 from init
AmintorDusko Mar 19, 2024
080d037
update setup.py
AmintorDusko Mar 19, 2024
c5442a6
remove lightning.qubit2 from tests configuration
AmintorDusko Mar 19, 2024
83bf167
remove extra tests for lightning.qubit2
AmintorDusko Mar 19, 2024
3d831d0
migrate lightning.qubit2 to lightning.qubit on tests
AmintorDusko Mar 19, 2024
c30f94f
make lightning.qubit2 the new lightning.qubit
AmintorDusko Mar 19, 2024
d557b65
add device name (necessary for pl-device-test)
AmintorDusko Mar 19, 2024
472e0ff
Add _measure_hamiltonian_with_samples _measure_sum_with_samples
vincentmr Mar 19, 2024
f1b0a62
fix tests without binary
AmintorDusko Mar 19, 2024
80425ee
Merge branch 'lightning-qubit-new-api' of https://github.com/PennyLan…
AmintorDusko Mar 19, 2024
1803e39
check for jac size before reshaping
AmintorDusko Mar 19, 2024
a4c73ca
remove obsolete tests
AmintorDusko Mar 19, 2024
e359c30
organize tests
AmintorDusko Mar 19, 2024
739f0b4
fix test for Windows wheels
AmintorDusko Mar 19, 2024
3b5f937
fix the fix for LightningKokkos
AmintorDusko Mar 19, 2024
ed7e988
undo 'fix'
AmintorDusko Mar 20, 2024
e54133e
trigger CI
AmintorDusko Mar 20, 2024
8e01401
update changelog
AmintorDusko Mar 20, 2024
a462bda
Merge branch 'master' into lightning-qubit-new-api
AmintorDusko Mar 21, 2024
1a688f4
Auto update version
github-actions[bot] Mar 21, 2024
bfe2a5a
commenting tests for Win wheels
AmintorDusko Mar 21, 2024
a97ce84
Merge branch 'lightning-qubit-new-api' of https://github.com/PennyLan…
AmintorDusko Mar 21, 2024
a837657
trigger build wheels
AmintorDusko Mar 21, 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
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

### Breaking changes

* Migrate `lightning.qubit` to the new device API.
[(#646)](https://github.com/PennyLaneAI/pennylane-lightning/pull/646)

* Introduce `ci:build_wheels` label, which controls wheel building on `pull_request` and other triggers.
[(#648)](https://github.com/PennyLaneAI/pennylane-lightning/pull/648)

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ jobs:
cd main/
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS
PL_DEVICE=lightning_qubit2 python -m pytest tests/ $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
mv .coverage .coverage-${{ github.job }}-${{ matrix.pl_backend }}
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/tests_without_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ jobs:
cd main/
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS
if [ ${{ matrix.pl_backend }} == "lightning_qubit" ]; then PL_DEVICE=lightning_qubit2 python -m pytest tests/ $COVERAGE_FLAGS --cov-append; fi
pl-device-test --device ${DEVICENAME} --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/wheel_win_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ jobs:
CIBW_BEFORE_BUILD: |
python -m pip install pybind11 cmake~=3.24.0 build

CIBW_BEFORE_TEST: |
python -m pip install -r requirements-tests.txt
#Temporarily commenting while solving problems to find binaries in CIBW tests.
# CIBW_BEFORE_TEST: |
# python -m pip install -r requirements-tests.txt

CIBW_TEST_COMMAND: |
pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report
# CIBW_TEST_COMMAND: |
# pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report

CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014

Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(
self.use_csingle = use_csingle
self.device_name = device_name
self.split_obs = split_obs
if device_name in ("lightning.qubit", "lightning.qubit2"):
if device_name == "lightning.qubit":
try:
import pennylane_lightning.lightning_qubit_ops as lightning_ops
except ImportError as exception:
Expand Down
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-dev13"
__version__ = "0.36.0-dev14"
1 change: 0 additions & 1 deletion pennylane_lightning/lightning_qubit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
from pennylane_lightning.core import __version__

from .lightning_qubit import LightningQubit
from .lightning_qubit2 import LightningQubit2
2 changes: 1 addition & 1 deletion pennylane_lightning/lightning_qubit/_adjoint_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def calculate_jacobian(self, tape: QuantumTape):
trainable_params,
)
jac = np.array(jac)
jac = jac.reshape(-1, len(trainable_params))
jac = jac.reshape(-1, len(trainable_params)) if len(jac) else jac
jac_r = np.zeros((jac.shape[0], processed_data["all_params"]))
jac_r[:, processed_data["record_tp_rows"]] = jac

Expand Down
59 changes: 51 additions & 8 deletions pennylane_lightning/lightning_qubit/_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,21 @@ def measure_with_samples(
if isinstance(group[0], (ExpectationMP, VarianceMP)) and isinstance(
group[0].obs, SparseHamiltonian
):
raise TypeError("ExpectationMP(SparseHamiltonian) cannot be computed with samples.")
if isinstance(group[0], (ExpectationMP, VarianceMP)) and isinstance(
group[0].obs, Hamiltonian
):
raise TypeError("ExpectationMP(Hamiltonian) cannot be computed with samples.")
if isinstance(group[0], (ExpectationMP, VarianceMP)) and isinstance(group[0].obs, Sum):
raise TypeError("ExpectationMP(Sum) cannot be computed with samples.")
raise TypeError(
"ExpectationMP/VarianceMP(SparseHamiltonian) cannot be computed with samples."
)
if isinstance(group[0], VarianceMP) and isinstance(group[0].obs, (Hamiltonian, Sum)):
raise TypeError("VarianceMP(Hamiltonian/Sum) cannot be computed with samples.")
if isinstance(group[0], (ClassicalShadowMP, ShadowExpvalMP)):
raise TypeError(
"ExpectationMP(ClassicalShadowMP, ShadowExpvalMP) cannot be computed with samples."
)
all_res.extend(self._measure_with_samples_diagonalizing_gates(group, shots))
if isinstance(group[0], ExpectationMP) and isinstance(group[0].obs, Hamiltonian):
all_res.extend(self._measure_hamiltonian_with_samples(group, shots))
elif isinstance(group[0], ExpectationMP) and isinstance(group[0].obs, Sum):
all_res.extend(self._measure_sum_with_samples(group, shots))
else:
all_res.extend(self._measure_with_samples_diagonalizing_gates(group, shots))

# reorder results
flat_indices = []
Expand Down Expand Up @@ -438,3 +441,43 @@ def _process_single_shot(samples):
self._apply_diagonalizing_gates(mps, adjoint=True)

return _process_single_shot(samples)

def _measure_hamiltonian_with_samples(
self,
mp: List[SampleMeasurement],
shots: Shots,
):
# the list contains only one element based on how we group measurements
mp = mp[0]

# if the measurement process involves a Hamiltonian, measure each
# of the terms separately and sum
def _sum_for_single_shot(s):
results = self.measure_with_samples(
[ExpectationMP(t) for t in mp.obs.terms()[1]],
s,
)
return sum(c * res for c, res in zip(mp.obs.terms()[0], results))

unsqueezed_results = tuple(_sum_for_single_shot(type(shots)(s)) for s in shots)
return [unsqueezed_results] if shots.has_partitioned_shots else [unsqueezed_results[0]]

def _measure_sum_with_samples(
self,
mp: List[SampleMeasurement],
shots: Shots,
):
# the list contains only one element based on how we group measurements
mp = mp[0]

# if the measurement process involves a Sum, measure each
# of the terms separately and sum
def _sum_for_single_shot(s):
results = self.measure_with_samples(
[ExpectationMP(t) for t in mp.obs],
s,
)
return sum(results)

unsqueezed_results = tuple(_sum_for_single_shot(type(shots)(s)) for s in shots)
return [unsqueezed_results] if shots.has_partitioned_shots else [unsqueezed_results[0]]
Loading
Loading