yasfpy.matrix_apply#
Matrix-apply helpers for simulations.
This module contains functionality extracted from yasfpy.simulation.Simulation
related to applying the coupling operator W and the “master” operator
where T is the block-diagonal particle T-matrix (here: Mie coefficients for
spheres) and W encodes inter-particle translation/coupling.
The operator form and VSWF translation-based coupling are commonly used in multiple-sphere scattering formulations; see, for example, [Egel et al., 2017, Waterman, 1971].
Functions#
|
Apply the coupling operator |
|
Apply the master operator |
Module Contents#
- yasfpy.matrix_apply.coupling_matrix_multiply(sim, x, idx=None)#
Apply the coupling operator
W.- Parameters:
sim – Simulation instance providing a configured
coupling_backend.x – Input vector (flattened VSWF coefficients). The expected shape matches the backend: usually
(jmax,)for a single channel or(jmax, channels)for multi-wavelength runs.idx – Optional wavelength/channel index. Some backends use it to select a single channel without allocating a full multi-channel output.
- Returns:
The product
W @ x.- Return type:
Notes
If per-matvec timing is enabled (
sim._matvec_detail_enabled), this function records the elapsed time undersim._matvec_detail['coupling'].
- yasfpy.matrix_apply.master_matrix_multiply(sim, value, idx)#
Apply the master operator
M = I - T W.- Parameters:
sim – Simulation instance providing
mie_coefficientsandcoupling_backend.value – Input vector of unknowns at a given wavelength.
idx – Wavelength/channel index selecting the corresponding diagonal
Tblocks.
- Returns:
The product
(I - T W) @ value.- Return type:
Notes
The diagonal application of
Tis implemented by elementwise multiplication with the raveled Mie coefficient array. This corresponds to a block-diagonal T-matrix for independent spherical particles [Mishchenko, 2002, Bohren and Huffman, 1998].If per-matvec timing is enabled (
sim._matvec_detail_enabled), this function records the elapsed time undersim._matvec_detail['t_matrix'].