Loading .gitlab-ci.yml +4 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ docker run_brew_linux_bottles: - docker build --build-arg AIDEQC_ACCESS_TOKEN=$AIDEQC_ACCESS_TOKEN --build-arg JFROG_API_KEY=$JFROG_API_KEY -t qcor/brew-linux . --no-cache - docker system prune -f - docker rmi -f qcor/brew-linux allow_failure: true docker run_macosx_catalina_bottles: stage: deploy Loading @@ -39,6 +40,7 @@ docker run_macosx_catalina_bottles: - sleep 240 - ssh catalina-ci "PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin bash run_bottle_build.sh $AIDEQC_ACCESS_TOKEN" - docker stop tmp_catalina_ci && docker rm -v tmp_catalina_ci allow_failure: true docker run_macosx_mojave_bottles: stage: deploy Loading @@ -51,3 +53,4 @@ docker run_macosx_mojave_bottles: - sleep 240 - ssh mojave-ci "PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin bash run_bottle_build.sh $AIDEQC_ACCESS_TOKEN" - docker stop tmp_mojave_ci && docker rm -v tmp_mojave_ci allow_failure: true No newline at end of file examples/CMakeLists.txt +3 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ add_test(NAME qrt_simple-demo COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURREN add_test(NAME qrt_deuteron_exp_inst COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/deuteron/deuteron_exp_inst.cpp) add_test(NAME qrt_deuteron_task_initiate COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/deuteron/deuteron_task_initiate.cpp) add_test(NAME qrt_qaoa_example COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/qaoa/qaoa_example.cpp) add_test(NAME qrt_simple-objective-function COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/simple/simple-objective-function.cpp) add_test(NAME qrt_qpe_example COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/qpe/qpe_example_qrt.cpp) add_test(NAME qrt_kernel_include COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/simple/multiple_kernels.cpp) add_test(NAME qrt_grover COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/grover/grover.cpp) Loading @@ -40,6 +39,9 @@ add_test(NAME quasimo_verified_qpe COMMAND ${CMAKE_BINARY_DIR}/qcor ${CMAKE_CURR add_test(NAME hadamard_ctrl_test COMMAND ${CMAKE_BINARY_DIR}/qcor ${CMAKE_CURRENT_SOURCE_DIR}/ctrl-gates/simple_hadamard_test.cpp) add_test(NAME multi_ctrl_test COMMAND ${CMAKE_BINARY_DIR}/qcor ${CMAKE_CURRENT_SOURCE_DIR}/ctrl-gates/multiple_controls.cpp) add_qcor_compile_and_exe_test(qrt_obj_func_simple simple/simple-objective-function.cpp) add_qcor_compile_and_exe_test(qrt_kernel_autograd_simple simple/gradients_optimization.cpp) add_qcor_compile_and_exe_test(qrt_hybrid_vqe_exe hybrid/deuteron_h2_vqe.cpp) add_qcor_compile_and_exe_test(qrt_bell_ctrl bell/bell_control.cpp) # Lambda tests Loading examples/chemistry/simple_h2_test_ucc1.cpp 0 → 100644 +29 −0 Original line number Diff line number Diff line __qpu__ void ansatz(qreg q, double theta) { X(q[0]); X(q[2]); compute { Rx(q[0], constants::pi / 2); for (auto i : range(3)) H(q[i + 1]); for (auto i : range(3)) { CX(q[i], q[i + 1]); } } action { Rz(q[3], theta); } } int main() { std::string h2_geom = R"#(H 0.000000 0.0 0.0 H 0.0 0.0 .7474)#"; auto H = createOperator("pyscf", {{"basis", "sto-3g"}, {"geometry", h2_geom}}); OptFunction opt_function( [&](std::vector<double> x) { return ansatz::observe(H, qalloc(4), x[0]); }, 1); auto [energy, opt_params] = createOptimizer("nlopt")->optimize(opt_function); print(energy); } No newline at end of file examples/hybrid/deuteron_h2_vqe.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -56,12 +56,14 @@ int main() { // start the optimization at const auto [energy, params] = vqe.execute(0.0); std::cout << "<H>(" << params[0] << ") = " << energy << "\n"; qcor_expect(std::abs(energy + 1.74886) < 0.1); // Now do the same for the vector double ansatz, but // also demonstrate the async interface VQE vqe_vec(ansatz_vec, H); const auto [energy_vec, params_vec] = vqe_vec.execute(std::vector<double>{0.0}); std::cout << "<H>(" << params_vec[0] << ") = " << energy_vec << "\n"; qcor_expect(std::abs(energy_vec + 1.74886) < 0.1); // Now run with the mixed language kernel, // initialize the optimization to x = .55, also Loading @@ -74,6 +76,7 @@ int main() { const auto [energy_oq, params_oq] = vqe_openqasm.execute(optimizer, .55); std::cout << "<H>(" << params_oq[0] << ") = " << energy_oq << "\n"; qcor_expect(std::abs(energy_vec + 1.74886) < 0.1); // Can query information about the vqe run // Here, we get all parameter sets executed and correspnding energies seen Loading examples/quasimo/IterativeQpeVqe.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -25,16 +25,20 @@ int main(int argc, char **argv) { QuaSiMo::ModelFactory::createModel(eigen_state_prep, H, 2, 0); // Instantiate an IQPE workflow // NOTE: can turn off exp_i_theta compute-action-uncompute with {"cau-opt", false} auto workflow = QuaSiMo::getWorkflow("iqpe", {{"time-steps", 8}, {"iterations", 8}}); auto result = workflow->execute(problemModel); const double phaseValue = result.get<double>("phase"); const double energy = result.get<double>("energy"); auto n_insts = result.get<std::vector<int>>("n-kernel-instructions"); std::cout << "Final phase = " << phaseValue << "\n"; // Expect: ~ -1.7 (due to limited bit precision) std::cout << "Energy = " << energy << "\n"; print("N Instructions at Iter:"); for (auto [i,n] : enumerate(n_insts)) print("iter", i, ":" , n); return 0; } No newline at end of file Loading
.gitlab-ci.yml +4 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ docker run_brew_linux_bottles: - docker build --build-arg AIDEQC_ACCESS_TOKEN=$AIDEQC_ACCESS_TOKEN --build-arg JFROG_API_KEY=$JFROG_API_KEY -t qcor/brew-linux . --no-cache - docker system prune -f - docker rmi -f qcor/brew-linux allow_failure: true docker run_macosx_catalina_bottles: stage: deploy Loading @@ -39,6 +40,7 @@ docker run_macosx_catalina_bottles: - sleep 240 - ssh catalina-ci "PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin bash run_bottle_build.sh $AIDEQC_ACCESS_TOKEN" - docker stop tmp_catalina_ci && docker rm -v tmp_catalina_ci allow_failure: true docker run_macosx_mojave_bottles: stage: deploy Loading @@ -51,3 +53,4 @@ docker run_macosx_mojave_bottles: - sleep 240 - ssh mojave-ci "PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin bash run_bottle_build.sh $AIDEQC_ACCESS_TOKEN" - docker stop tmp_mojave_ci && docker rm -v tmp_mojave_ci allow_failure: true No newline at end of file
examples/CMakeLists.txt +3 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ add_test(NAME qrt_simple-demo COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURREN add_test(NAME qrt_deuteron_exp_inst COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/deuteron/deuteron_exp_inst.cpp) add_test(NAME qrt_deuteron_task_initiate COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/deuteron/deuteron_task_initiate.cpp) add_test(NAME qrt_qaoa_example COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/qaoa/qaoa_example.cpp) add_test(NAME qrt_simple-objective-function COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/simple/simple-objective-function.cpp) add_test(NAME qrt_qpe_example COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/qpe/qpe_example_qrt.cpp) add_test(NAME qrt_kernel_include COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/simple/multiple_kernels.cpp) add_test(NAME qrt_grover COMMAND ${CMAKE_BINARY_DIR}/qcor -c ${CMAKE_CURRENT_SOURCE_DIR}/grover/grover.cpp) Loading @@ -40,6 +39,9 @@ add_test(NAME quasimo_verified_qpe COMMAND ${CMAKE_BINARY_DIR}/qcor ${CMAKE_CURR add_test(NAME hadamard_ctrl_test COMMAND ${CMAKE_BINARY_DIR}/qcor ${CMAKE_CURRENT_SOURCE_DIR}/ctrl-gates/simple_hadamard_test.cpp) add_test(NAME multi_ctrl_test COMMAND ${CMAKE_BINARY_DIR}/qcor ${CMAKE_CURRENT_SOURCE_DIR}/ctrl-gates/multiple_controls.cpp) add_qcor_compile_and_exe_test(qrt_obj_func_simple simple/simple-objective-function.cpp) add_qcor_compile_and_exe_test(qrt_kernel_autograd_simple simple/gradients_optimization.cpp) add_qcor_compile_and_exe_test(qrt_hybrid_vqe_exe hybrid/deuteron_h2_vqe.cpp) add_qcor_compile_and_exe_test(qrt_bell_ctrl bell/bell_control.cpp) # Lambda tests Loading
examples/chemistry/simple_h2_test_ucc1.cpp 0 → 100644 +29 −0 Original line number Diff line number Diff line __qpu__ void ansatz(qreg q, double theta) { X(q[0]); X(q[2]); compute { Rx(q[0], constants::pi / 2); for (auto i : range(3)) H(q[i + 1]); for (auto i : range(3)) { CX(q[i], q[i + 1]); } } action { Rz(q[3], theta); } } int main() { std::string h2_geom = R"#(H 0.000000 0.0 0.0 H 0.0 0.0 .7474)#"; auto H = createOperator("pyscf", {{"basis", "sto-3g"}, {"geometry", h2_geom}}); OptFunction opt_function( [&](std::vector<double> x) { return ansatz::observe(H, qalloc(4), x[0]); }, 1); auto [energy, opt_params] = createOptimizer("nlopt")->optimize(opt_function); print(energy); } No newline at end of file
examples/hybrid/deuteron_h2_vqe.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -56,12 +56,14 @@ int main() { // start the optimization at const auto [energy, params] = vqe.execute(0.0); std::cout << "<H>(" << params[0] << ") = " << energy << "\n"; qcor_expect(std::abs(energy + 1.74886) < 0.1); // Now do the same for the vector double ansatz, but // also demonstrate the async interface VQE vqe_vec(ansatz_vec, H); const auto [energy_vec, params_vec] = vqe_vec.execute(std::vector<double>{0.0}); std::cout << "<H>(" << params_vec[0] << ") = " << energy_vec << "\n"; qcor_expect(std::abs(energy_vec + 1.74886) < 0.1); // Now run with the mixed language kernel, // initialize the optimization to x = .55, also Loading @@ -74,6 +76,7 @@ int main() { const auto [energy_oq, params_oq] = vqe_openqasm.execute(optimizer, .55); std::cout << "<H>(" << params_oq[0] << ") = " << energy_oq << "\n"; qcor_expect(std::abs(energy_vec + 1.74886) < 0.1); // Can query information about the vqe run // Here, we get all parameter sets executed and correspnding energies seen Loading
examples/quasimo/IterativeQpeVqe.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -25,16 +25,20 @@ int main(int argc, char **argv) { QuaSiMo::ModelFactory::createModel(eigen_state_prep, H, 2, 0); // Instantiate an IQPE workflow // NOTE: can turn off exp_i_theta compute-action-uncompute with {"cau-opt", false} auto workflow = QuaSiMo::getWorkflow("iqpe", {{"time-steps", 8}, {"iterations", 8}}); auto result = workflow->execute(problemModel); const double phaseValue = result.get<double>("phase"); const double energy = result.get<double>("energy"); auto n_insts = result.get<std::vector<int>>("n-kernel-instructions"); std::cout << "Final phase = " << phaseValue << "\n"; // Expect: ~ -1.7 (due to limited bit precision) std::cout << "Energy = " << energy << "\n"; print("N Instructions at Iter:"); for (auto [i,n] : enumerate(n_insts)) print("iter", i, ":" , n); return 0; } No newline at end of file