Skip to content

Commit

Permalink
Merge pull request #59 from danclaudino/vqe_basis_rot_bugfix
Browse files Browse the repository at this point in the history
Fixed VQE missing basis rotation caching in execute(buffer, vector)
  • Loading branch information
danclaudino authored Dec 11, 2024
2 parents 83e5e16 + 689ba43 commit 8e4cba7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions quantum/plugins/algorithms/vqe/vqe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ VQE::execute(const std::shared_ptr<AcceleratorBuffer> buffer,
// circuits
if (cacheMeasurements) {

if (basisRotations.empty()) {
basisRotations = observable->getMeasurementBasisRotations();
}

nInstructionsEnergy = basisRotations.size() - 1;
for (auto it = basisRotations.begin(); it != basisRotations.end();) {

Expand Down Expand Up @@ -387,6 +391,7 @@ VQE::execute(const std::shared_ptr<AcceleratorBuffer> buffer,
} else {
accelerator->execute(tmpBuffer, fsToExec);
}

auto buffers = tmpBuffer->getChildren();
for (auto &b : buffers) {
b->addExtraInfo("parameters", x);
Expand Down

0 comments on commit 8e4cba7

Please sign in to comment.