Skip to content

Commit

Permalink
Reduce looping redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Jun 5, 2024
1 parent 295dd34 commit fee8a54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pennylane_qrack/qrack_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,11 +804,11 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
for (auto q_samplesIter = q_samples.begin(); q_samplesIter != q_samples.end(); ++q_samplesIter) {
bitCapInt sample = q_samplesIter->first;
int shots = q_samplesIter->second;
std::bitset<1U << QBCAPPOW> basisState;
for (size_t wire = 0; wire < numQubits; wire++) {
basisState[wire] = bi_compare_0((sample >> wire) & 1U);
}
for (; shots > 0; --shots) {
std::bitset<1U << QBCAPPOW> basisState;
for (size_t wire = 0; wire < numQubits; wire++) {
basisState[wire] = bi_compare_0((sample >> wire) & 1U);
}
++counts(static_cast<size_t>(basisState.to_ulong()));
}
}
Expand Down

0 comments on commit fee8a54

Please sign in to comment.