Loading examples/qcor_demos/pnnl_tutorials/2_observables/basic_observable.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -8,10 +8,10 @@ int main() { // Create the Hamiltonian auto H = -2.1433 * X(0) * X(1) - 2.1433 * Y(0) * Y(1) + .21829 * Z(0) - 6.125 * Z(1) + 5.907; std::cout << "H = " << H.toString() << "\n"; const double test_theta = 1.2345; auto q = qalloc(2); const double energy = ansatz::observe(H, q, test_theta); std::cout << "E(" << test_theta << ") = " << energy << "\n"; q.print(); // q.print(); } No newline at end of file examples/qcor_demos/pnnl_tutorials/2_observables/deuteron_3qbit_exp_openfermion.py +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ def ansatz(q: qreg, x: List[float], exp_args: List[Operator]): exp_i_theta(q, x[i], exp_args[i]) # Create OpenFermion operators for our quantum kernel... exp_args_openfermion = [FOp('0^ 1') - FOp('1^ 0'), FOp('0^ 2') - FOp('2^ 0')] exp_args_openfermion = [FOp('0^ 2') - FOp('2^ 0')] # We need to translate OpenFermion ops into qcor Operators to use with kernels... exp_args_qcor = [createOperator('fermion', fop) for fop in exp_args_openfermion] Loading examples/qcor_demos/pnnl_tutorials/3_quasimo/AdaptVqeWorkflow.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -40,8 +40,5 @@ int main(int argc, char **argv) { {"n-electrons", nElectrons}}); auto result = workflow->execute(problemModel); std::cout << "Final energy: " << result.get<double>("energy") << "\n"; auto final_ansatz = result.getPointerLike<xacc::CompositeInstruction>("circuit"); std::cout << "HOWDY: \n" << final_ansatz->toString() << "\n"; return 0; } No newline at end of file examples/qcor_demos/pnnl_tutorials/3_quasimo/IterativeQpeVqe.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ // iterative QPE procedure. // Compile and run with: /// $ qcor -qpu qpp IterativeQpeVqe.cpp /// $ qcor IterativeQpeVqe.cpp /// $ ./a.out /// Ansatz to bring the state into an eigenvector state of the Hamiltonian. Loading Loading @@ -37,8 +37,5 @@ int main(int argc, char **argv) { 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 examples/qcor_demos/pnnl_tutorials/3_quasimo/QITE.png 0 → 100644 +41 KiB Loading image diff... Loading
examples/qcor_demos/pnnl_tutorials/2_observables/basic_observable.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -8,10 +8,10 @@ int main() { // Create the Hamiltonian auto H = -2.1433 * X(0) * X(1) - 2.1433 * Y(0) * Y(1) + .21829 * Z(0) - 6.125 * Z(1) + 5.907; std::cout << "H = " << H.toString() << "\n"; const double test_theta = 1.2345; auto q = qalloc(2); const double energy = ansatz::observe(H, q, test_theta); std::cout << "E(" << test_theta << ") = " << energy << "\n"; q.print(); // q.print(); } No newline at end of file
examples/qcor_demos/pnnl_tutorials/2_observables/deuteron_3qbit_exp_openfermion.py +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ def ansatz(q: qreg, x: List[float], exp_args: List[Operator]): exp_i_theta(q, x[i], exp_args[i]) # Create OpenFermion operators for our quantum kernel... exp_args_openfermion = [FOp('0^ 1') - FOp('1^ 0'), FOp('0^ 2') - FOp('2^ 0')] exp_args_openfermion = [FOp('0^ 2') - FOp('2^ 0')] # We need to translate OpenFermion ops into qcor Operators to use with kernels... exp_args_qcor = [createOperator('fermion', fop) for fop in exp_args_openfermion] Loading
examples/qcor_demos/pnnl_tutorials/3_quasimo/AdaptVqeWorkflow.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -40,8 +40,5 @@ int main(int argc, char **argv) { {"n-electrons", nElectrons}}); auto result = workflow->execute(problemModel); std::cout << "Final energy: " << result.get<double>("energy") << "\n"; auto final_ansatz = result.getPointerLike<xacc::CompositeInstruction>("circuit"); std::cout << "HOWDY: \n" << final_ansatz->toString() << "\n"; return 0; } No newline at end of file
examples/qcor_demos/pnnl_tutorials/3_quasimo/IterativeQpeVqe.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ // iterative QPE procedure. // Compile and run with: /// $ qcor -qpu qpp IterativeQpeVqe.cpp /// $ qcor IterativeQpeVqe.cpp /// $ ./a.out /// Ansatz to bring the state into an eigenvector state of the Hamiltonian. Loading Loading @@ -37,8 +37,5 @@ int main(int argc, char **argv) { 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