1
0
forked from IPKM/nmreval

remove epsilons from integration, now 50% faster

This commit is contained in:
Dominik Demuth 2023-04-09 18:08:32 +02:00
parent 2c0cdfbd68
commit ee8ea4f2c5

View File

@ -19,7 +19,7 @@ class FFHS(Distribution):
def integrand(u, tt, tau0): def integrand(u, tt, tau0):
return FFHS.distribution(u, tau0) * np.exp(-tt/u) / u return FFHS.distribution(u, tau0) * np.exp(-tt/u) / u
ret_val = np.array([quad(integrand, 0, np.infty, args=(tt, tau0), epsabs=1e-12, epsrel=1e-12)[0] for tt in t]) ret_val = np.array([quad(integrand, 0, np.infty, args=(tt, tau0))[0] for tt in t])
return ret_val return ret_val
@ -29,7 +29,7 @@ class FFHS(Distribution):
return u**4 * tau0 / (81 + 9*u**2 - 2*u**4 + u**6) / (u**4 + (o*tau0)**2) return u**4 * tau0 / (81 + 9*u**2 - 2*u**4 + u**6) / (u**4 + (o*tau0)**2)
# return FFHS.distribution(u, tau0) * u / (1+o**2 * u**2) # return FFHS.distribution(u, tau0) * u / (1+o**2 * u**2)
ret_val = np.array([quad(integrand, 0, np.infty, args=(o, tau0), epsabs=1e-12, epsrel=1e-12)[0] for o in omega]) ret_val = np.array([quad(integrand, 0, np.infty, args=(o, tau0))[0] for o in omega])
return ret_val * 54 / np.pi return ret_val * 54 / np.pi
@ -41,11 +41,9 @@ class FFHS(Distribution):
def integrand_imag(u, o, tau0): def integrand_imag(u, o, tau0):
return FFHS.distribution(u, tau0) * o*u / (1+o**2 * u**2) return FFHS.distribution(u, tau0) * o*u / (1+o**2 * u**2)
ret_val = np.array([quad(integrand_real, 0, np.infty, args=(o, tau0), ret_val = np.array([quad(integrand_real, 0, np.infty, args=(o, tau0))[0] for o in omega], dtype=complex)
epsabs=1e-12, epsrel=1e-12)[0] for o in omega], dtype=complex)
ret_val.imag += np.array([quad(integrand_imag, 0, np.infty, args=(o, tau0), ret_val.imag += np.array([quad(integrand_imag, 0, np.infty, args=(o, tau0))[0] for o in omega])
epsabs=1e-12, epsrel=1e-12)[0] for o in omega])
return ret_val return ret_val