From 3d0c2bf730c248e112395e9bbf2b0250c5971824 Mon Sep 17 00:00:00 2001 From: jamesETsmith Date: Fri, 1 Nov 2024 13:08:10 -0400 Subject: [PATCH] [feature/SPO_apply] Small fixes, include in the examples --- fast_pauli/cpp/examples/03_summed_pauli_op.cpp | 15 ++++++++------- fast_pauli/cpp/include/__pauli_helpers.hpp | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fast_pauli/cpp/examples/03_summed_pauli_op.cpp b/fast_pauli/cpp/examples/03_summed_pauli_op.cpp index 24414be..8801c48 100644 --- a/fast_pauli/cpp/examples/03_summed_pauli_op.cpp +++ b/fast_pauli/cpp/examples/03_summed_pauli_op.cpp @@ -13,6 +13,7 @@ */ #include +#include #include #include @@ -28,10 +29,10 @@ int main() // User settings // size_t const n_operators = 1000; - size_t const n_qubits = 10; + size_t const n_qubits = 12; size_t const weight = 2; size_t const n_states = 1000; - using fp_type = double; + using fp_type = float; // // Setup the summed pauli operator @@ -63,11 +64,11 @@ int main() // // Apply the states // - auto start_seq = std::chrono::high_resolution_clock::now(); - summed_op.apply_weighted(std::execution::seq, new_states, states, weights); - auto end_seq = std::chrono::high_resolution_clock::now(); - fmt::println("Time taken for sequential execution: {} seconds", - std::chrono::duration_cast(end_seq - start_seq).count()); + // auto start_seq = std::chrono::high_resolution_clock::now(); + // summed_op.apply_weighted(std::execution::seq, new_states, states, weights); + // auto end_seq = std::chrono::high_resolution_clock::now(); + // fmt::println("Time taken for sequential execution: {} seconds", + // std::chrono::duration_cast(end_seq - start_seq).count()); auto start_par = std::chrono::high_resolution_clock::now(); summed_op.apply_weighted(std::execution::par, new_states, states, weights); diff --git a/fast_pauli/cpp/include/__pauli_helpers.hpp b/fast_pauli/cpp/include/__pauli_helpers.hpp index 5ecea4b..c31b2b8 100644 --- a/fast_pauli/cpp/include/__pauli_helpers.hpp +++ b/fast_pauli/cpp/include/__pauli_helpers.hpp @@ -112,8 +112,8 @@ std::vector calcutate_pauli_strings(size_t const n_qubits, size_t c size_t n_pauli_strings = nontrivial_paulis.size() * idx_combos.size(); std::vector result(n_pauli_strings); - fmt::println("n_qubits = {} weight = {} n_nontrivial_paulis = {} n_combos = {}", n_qubits, weight, - nontrivial_paulis.size(), idx_combos.size()); + // fmt::println("n_qubits = {} weight = {} n_nontrivial_paulis = {} n_combos = {}", n_qubits, weight, + // nontrivial_paulis.size(), idx_combos.size()); // Iterate through all the nontrivial paulis and all the combinations for (size_t i = 0; i < nontrivial_paulis.size(); ++i) @@ -153,7 +153,7 @@ std::vector calculate_pauli_strings_max_weight(size_t n_qubits, siz result.insert(result.end(), ps.begin(), ps.end()); } - fmt::println("n_qubits = {} weight = {} n_pauli_strings = {}", n_qubits, weight, result.size()); + // fmt::println("n_qubits = {} weight = {} n_pauli_strings = {}", n_qubits, weight, result.size()); return result; }