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

[DLA 4] qml.dla.center function #5477

Merged
merged 366 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
366 commits
Select commit Hold shift + click to select a range
cfe8850
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Mar 4, 2024
3edc87a
tol test
Qottmann Mar 4, 2024
f645da6
Merge branch 'master' into lieclosure
Qottmann Mar 5, 2024
0f6d4fe
Merge branch 'master' into lieclosure
Qottmann Mar 6, 2024
0eba2bf
merge
Qottmann Mar 6, 2024
4838660
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Mar 6, 2024
7b96605
add test for coverage
Qottmann Mar 6, 2024
1581a5d
black formatting
Qottmann Mar 6, 2024
1485118
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Mar 6, 2024
abb3595
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Mar 8, 2024
6bb9e17
code review suggestions
Qottmann Mar 8, 2024
0ad5840
black formatting
Qottmann Mar 8, 2024
9d2b19a
code review
Qottmann Mar 8, 2024
eff142d
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Mar 8, 2024
44204ba
remove re-defined pauli_rep property
Qottmann Mar 12, 2024
b5e40cd
Update pennylane/dla/lie_closure.py
Qottmann Mar 13, 2024
bdbfd6d
black formatting
Qottmann Mar 13, 2024
b8d23b7
[ci skip]
Qottmann Mar 13, 2024
6dc2e4b
black formatting
Qottmann Mar 13, 2024
a7c9bd9
Apply suggestions from code review
Qottmann Mar 19, 2024
056e750
Merge branch 'master' into lieclosure
Qottmann Mar 19, 2024
be3fe44
merge and add example to doc string
Qottmann Mar 19, 2024
b0b6b2e
black formatting
Qottmann Mar 19, 2024
6acb926
adjoint representation
Qottmann Mar 19, 2024
4f9b086
black formatting
Qottmann Mar 19, 2024
f3cdb7a
add files
Qottmann Mar 19, 2024
e3fa1f5
PauliSentence.trace() method
Qottmann Mar 19, 2024
def9943
black formatting
Qottmann Mar 19, 2024
109415c
PauliWord.trace() function pointless
Qottmann Mar 19, 2024
b21006f
Merge branch 'master' into lieclosure
Qottmann Mar 22, 2024
84a59ef
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Mar 28, 2024
304fd49
changelog
Qottmann Mar 28, 2024
8131cf7
code review
Qottmann Mar 28, 2024
0aefa9c
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Mar 28, 2024
aef155a
allow operators
Qottmann Mar 28, 2024
429b72d
black formatting
Qottmann Mar 28, 2024
af2651b
changelog
Qottmann Mar 28, 2024
b335e2b
pauli mode
Qottmann Mar 28, 2024
c70ea95
black formatting
Qottmann Mar 28, 2024
b76bd44
changelog order
Qottmann Mar 28, 2024
87155c2
verbose output for codecov
Qottmann Mar 28, 2024
ba7d0a8
black formatting
Qottmann Mar 28, 2024
983266f
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Mar 28, 2024
bfbbf25
pylint
Qottmann Mar 28, 2024
41020a5
black formatting
Qottmann Mar 28, 2024
38786eb
verbose and max_iterations
Qottmann Mar 28, 2024
6150324
black formatting
Qottmann Mar 28, 2024
721a229
_M dtype back to float
Qottmann Apr 2, 2024
6b2f125
black formatting
Qottmann Apr 2, 2024
ffc6ffe
black formatting
Qottmann Apr 2, 2024
4f3a3ba
bug fix in __eq__ when permutation of pw_to_idx is different
Qottmann Apr 2, 2024
c58d3ee
black formatting
Qottmann Apr 2, 2024
53299d9
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 2, 2024
7b93e36
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 2, 2024
6c4d49b
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 2, 2024
bc0bdad
Apply suggestions from code review
Qottmann Apr 2, 2024
a3fad7b
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 2, 2024
8ca8e00
[ci skip]
Qottmann Apr 2, 2024
f997c3e
remove normalization assumption
Qottmann Apr 2, 2024
9ec4b3c
[ci skip]
Qottmann Apr 2, 2024
8645fda
found bug in PauliSentence.__matmul__
Qottmann Apr 2, 2024
4f2ec43
normalization = solved
Qottmann Apr 2, 2024
f35a6db
black formatting
Qottmann Apr 2, 2024
f114ae4
black formatting
Qottmann Apr 2, 2024
b3919ab
black formatting
Qottmann Apr 2, 2024
bd14bcb
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 3, 2024
b82776e
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 3, 2024
fd971e8
code review
Qottmann Apr 3, 2024
9dcefa5
Apply suggestions from code review
Qottmann Apr 3, 2024
472156a
merge
Qottmann Apr 3, 2024
6926e4f
docstring
Qottmann Apr 3, 2024
28717f2
docstring
Qottmann Apr 3, 2024
10a2408
sphinx
Qottmann Apr 3, 2024
8a4432e
sphinx
Qottmann Apr 3, 2024
5481209
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 3, 2024
ceb5748
code review
Qottmann Apr 3, 2024
241e202
Apply suggestions from code review
Qottmann Apr 3, 2024
d8334e7
minus sign
Qottmann Apr 3, 2024
6ecc7ea
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 3, 2024
3556fdf
black formatting
Qottmann Apr 3, 2024
3735b83
doc
Qottmann Apr 3, 2024
0c2b25e
changelog
Qottmann Apr 3, 2024
98f0718
clean up docstring
Qottmann Apr 3, 2024
b3a5db9
toctree
Qottmann Apr 3, 2024
95ec647
merge changelog
Qottmann Apr 3, 2024
b4fa8ba
headlines
Qottmann Apr 3, 2024
0621a0f
pylint disable
Qottmann Apr 3, 2024
338f294
empty pauli word re-use
Qottmann Apr 3, 2024
0db8031
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 3, 2024
23b9790
black formatting
Qottmann Apr 3, 2024
366cab5
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 4, 2024
96d5bdd
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 4, 2024
5be1bf7
add to index.rst
Qottmann Apr 4, 2024
6e54f4c
[ci skip]
Qottmann Apr 4, 2024
c73967f
trigger
Qottmann Apr 4, 2024
668c435
sphinx
Qottmann Apr 4, 2024
f4fc3dd
demo link
Qottmann Apr 4, 2024
bbc21c3
sphinx
Qottmann Apr 4, 2024
6845589
typo
Qottmann Apr 4, 2024
32e20f3
make static link
Qottmann Apr 4, 2024
6ac7857
linking format
Qottmann Apr 4, 2024
1bc212a
merge
Qottmann Apr 4, 2024
94bf765
unused import
Qottmann Apr 4, 2024
c9d7503
identation?
Qottmann Apr 4, 2024
dad5e9b
example simpler format
Qottmann Apr 4, 2024
ea65b95
docs
Qottmann Apr 5, 2024
5fb3922
docs fine tuning
Qottmann Apr 5, 2024
1753641
rename function to structure_constants
Qottmann Apr 5, 2024
705e589
rename files
Qottmann Apr 5, 2024
0477cbe
basic center function
Qottmann Apr 5, 2024
02c8371
black formatting
Qottmann Apr 5, 2024
86d8df6
center tests
Qottmann Apr 5, 2024
504699c
black formatting
Qottmann Apr 5, 2024
a178176
test coverage
Qottmann Apr 5, 2024
d7bea47
black formatting
Qottmann Apr 5, 2024
6e11d06
rename files
Qottmann Apr 5, 2024
018e661
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 5, 2024
5f65572
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 5, 2024
ba72e40
merge
Qottmann Apr 5, 2024
0ae6308
[ci skip]
Qottmann Apr 5, 2024
5ad3a2c
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 5, 2024
152850a
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 5, 2024
21a3568
docs and changelog
Qottmann Apr 5, 2024
0ef5bdf
black formatting
Qottmann Apr 5, 2024
0628a69
pylint
Qottmann Apr 5, 2024
c637576
code review: docs display
Qottmann Apr 5, 2024
403a7d2
code review
Qottmann Apr 5, 2024
9b12140
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 5, 2024
9ef8ba7
code review
Qottmann Apr 5, 2024
72f399b
tests rearranged
Qottmann Apr 5, 2024
111bf91
tests rearranged
Qottmann Apr 5, 2024
bfa3b8e
black formatting
Qottmann Apr 5, 2024
ad99648
Apply suggestions from code review
Qottmann Apr 5, 2024
1d766aa
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 8, 2024
52886be
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 8, 2024
b6e8af4
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 8, 2024
180811c
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 8, 2024
0b8d4aa
link in docs
Qottmann Apr 8, 2024
57429c2
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 8, 2024
fd5a83c
return type
Qottmann Apr 8, 2024
399a723
typing and pauli keyword
Qottmann Apr 8, 2024
b3630aa
black formatting
Qottmann Apr 8, 2024
fe4fd23
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 8, 2024
f2412b3
typing, docs
Qottmann Apr 8, 2024
f309be7
black formatting
Qottmann Apr 8, 2024
687f7aa
Update tests/dla/test_center.py
Qottmann Apr 8, 2024
689490b
Update tests/dla/test_center.py
Qottmann Apr 10, 2024
5e1497f
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 12, 2024
1123fd2
code review: add correct error for pauli=True and wrong input types
Qottmann Apr 15, 2024
ea8e606
black formatting
Qottmann Apr 15, 2024
d3907b5
code review: shorten sentence
Qottmann Apr 15, 2024
531da00
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 15, 2024
b5ac2aa
merge
Qottmann Apr 15, 2024
9afaf1a
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 15, 2024
5f687cb
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 15, 2024
8d100f4
Merge branch 'liecenter' of https://github.com/PennyLaneAI/pennylane …
Qottmann Apr 15, 2024
35f65fa
pylint
Qottmann Apr 15, 2024
10f9037
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 15, 2024
b24969e
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 15, 2024
66f7f3e
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 16, 2024
db24ae9
refactor to ops/opmath
Qottmann Apr 16, 2024
e226615
add new files
Qottmann Apr 16, 2024
4dcf71e
black formatting
Qottmann Apr 16, 2024
f89612d
refactor to pauli module
Qottmann Apr 17, 2024
bb06cbc
merge
Qottmann Apr 17, 2024
4f17b8b
fix tests
Qottmann Apr 17, 2024
4a92bb4
black formatting
Qottmann Apr 17, 2024
c37f42a
refactor docs page
Qottmann Apr 17, 2024
eebed89
merge
Qottmann Apr 17, 2024
de91dcc
refactor
Qottmann Apr 17, 2024
889364d
docstring refactor
Qottmann Apr 17, 2024
ad00317
refactor
Qottmann Apr 17, 2024
b33c24b
black formatting
Qottmann Apr 17, 2024
bb413aa
remove from opmath toctree
Qottmann Apr 17, 2024
9f0c516
explicit list of ops in module description
Qottmann Apr 17, 2024
9cf1ac4
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 17, 2024
55456df
remove from opmath toctree
Qottmann Apr 17, 2024
37a3501
remove linebreak
Qottmann Apr 17, 2024
92c9ad1
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 17, 2024
81f401c
cosmetic
Qottmann Apr 17, 2024
21404c0
cosmetic docs updates
Qottmann Apr 17, 2024
5fcc22f
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 17, 2024
df12cd7
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 17, 2024
4a73227
add to toc
Qottmann Apr 17, 2024
9b8abca
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 17, 2024
addc325
add center to toc
Qottmann Apr 17, 2024
3e5e18d
top level import
Qottmann Apr 17, 2024
a6df873
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 17, 2024
93ca8f5
top level import
Qottmann Apr 17, 2024
a05cda2
black formatting
Qottmann Apr 17, 2024
0a0527e
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 17, 2024
0ac7f2e
top level import
Qottmann Apr 17, 2024
1484efd
cross-referencing
Qottmann Apr 17, 2024
db5662d
black formatting
Qottmann Apr 17, 2024
22abeff
see-also -> seealso
Qottmann Apr 17, 2024
f00cec7
specify cross reference
Qottmann Apr 17, 2024
c8923fd
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 18, 2024
0e94c9a
code review: rephrase Args description to avoid confusion
Qottmann Apr 18, 2024
dc157e1
allow ops as inputs
Qottmann Apr 18, 2024
6a704cd
black formatting
Qottmann Apr 18, 2024
379d5fa
Apply suggestions from code review
Qottmann Apr 18, 2024
c863e5e
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 18, 2024
766d6fd
merge
Qottmann Apr 18, 2024
1f4f250
allow PauliWord instances as input when pauli=True
Qottmann Apr 18, 2024
6d0e5a5
verbosity set to bool instead of integer levels
Qottmann Apr 18, 2024
00e6dcc
Update doc/code/qml_pauli.rst
Qottmann Apr 18, 2024
e7f3097
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 18, 2024
71502c4
small costmetics
Qottmann Apr 18, 2024
d92a31d
code review: use operators in doc string
Qottmann Apr 18, 2024
f748977
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 18, 2024
9f97fc4
code review: changelog
Qottmann Apr 18, 2024
ae8dc9e
make index orderin more explicit
Qottmann Apr 18, 2024
2dfbf94
cosmetic changes to docs
Qottmann Apr 18, 2024
6dbb349
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 18, 2024
524d457
update module context
Qottmann Apr 18, 2024
8fa1aee
module context
Qottmann Apr 18, 2024
737f9c5
also link PauliVSpace
Qottmann Apr 18, 2024
169f2e0
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 18, 2024
b33178f
add dtype option
Qottmann Apr 19, 2024
5da7b90
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 19, 2024
29d21b5
add dtype test
Qottmann Apr 19, 2024
0331b90
black formatting
Qottmann Apr 19, 2024
371387b
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 19, 2024
cd6ed0d
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 19, 2024
8f4af2e
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 19, 2024
4747cab
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 22, 2024
d04af94
Merge branch 'lieclosure' of https://github.com/PennyLaneAI/pennylane…
Qottmann Apr 22, 2024
3a4e171
code review suggestions
Qottmann Apr 22, 2024
ae37f93
Apply suggestions from code review
Qottmann Apr 22, 2024
95d190a
Merge branch 'lieclosure2' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 22, 2024
b996e95
Apply suggestions from code review
Qottmann Apr 22, 2024
67bc40f
code review
Qottmann Apr 22, 2024
ece074a
Merge branch 'adjointrepr' of https://github.com/PennyLaneAI/pennylan…
Qottmann Apr 22, 2024
70537cf
trigger
Qottmann Apr 22, 2024
75277ba
merge
Qottmann Apr 23, 2024
f89d251
merge
Qottmann Apr 23, 2024
d948507
merge
Qottmann Apr 23, 2024
27ed468
merge
Qottmann Apr 23, 2024
414d267
merge
Qottmann Apr 23, 2024
5f98629
merge
Qottmann Apr 23, 2024
a3bb7b6
merge
Qottmann Apr 23, 2024
d12ccbb
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
Qottmann Apr 24, 2024
ee7d3b7
fix links and refer to top level functions in docs
Qottmann Apr 24, 2024
3944b08
changelog
Qottmann Apr 24, 2024
e2b1e1a
move center section in changelog to DLA section
Qottmann Apr 24, 2024
26cd7df
PauliWord also valid input, in particular when pauli=True
Qottmann Apr 24, 2024
310f7e6
add test for PauliWord inputs to ensure they are actually valid input…
Qottmann Apr 24, 2024
43133c3
black formatting
Qottmann Apr 24, 2024
dbbc8a0
Merge branch 'master' into liecenter
Qottmann Apr 24, 2024
2a17121
Merge branch 'master' into liecenter
Qottmann Apr 25, 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
13 changes: 13 additions & 0 deletions doc/code/qml_dla.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
qml.dla
=======

