Better utilisation of lookup table in flatchamber higher order
In flatchamber.py
(and for that matterflatchamber.cc
), we have for calculation of higher order impedances the following loop structure (in pseudocode):
for plane in {0,1,2}:
for a, b, c, d all in range(order):
for m, n in mn(plane,a,b,c,d): # Technically its r and q, but they correspond to m and n
for frequency in frequency_range:
(reset lookup table)
alpha = alphamn(...) # function of m, n, frequency
(calculate impedance as function of everything above)
The important part is the reset of the lookup table. The lookup table is used to speed up calculations inside alphamn()
that are dependent on frequency but independent of m
, n
, a
, b
, c
, d
, and plane
. Since the frequency loop is now the innermost loop, the lookup table has to be reset for each iteration, and is therefore not used much. If the frequency loop can be moved to be the outermost loop, many more calculations could be done before needing to reset the lookup table, potentially providing a large speed boost.