Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stand-by committed Dec 17, 2024
1 parent 5d54136 commit 2643be6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions fast_pauli/cpp/include/__summed_pauli_op.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,17 @@ template <std::floating_point T> struct SummedPauliOp
*/
std::vector<PauliOp<T>> split() const
{
std::vector<std::complex<T>> op_coeffs(n_pauli_strings());
std::vector<PauliOp<T>> ops;
ops.reserve(n_operators());
std::vector<PauliOp<T>> ops(n_operators());

for (size_t k = 0; k < n_operators(); k++)
#pragma omp parallel for schedule(static)
for (size_t k = 0; k < n_operators(); ++k)
{
for (size_t i = 0; i < n_pauli_strings(); i++)
std::vector<std::complex<T>> op_coeffs(n_pauli_strings());

for (size_t i = 0; i < n_pauli_strings(); ++i)
op_coeffs[i] = coeffs(i, k);
ops.push_back(PauliOp<T>(op_coeffs, pauli_strings));

ops[k] = PauliOp<T>(std::move(op_coeffs), this->pauli_strings);
}

return ops;
Expand Down
4 changes: 2 additions & 2 deletions fast_pauli/cpp/src/fast_pauli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ np.ndarray
)%")
.def_prop_ro(
"pauli_strings", [](fp::SummedPauliOp<float_type> const &self) { return self.pauli_strings; },
"List[PauliString]: Ordered list of PauliString objects in SummedPauliOp")
"List[PauliString]: The list of PauliString objects corresponding to coefficients in SummedPauliOp")
.def_prop_ro(
"pauli_strings_as_str",
[](fp::SummedPauliOp<float_type> const &self) {
Expand All @@ -1038,7 +1038,7 @@ np.ndarray
[](fp::PauliString const &ps) { return fmt::format("{}", ps); });
return strings;
},
"List[str]: Ordered list of Pauli Strings representations from SummedPauliOp")
"List[str]: The list of Pauli Strings representations corresponding to coefficients from SummedPauliOp")

.def(
"apply",
Expand Down

0 comments on commit 2643be6

Please sign in to comment.