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

Qutrits: Gell-Mann Observable #3035

Merged
merged 381 commits into from Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
381 commits
Select commit Hold shift + click to select a range
cbb3e6e
Updated dev changelog
mudit2812 Jun 24, 2022
d83a1d3
Merge branch 'qutrit_unitary' into qutrit_device1
mudit2812 Jun 24, 2022
be859d5
Updated changelog
mudit2812 Jun 24, 2022
4f11235
Merge branch 'qutrit_device1' into qutrit_device
mudit2812 Jun 24, 2022
702cf5c
Updated changelog
mudit2812 Jun 24, 2022
eb4ed93
Added observables.py for qutrits
mudit2812 Jun 24, 2022
1ef97a5
Reformatting
mudit2812 Jun 24, 2022
a2fca44
Reformatting tests
mudit2812 Jun 24, 2022
8abd7e4
Added change for pylint
mudit2812 Jun 24, 2022
bc7ac08
Merge branch 'qutrit_device' into qutrit_hermitian
mudit2812 Jun 24, 2022
4b78ab9
Adding tests for THermitian
mudit2812 Jun 24, 2022
dddd86e
Reformatted with black
mudit2812 Jun 24, 2022
4e2f1e7
Added Identity as an observable to default.qutrit
mudit2812 Jun 24, 2022
ee6b075
Minor change to conftest.py
mudit2812 Jun 24, 2022
a4e70be
Merge branch 'PennyLaneAI:master' into qutrit_device
mudit2812 Jun 24, 2022
815dbfc
Merge branch 'qutrit_device' of https://github.com/mudit2812/pennylan…
mudit2812 Jun 24, 2022
caa6812
Merge branch 'master' into qutrit_unitary
mudit2812 Jun 24, 2022
87c3731
Merge branch 'qutrit_unitary' of https://github.com/mudit2812/pennyla…
mudit2812 Jun 24, 2022
0a3b98a
Merge branch 'master' into qutrit_hermitian
mudit2812 Jun 24, 2022
a149917
Merge branch 'qutrit_hermitian' of https://github.com/mudit2812/penny…
mudit2812 Jun 24, 2022
9f1a5de
Merge branch 'master' into qutrit_unitary
mudit2812 Jun 24, 2022
5332fd8
Merge branch 'master' into qutrit_device1
mudit2812 Jun 24, 2022
102a049
Updated THermitian. All tests pass
mudit2812 Jun 27, 2022
fea2692
Merge branch 'master' into qutrit_unitary
glassnotes Jun 27, 2022
88144bf
Adding tests for expval and var
mudit2812 Jun 28, 2022
404a46c
Added comment with better description
mudit2812 Jun 28, 2022
06909f5
Added comments to address PR review
mudit2812 Jun 28, 2022
2e009a3
Update doc/releases/changelog-dev.md
mudit2812 Jun 28, 2022
aa434a0
Update pennylane/_qutrit_device.py
mudit2812 Jun 28, 2022
e2411d8
Update pennylane/_qutrit_device.py
mudit2812 Jun 28, 2022
9319eb8
Update pennylane/_qutrit_device.py
mudit2812 Jun 28, 2022
b78457b
Update tests/test_qutrit_device.py
mudit2812 Jun 28, 2022
50ce4a7
Update tests/test_qutrit_device.py
mudit2812 Jun 28, 2022
1fdc865
Merge branch 'qutrit_unitary' of https://github.com/mudit2812/pennyla…
mudit2812 Jun 28, 2022
15acdb2
Added tests for default.qutrit measurements
mudit2812 Jun 29, 2022
831d8e9
Added tests and comments
mudit2812 Jun 29, 2022
14a4869
Added TShift operation. Adding tests
mudit2812 Jun 29, 2022
7aef52a
Added test file for qutrit non-param ops
mudit2812 Jun 29, 2022
c814997
Added ternary clock operation
mudit2812 Jun 29, 2022
2cffcab
Removed pylint comments
mudit2812 Jun 29, 2022
ea6a377
Added pow method for shift
mudit2812 Jun 29, 2022
9fb5930
Merge branch 'qutrit_nops#1' into qutrit_nops#2
mudit2812 Jun 29, 2022
5bac8a1
Added TAdd, fixed comments
mudit2812 Jun 29, 2022
d27cdb5
Fixed docstrings
mudit2812 Jun 29, 2022
7616746
Merge branch 'qutrit_nops#1' into qutrit_nops#2
mudit2812 Jun 29, 2022
796252e
Fixed docstring for TShift
mudit2812 Jun 29, 2022
9cf7c41
Merge branch 'qutrit_nops#1' into qutrit_nops#2
mudit2812 Jun 29, 2022
b9fa1ec
Fixed docstrings for TClock and default_qutrit
mudit2812 Jun 29, 2022
1a30c40
Fixed docstring for _apply_tshift
mudit2812 Jun 29, 2022
b18fac6
Merge branch 'qutrit_nops#1' into qutrit_nops#2
mudit2812 Jun 29, 2022
03a03e9
Cleaning up
mudit2812 Jun 29, 2022
4a33a9f
Merge branch 'qutrit_nops#2' into qutrit_nops#3
mudit2812 Jun 29, 2022
a024688
Added _apply_tadd
mudit2812 Jun 29, 2022
35f85fd
Added TSWAP and _apply_tswap
mudit2812 Jun 29, 2022
c841982
Added tests for TShift
mudit2812 Jun 30, 2022
7e6df5f
Merge branch 'qutrit_nops#1' into qutrit_nops#2, added tests for TClock
mudit2812 Jun 30, 2022
8b13049
Merge branch 'qutrit_nops#2' into qutrit_nops#3
mudit2812 Jun 30, 2022
6b7b20c
Added tests for TAdd
mudit2812 Jun 30, 2022
e18031f
Merge branch 'qutrit_nops#3' into qutrit_nops#4
mudit2812 Jun 30, 2022
4cdbcdd
Added tests for TSWAP
mudit2812 Jun 30, 2022
7fd1efc
Added tests: non-param ops to test_default_qutrit
mudit2812 Jul 11, 2022
49f2e8c
Update doc/releases/changelog-dev.md
mudit2812 Jul 12, 2022
8a4abc6
Updated marginal probs documentation
mudit2812 Jul 12, 2022
5c02565
Merge branch 'qutrit_unitary' of https://github.com/mudit2812/pennyla…
mudit2812 Jul 12, 2022
17b7242
Merge branch 'qutrit_unitary' into qutrit_device1
mudit2812 Jul 12, 2022
de6632e
Merge branch 'qutrit_device1' of https://github.com/mudit2812/pennyla…
mudit2812 Jul 12, 2022
5b3e9c7
Minor changes
mudit2812 Jul 12, 2022
8ebf393
Fixed tests to contain code in correct context
mudit2812 Jul 12, 2022
d9fe276
Removed artefacts from other branch
mudit2812 Jul 12, 2022
1bdd9cd
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
mudit2812 Jul 13, 2022
d8988df
Merge branch 'PennyLaneAI-master' into qutrit_device1
mudit2812 Jul 13, 2022
af4ac6d
Minor change to changelog
mudit2812 Jul 14, 2022
910e57d
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
mudit2812 Jul 14, 2022
9e5cb48
Merge branch 'qutrit_merge_1' into qutrit_device1
mudit2812 Jul 14, 2022
a22c159
Merging
mudit2812 Jul 14, 2022
bdefd52
Merge branch 'master' into qutrit_device1
mudit2812 Jul 15, 2022
1de0b3c
Merge branch 'master' into qutrit_device1
mudit2812 Jul 18, 2022
98fba4b
Update tests/test_qutrit_device.py
mudit2812 Jul 18, 2022
e373297
Changes to address PR review
mudit2812 Jul 18, 2022
1c6ae82
Merge branch 'qutrit_unitary' into qutrit_device1
mudit2812 Jul 18, 2022
017a03a
Updating tests
mudit2812 Jul 18, 2022
195aa0e
Updated test_qutrit_device test_device_executions
mudit2812 Jul 18, 2022
882133e
Refactoring
mudit2812 Jul 19, 2022
36845d3
Fixed sampling with counts. Added tests
mudit2812 Jul 19, 2022
da3b305
Added test for coverage
mudit2812 Jul 19, 2022
736fea4
Update tests/test_qutrit_device.py
mudit2812 Jul 20, 2022
6916cd2
Merge branch 'qutrit_device1' into qutrit_device
mudit2812 Jul 20, 2022
0b2997a
Reformatted test_qutrit_device.py
mudit2812 Jul 20, 2022
6151522
Merge branch 'qutrit_device1' into qutrit_device
mudit2812 Jul 20, 2022
6d9d8c0
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
mudit2812 Jul 20, 2022
b7a4a43
Merge branch 'qutrit_device' into qutrit_hermitian
mudit2812 Jul 20, 2022
6759f15
Merge branch 'qutrit_hermitian' into qutrit_nops#1
mudit2812 Jul 20, 2022
846f868
Merge branch 'qutrit_nops#1' into qutrit_nops#2
mudit2812 Jul 20, 2022
7fabd4e
Merge branch 'qutrit_nops#2' into qutrit_nops#3
mudit2812 Jul 20, 2022
7e46ce3
Merge branch 'qutrit_nops#3' into qutrit_nops#4
mudit2812 Jul 20, 2022
5acaa76
Updated changelog
mudit2812 Jul 20, 2022
bc3e3c6
Merge branch 'qutrit_device' into qutrit_hermitian
mudit2812 Jul 20, 2022
722d178
Merge branch 'qutrit_hermitian' into qutrit_nops#1
mudit2812 Jul 20, 2022
453c514
Updated changelog
mudit2812 Jul 20, 2022
5a0ae97
Merge branch 'qutrit_nops#1' into qutrit_nops#2
mudit2812 Jul 20, 2022
dd0fa7d
Updated changelog
mudit2812 Jul 20, 2022
c773c7f
Merge branch 'qutrit_nops#2' into qutrit_nops#3
mudit2812 Jul 20, 2022
f58a577
Updated changelog
mudit2812 Jul 20, 2022
390f5e0
Merge branch 'qutrit_nops#3' into qutrit_nops#4
mudit2812 Jul 20, 2022
3cc6126
Updated code to remove unused import
mudit2812 Jul 20, 2022
7928ecc
Updated comments for TestSample
mudit2812 Jul 20, 2022
7394e10
Merge branch 'qutrit_device' into qutrit_hermitian
mudit2812 Jul 20, 2022
0efbc8f
Fixed merge issues with qutrit device tests
mudit2812 Jul 20, 2022
b533049
Merge branch 'qutrit_hermitian' into qutrit_nops#1
mudit2812 Jul 20, 2022
592e55e
Merge branch 'qutrit_nops#1' into qutrit_nops#2
mudit2812 Jul 20, 2022
139c7eb
Merge branch 'qutrit_nops#2' into qutrit_nops#3
mudit2812 Jul 20, 2022
a6f9486
Merge branch 'qutrit_nops#3' into qutrit_nops#4
mudit2812 Jul 20, 2022
c74b847
Added dependency to default_qutrit
mudit2812 Jul 21, 2022
b0702e5
Merge branch 'qutrit_nops#1' into qutrit_nops#2
mudit2812 Jul 21, 2022
d6b0009
Merge branch 'qutrit_nops#2' into qutrit_nops#3
mudit2812 Jul 21, 2022
f1ef6ef
Merge branch 'qutrit_nops#3' into qutrit_nops#4
mudit2812 Jul 21, 2022
bdf63a2
Added test for TAdd matrix
mudit2812 Aug 5, 2022
ed02d87
Merge branch 'qutrit_nops#3' into qutrit_nops#4
mudit2812 Aug 5, 2022
859c6fc
Added test matrix for TSWAP
mudit2812 Aug 5, 2022
6edd56a
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 9, 2022
510e1df
Merge branch 'qutrit_nops#2' into qutrit_nops#3
mudit2812 Aug 9, 2022
9a8d51a
Merge branch 'qutrit_nops#3' into qutrit_nops#4
mudit2812 Aug 9, 2022
cd18108
Reformatted
mudit2812 Aug 9, 2022
f05cc4d
Merge branch 'qutrit_nops#2' into qutrit_nops#3
mudit2812 Aug 9, 2022
9739307
Merge branch 'qutrit_nops#3' into qutrit_nops#4
mudit2812 Aug 9, 2022
d53cb3d
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 10, 2022
6b03b44
Update pennylane/devices/default_qutrit.py
mudit2812 Aug 11, 2022
a278a35
Update pennylane/ops/qutrit/observables.py
mudit2812 Aug 11, 2022
01556ef
Update tests/devices/test_default_qutrit.py
mudit2812 Aug 11, 2022
44f8b5a
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 11, 2022
8717524
Minor changes to tidy up PR
mudit2812 Aug 11, 2022
ee885dc
Reverted TClock eigenval change
mudit2812 Aug 11, 2022
27d7419
Update doc/releases/changelog-dev.md
mudit2812 Aug 12, 2022
f31cb7c
Update pennylane/devices/default_qutrit.py
mudit2812 Aug 12, 2022
dad05c6
Update pennylane/ops/qutrit/non_parametric_ops.py
mudit2812 Aug 12, 2022
7c56e0f
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 12, 2022
5c3cc44
Update pennylane/ops/qutrit/non_parametric_ops.py
mudit2812 Aug 12, 2022
1ffe503
Update tests/devices/test_default_qutrit.py
mudit2812 Aug 12, 2022
caca96f
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 12, 2022
65d957e
Updated expand_matrix() and added tests
mudit2812 Aug 15, 2022
3532b07
Merge branch 'qutrit_nops#2' of https://github.com/mudit2812/pennylan…
mudit2812 Aug 15, 2022
baaf622
Removed old comment
mudit2812 Aug 15, 2022
54807c7
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 15, 2022
ef68c91
Updated doc-string for TClock
mudit2812 Aug 15, 2022
330ece5
Merge branch 'qutrit_nops#2' of https://github.com/mudit2812/pennylan…
mudit2812 Aug 15, 2022
58fa92d
Updated doc string of TClock
mudit2812 Aug 15, 2022
5fcd570
Update pennylane/operation.py
mudit2812 Aug 15, 2022
037e0bb
Update changelog; edited comments in expand_matrix
mudit2812 Aug 15, 2022
0381c52
Merge branch 'qutrit_nops#2' of https://github.com/mudit2812/pennylan…
mudit2812 Aug 15, 2022
9ecb170
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 16, 2022
7dff65f
Merge branch 'qutrit_nops#2' into qutrit_nops#4
mudit2812 Aug 17, 2022
91b4feb
Updated TAdd docstring
mudit2812 Aug 17, 2022
760a412
Update doc/releases/changelog-dev.md
mudit2812 Aug 17, 2022
d65baae
Update doc/releases/changelog-dev.md
mudit2812 Aug 17, 2022
cfd553c
Update doc/releases/changelog-dev.md
mudit2812 Aug 17, 2022
412ffbf
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 17, 2022
5635be1
Added doc string reference to paper
mudit2812 Aug 17, 2022
553e80a
Updated default.qutrit observables list
mudit2812 Aug 18, 2022
6cd744a
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 18, 2022
88f2fa2
Merge branch 'qutrit_nops#2' of https://github.com/mudit2812/pennylan…
mudit2812 Aug 18, 2022
9e3a9e3
Merge branch 'qutrit_nops#2' into qutrit_nops#4
mudit2812 Aug 19, 2022
296e6b4
Merge branch 'qutrit_nops#2' into qutrit_nops#4
mudit2812 Aug 19, 2022
d3480e9
Update default.qutrit tests
mudit2812 Aug 19, 2022
320e43f
Added gell-mann observable
mudit2812 Jul 26, 2022
b7dbba2
Added tests for gell-mann observable
mudit2812 Jul 26, 2022
943a16d
Adding tests for tensor observables
mudit2812 Jul 27, 2022
43e6b04
Added tests for tensor variance
mudit2812 Jul 29, 2022
0e798b2
Added tests for tensor sample
mudit2812 Aug 1, 2022
19307e9
Adding tests for tensor observables
mudit2812 Jul 27, 2022
c5af1da
Adding tests for tensor observables
mudit2812 Jul 27, 2022
3c4d424
Adding tests for tensor observables
mudit2812 Jul 27, 2022
8343b37
Added tests for tensor sample
mudit2812 Aug 1, 2022
058cbcf
Updated tests
mudit2812 Aug 19, 2022
5aca506
Merge branch 'master' into qutrit_nops#2
mudit2812 Aug 19, 2022
cc0fa25
Removed expand_matrix changes
mudit2812 Aug 19, 2022
e483cdf
Merge branch 'master' into qutrit_nops#2
glassnotes Aug 19, 2022
71ef4d4
Update doc/releases/changelog-dev.md
mudit2812 Aug 19, 2022
bc41288
Added skeletons
mudit2812 Aug 19, 2022
7b2615c
Merge branch 'master' into qutrit_nops#4
mudit2812 Aug 19, 2022
e36f740
Linting
mudit2812 Aug 19, 2022
dfd4e79
Merge branch 'master' into qutrit_nops#4
glassnotes Aug 23, 2022
883d8e3
Merge branch 'master' into qutrit_nops#4
glassnotes Aug 24, 2022
6b371fe
Apply suggestions from code review
glassnotes Aug 24, 2022
0f0c523
Partition device apply ops test case.
glassnotes Aug 24, 2022
21ff728
Run black
glassnotes Aug 24, 2022
33e1448
Fix pylint
glassnotes Aug 24, 2022
675da77
Merge branch 'master' into qutrit_nops#4
glassnotes Aug 29, 2022
a2ff8a3
Update pennylane/devices/default_qutrit.py
glassnotes Aug 29, 2022
012ebb8
black and pylint
glassnotes Aug 29, 2022
30ffc35
Merge branch 'master' into qutrit_nops#4
glassnotes Sep 6, 2022
648024d
Update pennylane/devices/default_qutrit.py
mudit2812 Sep 7, 2022
5dfdb14
Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py
mudit2812 Sep 8, 2022
1c8e2bb
Updated test_default_qutrit.py
mudit2812 Sep 8, 2022
93e0cd7
Merge branch 'qutrit_nops#4' of https://github.com/mudit2812/pennylan…
mudit2812 Sep 8, 2022
7c16942
Updated _apply_tadd documentation
mudit2812 Sep 8, 2022
9ff997b
Merge branch 'master' into qutrit_nops#4
mudit2812 Sep 8, 2022
1a4f7dc
Merge branch 'qutrit_nops#4' into qutrit_gm
mudit2812 Sep 8, 2022
c89551c
Merge branch 'master' into qutrit_nops#4
glassnotes Sep 8, 2022
1624c7b
Added eigvals method for TSWAP
mudit2812 Sep 8, 2022
fc2e71b
Reverted TSWAP eigval changes
mudit2812 Sep 8, 2022
25d374c
Update tests/devices/test_default_qutrit.py
mudit2812 Sep 8, 2022
96ceb1d
Update pennylane/devices/default_qutrit.py
mudit2812 Sep 8, 2022
45a7227
Merge branch 'master' into qutrit_nops#4
mudit2812 Sep 8, 2022
5c4c34b
Added TSWAP eigvals
mudit2812 Sep 8, 2022
f6bf13b
Updated changelog-dev.md to include GellMannObs
mudit2812 Sep 8, 2022
4afc700
Removed empty file
mudit2812 Sep 8, 2022
9bb9412
Added linting comments
mudit2812 Sep 8, 2022
bf6159c
Updated tests to use gate_data
mudit2812 Sep 8, 2022
f516b83
Updated test parameter names to be more accurate
mudit2812 Sep 8, 2022
a6e9ae1
Remove unused file
mudit2812 Sep 8, 2022
bae5934
Updated GellMannObs doc-string
mudit2812 Sep 8, 2022
f411371
Merge branch 'master' into qutrit_gm
mudit2812 Sep 9, 2022
8d0f5e2
Merge branch 'qutrit_nops#4' into qutrit_gm
mudit2812 Sep 8, 2022
fa1db85
Merge branch 'master' into qutrit_gm
mudit2812 Sep 9, 2022
3a8cb6f
Merge branch 'qutrit_gm' of https://github.com/mudit2812/pennylane in…
mudit2812 Sep 8, 2022
78a07e1
Merge branch 'master' into qutrit_gm
mudit2812 Sep 9, 2022
80e5ea7
Merge branch 'master' into qutrit_gm
mudit2812 Sep 9, 2022
70f0bdb
Update changelog-dev.md
mudit2812 Sep 9, 2022
a80cbcb
Update tests/devices/test_default_qutrit.py
mudit2812 Sep 13, 2022
84f18e7
Update tests/devices/test_default_qutrit.py
mudit2812 Sep 13, 2022
86875fc
Update tests/devices/test_default_qutrit.py
mudit2812 Sep 13, 2022
1b0a46f
Update pennylane/ops/qutrit/observables.py
mudit2812 Sep 13, 2022
229b78a
Merge branch 'master' into qutrit_gm
mudit2812 Sep 13, 2022
d8f3542
Added changes to GellMann to address PR comments
mudit2812 Sep 13, 2022
eaa70b0
Updated test
mudit2812 Sep 13, 2022
08087be
Reformatting
mudit2812 Sep 13, 2022
e140dca
Trying out changes to Gell-Mann docstring
mudit2812 Sep 13, 2022
0dfd2d2
Updated Changelog
mudit2812 Sep 13, 2022
419eb9e
Update pennylane/ops/qutrit/observables.py
mudit2812 Sep 13, 2022
8e89143
Testing LaTeX align
mudit2812 Sep 13, 2022
86ebaa7
Merge branch 'qutrit_gm' of https://github.com/mudit2812/pennylane in…
mudit2812 Sep 13, 2022
0bdfe91
Added non-diag tests
mudit2812 Sep 13, 2022
fa22080
Added diag, complex case for tensor sample
mudit2812 Sep 13, 2022
1fec3e1
Added example to doc string
mudit2812 Sep 13, 2022
aff0eea
Fixed label test
mudit2812 Sep 13, 2022
d5315b5
Merge branch 'master' into qutrit_gm
glassnotes Sep 14, 2022
93d0452
Update pennylane/ops/qutrit/observables.py
mudit2812 Sep 15, 2022
c769aad
Update pennylane/ops/qutrit/observables.py
mudit2812 Sep 15, 2022
3c58377
Update tests/devices/test_default_qutrit.py
mudit2812 Sep 15, 2022
c104fb6
Update tests/devices/test_default_qutrit.py
mudit2812 Sep 15, 2022
26cad8f
Merge branch 'master' into qutrit_gm
mudit2812 Sep 16, 2022
18789f6
Merge branch 'master' into qutrit_gm
mudit2812 Sep 16, 2022
1899553
Merge branch 'master' into qutrit_gm
Jaybsoni Sep 19, 2022
e3e1cc3
Merge branch 'master' into qutrit_gm
Jaybsoni Sep 20, 2022
35ef806
Merge branch 'master' into qutrit_gm
glassnotes Sep 21, 2022
ff3960e
Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py
mudit2812 Sep 21, 2022
0a75bc7
Update pennylane/ops/qutrit/observables.py
mudit2812 Sep 21, 2022
1faf8b4
Update pennylane/ops/qutrit/observables.py
mudit2812 Sep 21, 2022
b5350e6
Merge branch 'master' into qutrit_gm
glassnotes Sep 21, 2022
4427240
Add GellMann observable to list in the docs
glassnotes Sep 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/releases/changelog-dev.md
Expand Up @@ -4,6 +4,10 @@

