Optimization in innermost loop in RT computation
|Status:||Rejected||Start date:||12 Dec 2016|
SpecularMatrix::calculateUpFromLayer contains an innermost loop.
For thick multilayer system with few scattering layers, this loop dominates the overall computation time. Therefore stringent optimization is in order.
- Precompute aux = std::exp(ix), and divide by aux instead
of multiplying with std::exp(-ix).
- Use exp_I(x) from Complex.h instead of exp(I*x)
- And most importantly, use bisection instead of linear search to determine from which layer the computation can be started without running into overflow.