Commit 32f63251 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

fixing bug in vqe kernel evaluation, where kernel has no params and vec is empty



Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 616280e5
Pipeline #103867 passed with stage
in 8 minutes and 9 seconds
......@@ -79,8 +79,12 @@ void VQE::execute(const std::shared_ptr<AcceleratorBuffer> buffer) const {
}
if (nFunctionInstructions > kernel->nInstructions()) {
auto evaled = f->operator()(x);
fsToExec.push_back(evaled);
if (x.empty()) {
fsToExec.push_back(f);
} else {
auto evaled = f->operator()(x);
fsToExec.push_back(evaled);
}
coefficients.push_back(std::real(coeff));
} else {
identityCoeff += std::real(coeff);
......@@ -160,8 +164,12 @@ VQE::execute(const std::shared_ptr<AcceleratorBuffer> buffer,
}
if (nFunctionInstructions > kernel->nInstructions()) {
auto evaled = f->operator()(x);
fsToExec.push_back(evaled);
if (x.empty()) {
fsToExec.push_back(f);
} else {
auto evaled = f->operator()(x);
fsToExec.push_back(evaled);
}
coefficients.push_back(std::real(coeff));
} else {
identityCoeff += std::real(coeff);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment