{"id":16313631,"url":"https://github.com/kraks/quantum-compiler","last_synced_at":"2025-10-25T16:31:47.354Z","repository":{"id":148704746,"uuid":"613167460","full_name":"Kraks/quantum-compiler","owner":"Kraks","description":"Quantum circuits compiler with staging and continuations","archived":false,"fork":false,"pushed_at":"2024-11-19T22:37:46.000Z","size":115,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-31T09:05:24.408Z","etag":null,"topics":["compiler","continuation-passing-style","continuations","multi-stage-programming","quantum-circuit-simulator","quantum-compiler","quantum-computing","quantum-programming-language","staging"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/Kraks.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}},"created_at":"2023-03-13T02:59:50.000Z","updated_at":"2024-11-19T22:37:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"b03d77dc-fbd0-4369-81e6-fc92c7f7e28b","html_url":"https://github.com/Kraks/quantum-compiler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kraks%2Fquantum-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kraks%2Fquantum-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kraks%2Fquantum-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kraks%2Fquantum-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kraks","download_url":"https://codeload.github.com/Kraks/quantum-compiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183444,"owners_count":19430119,"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":["compiler","continuation-passing-style","continuations","multi-stage-programming","quantum-circuit-simulator","quantum-compiler","quantum-computing","quantum-programming-language","staging"],"created_at":"2024-10-10T21:51:52.340Z","updated_at":"2025-10-25T16:31:47.065Z","avatar_url":"https://github.com/Kraks.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quantum Circuits Compiler with Staging\n\nThis repository contains various experimental quantum circuit evaluators and compilers.\nThey take a Toffoli-Hadamard quantum circuit as input, and simulates the probability amplitudes of all possible outcomes.\n\n- The directory `src/main/scala/feynman` contains various Feynman-style simulators implemented using continuations.\n  - `QContSim1.scala` contains a pure implementation and uses delimited continuations `shift`/`reset` (following the [Quantum Continuation](https://andykeep.com/SchemeWorkshop2022/scheme2022-final37.pdf) paper).\n  - `QContSim2.scala` implements an evaluator written in CPS and uses side-effect to perform path summarization.\n  - `QCompilerCPS.scala` is a staged CPS evaluator (written with [Lightweight Modular\n  Staging](https://github.com/TiarkRompf/lms-clean)) that can generate C code\n  for simulation.\n\n- The directory `src/main/scala/schrodinger` contains various Schrodinger-style simulators implemented with linear algebra computation.\n  - `Schrodinger.scala` is an unstaged implementation.\n  - `StagedSchrodinger.scala` is a staged implementation that specializes over static gate matrices.\n\n## Example\n\nTo see an example of the compiler in action, run the following command\nin `sbt`:\n\n```\nsbt:quantum-lms-compiler\u003e runMain quantum.feynman.staged.TestQC\n```\n\nThis will take the circuit for [the Simon problem](https://en.wikipedia.org/wiki/Simon%27s_problem)\nas input and execute the generated C program `snippet.cpp`.\nThe C program is compiled with `g++ -std=c++20 -O3`.\nRunning the generated program prints all states and their probability amplitudes:\n\n```\n0.5|0000⟩\n0.5|0011⟩\n0.5|1100⟩\n-0.5|1111⟩\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkraks%2Fquantum-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkraks%2Fquantum-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkraks%2Fquantum-compiler/lists"}