finesse.knm.integrators.compute_map_scattering_coeffs_riemann_optimised

finesse.knm.integrators.compute_map_scattering_coeffs_riemann_optimised(double dA, double complex[:, ::1] Z, double complex[:, :, ::1] Unn_, double complex[:, :, ::1] Umm_, double complex[:, :, ::1] tmp, double complex[:, :, :, ::1] result)

Calculates a mode scattering matrix using a Riemann sum. This method uses an computationally optimised approach making use of fast BLAS functions. This requires the input modes to be specified in specific formats and memory layouts. What this functions computes is the following via a Riemann sum:

\[K_{abnm} = \int^{\infty}_{-\infty} u_{m}(y,q^y_i) u^*_{b}(y,q^y_o) \Bigg[ \int^{\infty}_{-\infty} Z(x,y) u_{n}(x,q^x_i) u^*_{a}(x,q^x_o) \, dx \Bigg] \, dy \]

This integral is not actually performed to infinity, it is bound by the dimensions of the discretised map \(Z\). The map bound and uniform discretisation must be chosen to effciently sample the size of any of the beams and maximum mode order being used.

Due to the optimised calculation method, the result indexing is not [a,b,n,m] but [m,a,n,b]. To convert it back to a more usable indexing use:

>>> result = np.transpose(result, (2,1,0,3))
Parameters
dAdouble

Area of discrete integral, dx * dy

Zarray[complex]

2D map of size [Ny, Nx]

Unn_array[complex]

3D array of size [Nm, Nm, Nx]. This should contain the Un(x) * Un’(x)**C products

Umm_array[complex]

3D array of size [Nm, Nm, Ny]. This should contain the Um(x) * Um’(x)**C products

tmparray[complex]

Temporary storage that can be used to compute the dot products between Z and Unn_. Should be of size (Nm, Nm, Ny)

resultarray[complex]

Resulting Knmnm output of size [Nm, Nm, Nm, Nm]. IMPORTANT: Note output indexing of result K[m,a,n,b]

Notes

Nx - number of x samples Ny - number of y samples Nm - number of modes (n, m) being calculated