Commit 39a40764 authored by Médéric Boquien's avatar Médéric Boquien

A significant fraction of the total run time is spent computing integrals...

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.
parent 49bd0951
......@@ -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
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment