Loading examples/aide_qc_2021_demo/grover/README.md 0 → 100644 +23 −0 Original line number Diff line number Diff line # Grover Demonstration  Code up a grover example live, search for marked states |101> and |011>. We want a general library function that is parameterized on the oracle kernel and number of iterations ## Goals * Show off kernel composition * Show off compute-action-uncompute pattern * Show off functional programming ## Steps * Start off by hard-coding the oracle. And define run_grover to only take qreg and iterations * Implement run_grover, using hard-coded oracle * Implement amplification, showing circuit, showing pattern * Implement main. * Compile and run. Show it works. * Update run_grover to use KernelSignature, move oracle below run_grover. * compile and run * Update oracle to be a lambda * Show off python version No newline at end of file examples/aide_qc_2021_demo/grover/grover_circuit.png −3.03 KiB (63.3 KiB) Loading image diff... examples/aide_qc_2021_demo/hello_world/README.md 0 → 100644 +23 −0 Original line number Diff line number Diff line # Hello World Demonstration ## GHZ Goals Write a C++ code that prepares a GHZ state on N qubits. * How does one write a quantum kernel? * What is a qreg? * What operations are exposed on qreg? * How to reference qubits from a qreg? * Quantum Instruction Broadcasting * Logical-to-physical connectivity mapping - placement * Print the kernel qasm * Run on Qpp, Noisy Aer, and IBM * Demonstrate functional programming with lambdas * Show equivalent in Python. First run is slow for JIT, but subsequently fast ## Circuit Optimization Goals Write a C++ code that shows off a kernel that can be reduced to nothing by the Pass Manager. * Loop over N Hadamards on a qubit * Z H X H * Zero rotations * Show off CX and X::ctrl * Show as_unitary_matrix * Run with opt-level 1, then opt-level 2, -print-opt-stats No newline at end of file examples/aide_qc_2021_demo/hello_world/circuit_optimization.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ __qpu__ void nothing(qreg qbits, const int n, double x) { auto q = qbits.head(); auto r = qbits.tail(); for (int i = 0; i < 100; i++) { for (int i = 0; i < n; i++) { H(q); } Loading examples/aide_qc_2021_demo/hello_world/ghz.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -30,4 +30,17 @@ int main() { } ghz::print_kernel(q); auto ghz_lambda = qpu_lambda([](qreg q ) { H(q[0]); for (auto i : range(q.size()-1)) { CX(q[i], q[i+1]); } Measure(q); }); auto r = qalloc(5); ghz_lambda(r); r.print(); } No newline at end of file Loading
examples/aide_qc_2021_demo/grover/README.md 0 → 100644 +23 −0 Original line number Diff line number Diff line # Grover Demonstration  Code up a grover example live, search for marked states |101> and |011>. We want a general library function that is parameterized on the oracle kernel and number of iterations ## Goals * Show off kernel composition * Show off compute-action-uncompute pattern * Show off functional programming ## Steps * Start off by hard-coding the oracle. And define run_grover to only take qreg and iterations * Implement run_grover, using hard-coded oracle * Implement amplification, showing circuit, showing pattern * Implement main. * Compile and run. Show it works. * Update run_grover to use KernelSignature, move oracle below run_grover. * compile and run * Update oracle to be a lambda * Show off python version No newline at end of file
examples/aide_qc_2021_demo/hello_world/README.md 0 → 100644 +23 −0 Original line number Diff line number Diff line # Hello World Demonstration ## GHZ Goals Write a C++ code that prepares a GHZ state on N qubits. * How does one write a quantum kernel? * What is a qreg? * What operations are exposed on qreg? * How to reference qubits from a qreg? * Quantum Instruction Broadcasting * Logical-to-physical connectivity mapping - placement * Print the kernel qasm * Run on Qpp, Noisy Aer, and IBM * Demonstrate functional programming with lambdas * Show equivalent in Python. First run is slow for JIT, but subsequently fast ## Circuit Optimization Goals Write a C++ code that shows off a kernel that can be reduced to nothing by the Pass Manager. * Loop over N Hadamards on a qubit * Z H X H * Zero rotations * Show off CX and X::ctrl * Show as_unitary_matrix * Run with opt-level 1, then opt-level 2, -print-opt-stats No newline at end of file
examples/aide_qc_2021_demo/hello_world/circuit_optimization.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ __qpu__ void nothing(qreg qbits, const int n, double x) { auto q = qbits.head(); auto r = qbits.tail(); for (int i = 0; i < 100; i++) { for (int i = 0; i < n; i++) { H(q); } Loading
examples/aide_qc_2021_demo/hello_world/ghz.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -30,4 +30,17 @@ int main() { } ghz::print_kernel(q); auto ghz_lambda = qpu_lambda([](qreg q ) { H(q[0]); for (auto i : range(q.size()-1)) { CX(q[i], q[i+1]); } Measure(q); }); auto r = qalloc(5); ghz_lambda(r); r.print(); } No newline at end of file