Commit c210d82c authored by Doak, Peter W.'s avatar Doak, Peter W.
Browse files

return throw behavior to function complex to real conversion.

don't enable 0 checking for space_to_momentum transforms, they are
problematic for single measurements and ctint.  (imaginary terms are
small but definitely bigger then epsilon ~1e-12
parent de680b5d
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -42,10 +42,9 @@ auto real(const function<std::complex<Scalartype>, Dmn>& f, const bool check_ima
  function<Scalartype, Dmn> f_real;

  for (int i = 0; i < f_real.size(); ++i) {
    if (check_imaginary && std::abs(f(i).imag()) > 500 * std::numeric_limits<Scalartype>::epsilon()) {
    if (check_imaginary && std::abs(f(i).imag()) > 1000 * std::numeric_limits<Scalartype>::epsilon()) {
      std::ostringstream err_msg;
      std::cerr << "Element: " << i << "  of the function has value " << f(i) << "which is not purely real.";
      //throw(std::logic_error(err_msg.str()));
      throw(std::logic_error(err_msg.str()));
    }
    f_real(i) = f(i).real();
  }
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ public:
      func::function<Real, func::dmn_variadic<NuDmn, NuDmn, KDmn, LastDmn>>& f_output) {
    func::function<Complex, func::dmn_variadic<NuDmn, NuDmn, KDmn, LastDmn>> f_out_cmplx;
    execute(f_input, f_out_cmplx);
    f_output = std::move(func::util::real(f_out_cmplx, true));
    f_output = std::move(func::util::real(f_out_cmplx, false));
  }

  // Default to old implementation when no band is present.