This repository contains various experimental quantum circuit evaluators and compilers. They take a Toffoli-Hadamard quantum circuit as input, and simulates the probability amplitudes of all possible outcomes.
-
The directory
src/main/scala/feynmancontains various Feynman-style simulators implemented using continuations.QContSim1.scalacontains a pure implementation and uses delimited continuationsshift/reset(following the Quantum Continuation paper).QContSim2.scalaimplements an evaluator written in CPS and uses side-effect to perform path summarization.QCompilerCPS.scalais a staged CPS evaluator (written with Lightweight Modular Staging) that can generate C code for simulation.
-
The directory
src/main/scala/schrodingercontains various Schrodinger-style simulators implemented with linear algebra computation.Schrodinger.scalais an unstaged implementation.StagedSchrodinger.scalais a staged implementation that specializes over static gate matrices.
To see an example of the compiler in action, run the following command
in sbt:
sbt:quantum-lms-compiler> runMain quantum.feynman.staged.TestQC
This will take the circuit for the Simon problem
as input and execute the generated C program snippet.cpp.
The C program is compiled with g++ -std=c++20 -O3.
Running the generated program prints all states and their probability amplitudes:
0.5|0000⟩
0.5|0011⟩
0.5|1100⟩
-0.5|1111⟩