<h3>New features since last release</h3>

* Added the `qml.GellMann` qutrit observable, which is the ternary generalization of the Pauli observables. Users must include an index as a
keyword argument when using `GellMann`, which determines which of the 8 Gell-Mann matrices is used as the observable.
([#3035](https://github.com/PennyLaneAI/pennylane/pull/3035))

<h3>Improvements</h3>

<h3>Breaking changes</h3>
Expand All @@ -17,3 +21,5 @@
<h3>Contributors</h3>

This release contains contributions from (in alphabetical order):

Mudit Pandey
3 changes: 2 additions & 1 deletion pennylane/devices/default_qutrit.py
Expand Up @@ -64,8 +64,9 @@ class DefaultQutrit(QutritDevice):
# Identity is supported as an observable for qml.state() to work correctly. However, any
# measurement types that rely on eigenvalue decomposition will not work with qml.Identity
observables = {
"Identity",
"THermitian",
"GellMann",
"Identity",
}

def __init__(
Expand Down
1 change: 1 addition & 0 deletions pennylane/ops/qutrit/__init__.py
Expand Up @@ -37,6 +37,7 @@

obs = {
"THermitian",
"GellMann",
}

__all__ = list(ops | obs)
216 changes: 215 additions & 1 deletion pennylane/ops/qutrit/observables.py
Expand Up @@ -14,13 +14,29 @@
"""
This submodule contains the qutrit quantum observables.
"""
from pennylane import numpy as np
import numpy as np
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved
Jaybsoni marked this conversation as resolved.
Show resolved Hide resolved

import pennylane as qml # pylint: disable=unused-import
from pennylane.operation import Observable
from pennylane.ops.qubit import Hermitian
from pennylane.ops.qutrit import QutritUnitary


# Array containing all 8 Gell-Mann matrices. This order is chosen for the Gell-Mann
# matrices as they loosely follow the X-Y-Z structure of the Pauli matrices. The
# matrices analogous to Pauli X, Y, and Z are at indices (0, 3, 5), (1, 4, 6), and
# (2, 7) respectively.
gm_mats = np.zeros((8, 3, 3), dtype=np.complex128)
gm_mats[0] = np.array([[0, 1, 0], [1, 0, 0], [0, 0, 0]])
gm_mats[1] = np.array([[0, -1j, 0], [1j, 0, 0], [0, 0, 0]])
gm_mats[2] = np.diag([1, -1, 0])
gm_mats[3] = np.array([[0, 0, 1], [0, 0, 0], [1, 0, 0]])
gm_mats[4] = np.array([[0, 0, -1j], [0, 0, 0], [1j, 0, 0]])
gm_mats[5] = np.array([[0, 0, 0], [0, 0, 1], [0, 1, 0]])
gm_mats[6] = np.array([[0, 0, 0], [0, 0, -1j], [0, 1j, 0]])
gm_mats[7] = np.diag([1, 1, -2]) / np.sqrt(3)
Jaybsoni marked this conversation as resolved.
Show resolved Hide resolved


class THermitian(Hermitian):
r"""An arbitrary Hermitian observable for qutrits.

Expand Down Expand Up @@ -133,3 +149,201 @@ def compute_diagonalizing_gates(eigenvectors, wires): # pylint: disable=argumen

"""
return [QutritUnitary(eigenvectors.conj().T, wires=wires)]


class GellMann(Observable):
r"""
The Gell-Mann observables for qutrits

The Gell-Mann matrices are a set of 8 linearly independent :math:`3 \times 3` traceless, Hermitian matrices which
naturally generalize the Pauli matrices from :math:`SU(2)` to :math:`SU(3)`.

.. math::
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved
\displaystyle \begin{align} \lambda_{1} &= \left(\begin{array}{ccc} 0 & 1 & 0 \\ 1 & 0 & 0\\ 0 & 0 & 0\end{array}\right) \;\;\;\;\;\;\;\;\;\;
\lambda_{2} = \left(\begin{array}{ccc} 0 & -i & 0 \\ i & 0 & 0\\ 0 & 0 & 0\end{array}\right)\;\;\;\;\;\;\;\;\;\;
\lambda_{3} = \left(\begin{array}{ccc} 1 & 0 & 0 \\ 0 & -1 & 0\\ 0 & 0 & 0\end{array}\right) \\
\lambda_{4} &= \left(\begin{array}{ccc} 0 & 0 & 1 \\ 0 & 0 & 0\\ 1 & 0 & 0\end{array}\right)\;\;\;\;\;\;\;\;\;\;
\lambda_{5} = \left(\begin{array}{ccc} 0 & 0 & -i \\ 0 & 0 & 0\\ i & 0 & 0\end{array}\right) \\
\lambda_{6} &= \left(\begin{array}{ccc} 0 & 0 & 0 \\ 0 & 0 & 1\\ 0 & 1 & 0\end{array}\right)\;\;\;\;\;\;\;\;\;\;
\lambda_{7} = \left(\begin{array}{ccc} 0 & 0 & 0 \\ 0 & 0 & -i\\ 0 & i & 0\end{array}\right)\;\;\;\;\;\;\;\;\;\;
\lambda_{8} = \frac{1}{\sqrt{3}}\left(\begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0\\ 0 & 0 & -2\end{array}\right)\\ \end{align}

**Details:**

* Number of wires: 1
* Number of parameters: 0
* Gradient recipe: None

Args:
wires (Sequence[int] or int): the wire(s) the observable acts on
index (int): The index of the Gell-Mann matrix to be used. Must be between 1
and 8 inclusive
do_queue (bool): Indicates whether the operator should be
immediately pushed into the Operator queue (optional)
id (str or None): String representing the operation (optional)
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved

**Example:**

>>> dev = qml.device("default.qutrit", wires=2)
>>> @qml.qnode(dev)
... def test_qnode():
... qml.TShift(wires=0)
... qml.TClock(wires=0)
... qml.TShift(wires=1)
... qml.TAdd(wires=[0, 1])
... return qml.expval(qml.GellMann(wires=0, index=1))
>>> print(test_qnode())
0.0
>>> print(qml.draw(test_qnode)())
0: ──TShift──TClock─╭●────┤ <GellMann(1)>
1: ──TShift─────────╰TAdd─┤
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved

"""
num_wires = 1
num_params = 0
"""int: Number of trainable parameters the operator depends on"""

def __init__(self, wires, index=1, do_queue=True, id=None):
if not isinstance(index, int) or index < 1 or index > 8:
raise ValueError(
"The index of a Gell-Mann observable must be an integer between 1 and 8 inclusive."
)

self._hyperparameters = {
"index": index,
}
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved

super().__init__(wires=wires, do_queue=do_queue, id=id)

def label(self, decimals=None, base_label=None, cache=None):
return base_label or "GellMann(" + str(self._hyperparameters["index"]) + ")"
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved

_eigvecs = {
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved
1: np.array(
[[1 / np.sqrt(2), -1 / np.sqrt(2), 0], [1 / np.sqrt(2), 1 / np.sqrt(2), 0], [0, 0, 1]],
dtype=np.complex128,
),
2: np.array(
[
[-1 / np.sqrt(2), -1 / np.sqrt(2), 0],
[-1j / np.sqrt(2), 1j / np.sqrt(2), 0],
[0, 0, 1],
],
dtype=np.complex128,
),
4: np.array(
[[1 / np.sqrt(2), 1 / np.sqrt(2), 0], [0, 0, 1], [1 / np.sqrt(2), -1 / np.sqrt(2), 0]],
dtype=np.complex128,
),
5: np.array(
[
[1j / np.sqrt(2), 1j / np.sqrt(2), 0],
[0, 0, 1],
[-1 / np.sqrt(2), 1 / np.sqrt(2), 0],
],
dtype=np.complex128,
),
6: np.array(
[[0, 0, 1], [1 / np.sqrt(2), -1 / np.sqrt(2), 0], [1 / np.sqrt(2), 1 / np.sqrt(2), 0]],
dtype=np.complex128,
),
7: np.array(
[
[0, 0, 1],
[-1 / np.sqrt(2), -1 / np.sqrt(2), 0],
[-1j / np.sqrt(2), 1j / np.sqrt(2), 0],
],
dtype=np.complex128,
),
}

@staticmethod
def compute_matrix(index): # pylint: disable=arguments-differ
r"""Representation of the operator as a canonical matrix in the computational basis (static method).

The canonical matrix is the textbook matrix representation that does not consider wires.
Implicitly, this assumes that the wires of the operator correspond to the global wire order.

.. seealso:: :meth:`~.GellMann.matrix`

Args:
index (int): The index of the Gell-Mann matrix to be used. Must be between 1
and 8 inclusive

Returns:
tensor_like: canonical matrix

**Example**

>>> qml.GellMann.compute_matrix(8)
array([[ 0.57735027+0.j, 0. +0.j, 0. +0.j],
[ 0. +0.j, 0.57735027+0.j, 0. +0.j],
[ 0. +0.j, 0. +0.j, -1.15470054+0.j]])
"""
return gm_mats[index - 1]

@staticmethod
def compute_eigvals(index): # pylint: disable=arguments-differ
r"""Eigenvalues of the operator in the computational basis (static method).

If :attr:`diagonalizing_gates` are specified and implement a unitary :math:`U`,
the operator can be reconstructed as

.. math:: O = U \Sigma U^{\dagger},

where :math:`\Sigma` is the diagonal matrix containing the eigenvalues.

Otherwise, no particular order for the eigenvalues is guaranteed.

.. seealso:: :meth:`~.GellMann.eigvals`

Args:
index (int): The index of the Gell-Mann matrix to be used. Must be between 1
and 8 inclusive

Returns:
array: eigenvalues

**Example**

>>> qml.GellMann.compute_eigvals(1)
[1. -1. 0.]
"""
if index != 8:
return np.array([1, -1, 0])

return np.array([1, 1, -2]) / np.sqrt(3)

@staticmethod
def compute_diagonalizing_gates(
wires, index
): # pylint: disable=arguments-differ,unused-argument
r"""Sequence of gates that diagonalize the operator in the computational basis (static method).

Given the eigendecomposition :math:`O = U \Sigma U^{\dagger}` where
:math:`\Sigma` is a diagonal matrix containing the eigenvalues,
the sequence of diagonalizing gates implements the unitary :math:`U`.

The diagonalizing gates rotate the state into the eigenbasis
of the operator.

.. seealso:: :meth:`~.GellMann.diagonalizing_gates`.

Args:
index (int): The index of the Gell-Mann matrix to be used. Must be between 1 and 8 inclusive
wires (Iterable[Any], Wires): wires that the operator acts on
Returns:
list[.Operator]: list of diagonalizing gates

**Example**

>>> qml.GellMann.compute_diagonalizing_gates(wires=0, index=4)
[QutritUnitary(array([[ 0.70710678-0.j, 0. -0.j, 0.70710678-0.j],
[ 0.70710678-0.j, 0. -0.j, -0.70710678-0.j],
[ 0. -0.j, 1. -0.j, 0. -0.j]]), wires=[0])]
"""
if index in {3, 8}:
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved
return []
mudit2812 marked this conversation as resolved.
Show resolved Hide resolved

v = GellMann._eigvecs[index]
return [QutritUnitary(v.conj().T, wires=wires)]