(Dynamical) Lie Algebra functionality in PennyLane

See our `introduction to Dynamical Lie Algebras for quantum practitioners <https://pennylane.ai/qml/demos/tutorial_liealgebra/>`__.

.. currentmodule:: pennylane.dla

.. automodapi:: pennylane.dla
:no-heading:
:no-main-docstr:
:no-inherited-members:
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ PennyLane is **free** and **open source**, released under the Apache License, Ve
code/qml
code/qml_compiler
code/qml_data
code/qml_dla
code/qml_drawer
code/qml_fermi
code/qml_fourier
Expand Down
76 changes: 68 additions & 8 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,74 @@
* Added new function `qml.operation.convert_to_legacy_H` to convert `Sum`, `SProd`, and `Prod` to `Hamiltonian` instances.
[(#5309)](https://github.com/PennyLaneAI/pennylane/pull/5309)

<h4>Dynamical Lie Algebra functionality</h4>

* A new `qml.dla.lie_closure` function to compute the Lie closure of a list of operators.
[(#5161)](https://github.com/PennyLaneAI/pennylane/pull/5161)
[(#5169)](https://github.com/PennyLaneAI/pennylane/pull/5169)

The Lie closure, pronounced "Lee closure", is a way to compute the so-called dynamical Lie algebra (DLA) of a set of operators.
For a list of operators `ops = [op1, op2, op3, ..]`, one computes all nested commutators between `ops` until no new operators are generated from commutation.
All these operators together form the DLA, see e.g. section IIB of [arXiv:2308.01432](https://arxiv.org/abs/2308.01432).

Take for example the following ops

```python
ops = [X(0) @ X(1), Z(0), Z(1)]
```

A first round of commutators between all elements yields the new operators `Y(0) @ X(1)` and `X(0) @ Y(1)` (omitting scalar prefactors).

```python
>>> qml.commutator(X(0) @ X(1), Z(0))
-2j * (X(1) @ Y(0))
>>> qml.commutator(X(0) @ X(1), Z(1))
-2j * (Y(1) @ X(0))
```

A next round of commutators between all elements further yields the new operator `Y(0) @ Y(1)`.

```python
>>> qml.commutator(X(0) @ Y(1), Z(0))
-2j * (Y(1) @ Y(0))
```

After that, no new operators emerge from taking nested commutators and we have the resulting DLA.
This can now be done in short via `qml.dla.lie_closure` as follows.

```python
>>> ops = [X(0) @ X(1), Z(0), Z(1)]
>>> dla = qml.dla.lie_closure(ops)
>>> print(dla)
[1.0 * X(1) @ X(0),
1.0 * Z(0),
1.0 * Z(1),
-1.0 * X(1) @ Y(0),
-1.0 * Y(1) @ X(0),
-1.0 * Y(1) @ Y(0)]
```

* We can compute the adjoint representation of a dynamical Lie algebra.
[(5406)](https://github.com/PennyLaneAI/pennylane/pull/5406)

For example, we can compute the adjoint representation of the transverse field Ising model DLA.

>>> dla = [1.0 * X(0) @ X(1), 1.0 * Z(0), 1.0 * Z(1), -1.0 * Y(0) @ X(1), -1.0 * X(0) @ Y(1), -1.0 * Y(0) @ Y(1)]
>>> adjoint_rep = qml.dla.adjoint_repr(dla)
>>> adjoint_rep.shape
(6, 6, 6)

* We can compute the center of a dynamical Lie algebra.
[(#5477)](https://github.com/PennyLaneAI/pennylane/pull/5477)

Given a DLA `g`, we can now compute its center. The `center` is the collection of operators that commute with _all_ other operators in the DLA.

```pycon
>>> g = [X(0), X(1) @ X(0), Y(1), Z(1) @ X(0)]
>>> center(g)
[X(0)]
```

<h3>Improvements 🛠</h3>

* Improve the performance of computing the matrix of `qml.QFT`
Expand Down Expand Up @@ -151,14 +219,6 @@
SpectralNormError(6.166666666666668e-06)
```

<h3>Improvements 🛠</h3>

* The `qml.is_commuting` function now accepts `Sum`, `SProd`, and `Prod` instances.
[(#5351)](https://github.com/PennyLaneAI/pennylane/pull/5351)

* Operators can now be left multiplied `x * op` by numpy arrays.
[(#5361)](https://github.com/PennyLaneAI/pennylane/pull/5361)

* The `molecular_hamiltonian` function calls `PySCF` directly when `method='pyscf'` is selected.
[(#5118)](https://github.com/PennyLaneAI/pennylane/pull/5118)

Expand Down
1 change: 1 addition & 0 deletions pennylane/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import pennylane.qnn
import pennylane.templates
import pennylane.pauli
import pennylane.dla
from pennylane.pauli import pauli_decompose
from pennylane.resource import specs
import pennylane.resource
Expand Down
18 changes: 18 additions & 0 deletions pennylane/dla/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Xanadu Quantum Technologies Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""(Dynamical) Lie Algebra functionality in PennyLane"""

from .lie_closure import lie_closure
from .structure_constants import structure_constants
from .center import center
77 changes: 77 additions & 0 deletions pennylane/dla/center.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Copyright 2024 Xanadu Quantum Technologies Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A function to compute the center of a Lie algebra"""
from typing import List, Union
from itertools import combinations

import numpy as np

from pennylane.pauli import PauliSentence, PauliWord
from pennylane.operation import Operator


def center(
g: List[Union[Operator, PauliWord, PauliSentence]], pauli: bool = False
) -> List[Union[Operator, PauliSentence]]:
r"""
A function to compute the center of a Lie algebra.

Given a Lie algebra :math:`\mathfrak{g} = \{h_1,.., h_d\}`, the center :math:`\mathfrak{\xi}(\mathfrak{g})`
is given by all elements in :math:`\mathfrak{g}` that commute with `all` other elements in :math:`\mathfrak{g}`,
Qottmann marked this conversation as resolved.
Show resolved Hide resolved

.. math:: \mathfrak{\xi}(\mathfrak{g}) := \{h \in \mathfrak{g} | [h, h_i]=0 \ \forall h_i \in \mathfrak{g} \}

Args:
g (List[Union[Operator, PauliSentence]]): List of operators for which to find the center.
pauli (bool): Indicates whether it is assumed that :class:`~PauliSentence` instances are input and returned.
This can help with performance to avoid unnecessary conversions from :class:`~PauliSentence` to :class:`~Operator`
or :class:`~PauliWord` and vice versa. Note that the input in that case also has to be a list of :class:`~PauliSentence` instances.
Default is ``False``.

Returns:
List[Union[Operator, PauliSentence]]: Center of ``g``

**Example**

We can compute the center of a DLA ``g``. For that, we compute the DLA via :func:`~lie_closure`.

>>> generators = [qml.X(0), qml.X(0) @ qml.X(1), qml.Y(1)]
>>> g = qml.dla.lie_closure(generators)

The ``center`` is then the collection of operators that commute with `all` other operators in the DLA.
Qottmann marked this conversation as resolved.
Show resolved Hide resolved
In this case, just ``X(0)``.

>>> center(g)
[X(0)]

"""

if not pauli:
g = [o.pauli_rep for o in g]

d = len(g)
commutators = np.zeros((d, d), dtype=int)
for (j, op1), (k, op2) in combinations(enumerate(g), r=2):
res = op1.commutator(op2)
res.simplify()
if res != PauliSentence({}):
commutators[j, k] = 1 # dummy value to indicate operators dont commute
commutators[k, j] = 1
Qottmann marked this conversation as resolved.
Show resolved Hide resolved

mask = np.all(commutators == 0, axis=0)
res = list(np.array(g)[mask])

if not pauli:
res = [op.operation() for op in res]
return res
Loading
Loading