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

Fixes a bug when compiling with AppleClang



LLVM doesn't gracefully handle 0/0 as gcc :(

Also, using std::map for PauliOp::terms (XACC update)

Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent 7ca4bdbe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -291,7 +291,8 @@ double PhaseEstimationObjFuncEval::evaluate(
    for (const auto &[ampl, phase] : pronyFit) {
      const double freq = -std::arg(phase) * SAMPLING_FREQ;
      // Normalize
      const double amplitude = std::abs(ampl) / sumA;
      const bool isZeroOverZero = (std::abs(sumA) < 1e-12) && (std::abs(ampl) < 1e-12);
      const double amplitude = isZeroOverZero ? 1.0 : std::abs(ampl) / sumA;
      xacc::info("A = " + std::to_string(amplitude) +
                 "; Freq = " + std::to_string(freq));
      // Generic expectation value estimation (Eq. 22)
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ class NISQ : public ::quantum::QuantumRuntime {

  void exp(qreg q, const double theta,
           std::shared_ptr<xacc::Observable> Hptr_input) override {
    std::unordered_map<std::string, xacc::quantum::Term> terms;
    std::map<std::string, xacc::quantum::Term> terms;

    auto obs_str = Hptr_input->toString();
    auto fermi_to_pauli = xacc::getService<xacc::ObservableTransform>("jw");