Skip to content

Commit

Permalink
Fixed VQE missing basis rotation caching in execute(buffer, vector)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Claudino <[email protected]>
  • Loading branch information
danclaudino committed Dec 10, 2024
1 parent 7d4fb9f commit 689ba43
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 689ba43

Please sign in to comment.