treams_core/coeffs/mod.rs
1//! Mie coefficients of multilayer chiral spheres and cylinders, and the materials they
2//! take.
3//!
4//! Upstream: `treams.coeffs`.
5//!
6//! | treams-rs | treams |
7//! |---|---|
8//! | [`mie`](fn@mie) | `coeffs.mie` |
9//! | [`mie_cyl`](fn@mie_cyl) | `coeffs.mie_cyl` |
10//! | [`smatrix::fresnel`](crate::smatrix::fresnel) | `coeffs.fresnel` |
11//! | [`Material`] | `treams.Material` |
12//! | [`Material::indices`], [`real_refractive_indices`] | `misc.refractive_index` |
13//!
14//! Each pullback runs on the calling thread and adds its terms in a fixed order, so
15//! the Rayon pool does not change the gradients.
16
17mod material;
18mod mie;
19mod mie_cyl;
20
21pub use material::{LayerGradient, Material, real_refractive_indices};
22pub(crate) use material::{validate_layer_tangents, validate_layers};
23pub(crate) use mie::to_mode_order;
24pub use mie::{MieGradient, MieResidual, mie};
25pub use mie_cyl::{MieCylGradient, MieCylResidual, mie_cyl};
26
27use nalgebra::SMatrix;
28
29use crate::Complex;
30
31/// A 2 x 2 matrix over the two polarizations.
32///
33/// [`mie`](fn@mie) and [`mie_cyl`](fn@mie_cyl) use helicity order (negative, positive), as
34/// `treams.coeffs.mie` does. T-matrix blocks swap both axes into mode order, which lists
35/// polarization index 1 first.
36pub type Matrix2 = SMatrix<Complex, 2, 2>;
37pub(crate) type Matrix4 = SMatrix<Complex, 4, 4>;
38pub(crate) type Matrix42 = SMatrix<Complex, 4, 2>;