diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a8a39437daaf639e13304b07695a3d413a8727b..ca1826246042107436570cc7debca759328f0ae4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed ### Fixed ### Optimised +- A significant fraction of the total run time is spent computing integrals (e.g. fluxes in passbands). We can make the integration faster by rewriting the trapezoidal rule in terms of np.dot(). This allows to offload the computation to optimised libraries. The end result is that the integration is twice as fast, with a gain of ~10-15% on the total run time. (Médéric Boquien) ## 0.9.0 (2016-04-04) ### Added diff --git a/pcigale/sed/utils.py b/pcigale/sed/utils.py index d7f7c168a4eb47ee751028b274584d757aec503e..127fb1cb86a54dc21bf182e6757ecc6db78d784c 100644 --- a/pcigale/sed/utils.py +++ b/pcigale/sed/utils.py @@ -409,4 +409,4 @@ def flux_trapz(y, x, key): else: dx = np.diff(x) dx_cache[key] = dx - return (dx*(y[1:]+y[:-1])).sum()/2. + return np.dot(dx, y[1:]+y[:-1]) * .5