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

[labs.dla 6] Variational KAK decomposition #6446

Merged
merged 581 commits into from
Dec 18, 2024
Merged

[labs.dla 6] Variational KAK decomposition #6446

merged 581 commits into from
Dec 18, 2024

Conversation

Qottmann
Copy link
Contributor

@Qottmann Qottmann commented Oct 25, 2024

Variational KHK decomposition using the adjoint representation

Based off https://arxiv.org/pdf/2104.00728 but with some important modifications, in particular using the adjoint representation which is faster and enables working with arbitrary bases

TODO

  • Compatible with dense representations
  • more extensive testing
n = 2

gens = [X(i) @ X(i+1) for i in range(n-1)]
gens += [Z(i) for i in range(n)]
H = qml.sum(*gens)

g = qml.lie_closure(gens)
g = [op.pauli_rep for op in g]

involution = concurrence_involution

assert not involution(H)
k, m = cartan_decomposition(g, involution=involution)
assert check_cartan_decomp(k, m)

g = k + m
adj = qml.structure_constants(g)

g, k, mtilde, h, adj = cartan_subalgebra(g, k, m, adj, tol=1e-14, start_idx=0)
len(g), len(k), len(mtilde), len(h), adj.shape
dims = (len(k), len(mtilde), len(h))
khk_res = variational_khk(H, g, dims, adj, verbose=True)
validate_khk(H, k, mtilde+h, khk_res, n, 1e-6)

[sc-74997]

@Qottmann Qottmann changed the base branch from master to csa October 25, 2024 11:01
@Qottmann Qottmann changed the title [labs] [WIP] Variational KHK decomposition [labs.dla 7] [WIP] Variational KHK decomposition Nov 11, 2024
@Qottmann
Copy link
Contributor Author

Qottmann commented Nov 12, 2024

Test example still fails for n=4 🫠 cc @dwierichs

edit: works now 🥳

Base automatically changed from csa to involutions November 18, 2024 12:09
@Qottmann Qottmann changed the title [labs.dla 7] [WIP] Variational KHK decomposition [labs.dla 6] [WIP] Variational KHK decomposition Nov 18, 2024
@Qottmann Qottmann requested a review from dwierichs December 13, 2024 13:50
Copy link
Contributor

@dwierichs dwierichs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looking forward for this milestone to be merged! 💯

I think I looked at this code far too many times by now :D
I mostly had quite small comments/suggestions, like trying to avoid mixing "khk" and "kak", and things like that. Otherwise LGTM and happy to approve after!

pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/dla/variational_kak.py Show resolved Hide resolved
pennylane/labs/tests/dla/test_variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/tests/dla/test_variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/tests/dla/test_variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/tests/dla/test_variational_kak.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look more into the code next week, but this seems pretty good!

pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
Copy link
Contributor

@dwierichs dwierichs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work @Qottmann 💯

Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few minor suggestions, but no blockers from me

pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
pennylane/labs/dla/variational_kak.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@Qottmann Qottmann enabled auto-merge (squash) December 18, 2024 17:16
@Qottmann Qottmann merged commit ce0f101 into master Dec 18, 2024
46 checks passed
@Qottmann Qottmann deleted the variational_khk branch December 18, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants