{"id":27306224,"url":"https://github.com/brian-hepler-phd/kak-decomposition-qml","last_synced_at":"2026-05-09T09:48:04.847Z","repository":{"id":285036733,"uuid":"956876670","full_name":"brian-hepler-phd/kak-decomposition-qml","owner":"brian-hepler-phd","description":"Cartan decomposition (SU(4)) via Lie theory and QML – exact + variational approaches for two-qubit gates.","archived":false,"fork":false,"pushed_at":"2025-04-11T22:01:04.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T03:58:57.450Z","etag":null,"topics":["lie-theory","machine-learning","numpy","pennylane","qml","quantum-computing","quantum-gate-decomposition","scipy","su4"],"latest_commit_sha":null,"homepage":"https://www.bhepler.com","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brian-hepler-phd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-29T03:06:10.000Z","updated_at":"2025-04-11T22:06:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9ff3b7b-6e68-453a-bf80-cdee100755b6","html_url":"https://github.com/brian-hepler-phd/kak-decomposition-qml","commit_stats":null,"previous_names":["brian-hepler-phd/kak-decomposition-qml"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brian-hepler-phd%2Fkak-decomposition-qml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brian-hepler-phd%2Fkak-decomposition-qml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brian-hepler-phd%2Fkak-decomposition-qml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brian-hepler-phd%2Fkak-decomposition-qml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brian-hepler-phd","download_url":"https://codeload.github.com/brian-hepler-phd/kak-decomposition-qml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514202,"owners_count":21116900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lie-theory","machine-learning","numpy","pennylane","qml","quantum-computing","quantum-gate-decomposition","scipy","su4"],"created_at":"2025-04-12T03:58:59.861Z","updated_at":"2026-05-09T09:48:04.789Z","avatar_url":"https://github.com/brian-hepler-phd.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KAK Decomposition of Two-Qubit Gates via Lie Theory and Quantum Machine Learning\n\n\u003e Developed as supplemental material for Quantum Formalism's \"[Lie Groups with Applications](https://quantumformalism.academy/lie-groups-with-applications)\" course (Lecture 5).\n\n\u003e *See my full portfolio at: [https://bhepler.com/portfolio/](https://brainhelper.wordpress.com/data-science-portfolio/)*\n\n## Goal\n\nTo decompose a general two-qubit gate (an $SU(4)$ matrix) into simpler components using Lie-theoretic methods (Cartan Decomposition) and, complementarily, to synthesize the same gate using a Quantum Machine Learning (QML) approach with a Variational Quantum Circuit (VQC). This project explores both exact numerical solutions rooted in Lie theory and approximate, trainable quantum circuits.\n\n## Key Concepts \u0026 Relevance\n\n*   **Lie Theory:** Cartan KAK Decomposition ($G = K_0 A K_1^{-1}$) of SU(4), Lie Algebras ($\\mathfrak{su}(4)$), matrix logarithm/exponential.\n*   **Quantum Computing:** Two-Qubit Gates (SU(4)), Gate Decomposition, Gate Synthesis, Local vs. Non-local (Entangling) Operations.\n*   **Quantum Machine Learning (QML):** Variational Quantum Circuits (VQC), Parameter Optimization, Automatic Differentiation, Gradient Descent.\n*   **Numerical Methods:** Root-finding algorithms for solving decomposition equations.\n*   **Relevance:** Essential for understanding quantum gate structures, optimizing quantum circuits, quantum optimal control, and applying ML techniques within quantum computation.\n\n## Implementation \u0026 Activities\n\n*   **Implemented two distinct methods** for handling arbitrary $SU(4)$ two-qubit gates:\n    *   **Exact Decomposition:** Developed a numerical solution using the Khaneja-Glaser algorithm (**NumPy, SciPy**) based on the Cartan KAK decomposition, isolating local ($K_0, K_1$) and non-local ($A$) factors. Utilized **SciPy's optimize.root** for solving intermediate steps.\n    *   **Variational Synthesis (QML):** Designed and implemented a Variational Quantum Circuit (VQC) in **PennyLane**, with a structure inspired by the Cartan decomposition (parameterizing local and non-local parts).\n*   **Leveraged PennyLane's automatic differentiation** capabilities to compute gradients of a fidelity cost function (comparing VQC output to the target gate).\n*   **Implemented gradient descent** optimization to train the VQC parameters, learning an approximate synthesis of the target $SU(4)$ gate.\n*   **Verified** the accuracy of both methods by reconstructing the original gate from the decomposed/synthesized components and calculating the approximation error (e.g., using matrix norm).\n*   **Bridged** advanced Lie theory concepts with practical quantum computing frameworks (**PennyLane**) and numerical optimization techniques.\n\n## Technologies \u0026 Skills\n\n*   **Languages:** Python\n*   **Libraries:** NumPy, SciPy (linalg, optimize), PennyLane, Matplotlib (for potential convergence plots)\n*   **Concepts:** Lie Groups (SU(4)), Lie Algebras ($\\mathfrak{su}(4)$), Cartan Decomposition (KAK), Matrix Logarithm/Exponential, Quantum Machine Learning (QML), Variational Quantum Circuits (VQC), Automatic Differentiation, Gradient Descent, Quantum Computing (Two-Qubit Gates, Gate Decomposition/Synthesis), Numerical Optimization, Linear Algebra.\n\n\n## Theoretical Background\n\nThis project leverages the Cartan KAK decomposition, a fundamental result in Lie theory stating that any element $G$ of a semisimple Lie group (like SU(4)) can be written as $G = K_0 A K_1^{-1}$, where $K_0, K_1$ are in a maximal compact subgroup (here $SU(2) \\otimes SU(2)$, representing local operations) and $A$ is in a specific abelian subgroup related to the Cartan subalgebra (representing the non-local/entangling part).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrian-hepler-phd%2Fkak-decomposition-qml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrian-hepler-phd%2Fkak-decomposition-qml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrian-hepler-phd%2Fkak-decomposition-qml/lists"}