Commit e48a8085 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Fixes for QuaSiMo unit tests



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent 9f4ce0b3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -31,5 +31,6 @@ int main(int argc, char **argv) {

  const auto energy = result.get<double>("energy");
  std::cout << "Ground-state energy = " << energy << "\n";
  qcor_expect(std::abs(energy + 1.7487) < 0.1);
  return 0;
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ IterativeQpeWorkflow::constructQpeTrotterCircuit(
  auto ctrlKernel = std::dynamic_pointer_cast<xacc::CompositeInstruction>(
      xacc::getService<xacc::Instruction>("C-U"));
  ctrlKernel->expand({
      std::make_pair("U", trotterCir),
      std::make_pair("U", trotterCir->as_xacc()),
      std::make_pair("control-idx", static_cast<int>(ancBit)),
  });

+2 −1
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@ QaoaWorkflow::execute(const QuantumSimulationModel &model) {
      xacc::getService<xacc::Instruction>("qaoa"));
  qaoa_kernel->expand({{"nbQubits", model.observable->nBits()},
                       {"nbSteps", nbSteps},
                       {"cost-ham", model.observable},
                       {"cost-ham", std::dynamic_pointer_cast<xacc::Observable>(
                                        model.observable->get_as_opaque())},
                       {"parameter-scheme", parameterScheme}});
  evaluator = getEvaluator(model.observable, config_params);
  size_t nParams = qaoa_kernel->nVariables();
+3 −2
Original line number Diff line number Diff line
@@ -82,7 +82,8 @@ QuantumSimulationResult QiteWorkflow::execute(
  auto acc = xacc::internal_compiler::get_qpu();
  qite->initialize({{"accelerator", acc},
                    {"steps", nbSteps},
                    {"observable", observable},
                    {"observable", std::dynamic_pointer_cast<xacc::Observable>(
                                       observable->get_as_opaque())},
                    {"step-size", stepSize}});

  // Approximate imaginary-time Hamiltonian
@@ -183,7 +184,7 @@ QuantumSimulationResult QiteWorkflow::execute(
      constructPropagateCircuit(approxOps, model.user_defined_ansatz, stepSize);
  return {{"energy", energyAtStep.back()},
          {"exp-vals", energyAtStep},
          {"circuit", finalCircuit}};
          {"circuit", finalCircuit->as_xacc()}};
}
}  // namespace QuaSiMo
}  // namespace qcor
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ def main(argv=None):
    verbose=False
    keep_bit_code_files=False
    baseLibs = ['-rdynamic', '-Wl,-rpath,@XACC_ROOT@/lib:@CMAKE_INSTALL_PREFIX@/lib:@LLVM_INSTALL_PREFIX@/lib:@CMAKE_INSTALL_PREFIX@/clang-plugins',
                            '-L', '@CMAKE_INSTALL_PREFIX@/lib','-lqcor', '-lqrt', '-lqcor-jit',
                            '-L', '@CMAKE_INSTALL_PREFIX@/lib','-lqcor', '-lqrt', '-lqcor-jit', '-lqcor-quasimo',
                             '-L', '@XACC_ROOT@/lib', '-lxacc', '-lCppMicroServices', '-lxacc-quantum-gate',
                            '-lxacc-pauli', '-lxacc-fermion', '-lpthread']
    if '@CMAKE_SYSTEM_NAME@' != 'Darwin':