Improve performance in reflectometry engine
|Status:||Rejected||Start date:||30 Apr 2019|
Currently it uses backwards computation of reflection/transmission coefficients and the bisection to find the last layer with non-zero transmission.
My previous attempt to compute coefficients directly (from top to bottom) failed because of scheme instability.
Still getting rid of at least bisection would change the worst-case complexity of computation from N * log(N) to N, where N is the number of layers.
#4 Updated by rbeerwerth 3 months ago
This is completed in PR 911 (https://github.com/scgmlz/BornAgain/pull/911).
A test case that probes the numerical stability and sanity is added in PR 917 (https://github.com/scgmlz/BornAgain/pull/917)
In short: The computation is replaced with a backwards computation that renormalizes the computed amplitudes at every step.
At the end of the computation a second forward sweep is needed to consistently normalize all amplitudes.
For details, see section 3.2 of the description in theory/Roughness.pdf.
This approach now has a constant complexity of O(N).
Currently, I do not see a necessity for implementing a direct (top-to-bottom calculation).