Python API¶
Each public module of treams_rs has one page with the signature and
docstring of every name it exports. Classes list their methods and
attributes, including those inherited from other treams-rs classes.
A Pullback line names the method of the returned context that turns the gradient of a real loss with respect to the output into gradients with respect to the inputs (see the glossary).
| Module | Summary |
|---|---|
treams_rs |
T-matrix scattering with Rust numerics and analytic first-order derivatives. |
treams_rs.special |
Special functions of multipole waves, with NumPy broadcasting. |
treams_rs.sw |
Coefficients of spherical waves: translation, rotation and periodic arrays. |
treams_rs.cw |
Coefficients of cylindrical waves: translation, rotation and periodic arrays. |
treams_rs.pw |
Coefficients of plane waves: translation, expansion and axis permutation. |
treams_rs.lattice |
Lattice sums of spherical and cylindrical waves, and lattice geometry. |
treams_rs.coeffs |
Mie and Fresnel coefficients in the helicity basis. |
treams_rs.misc |
Refractive indices, normal wavenumbers, mode selection and Brillouin zones. |
treams_rs.ebcm |
Surface integrals of the extended boundary condition method (EBCM). |
treams_rs.io |
T-matrix files in the tmat.h5 layout, and Gmsh meshes of sphere clusters. |
treams_rs.operators |
Basis and field operators, as functions and as operator objects. |
treams_rs.iterative |
Matrix-free scattering by finite clusters of homogeneous spheres in vacuum. |
treams_rs.parallel |
CPU threads of the native numerical work. |
treams_rs.diff |
Records: values with analytic first-order pushforward and pullback contexts. |
treams_rs.testing |
Finite-difference checks of first-order gradients, pullbacks and pushforwards. |
treams_rs.advect |
Advect adapter: physics objects and records differentiated by Advect, on the CPU and in first-order forward and reverse mode. |
treams_rs.jax |
JAX adapter: physics objects and records on the CPU with first-order forward and reverse mode, jit and sequential vmap. |
treams_rs.torch |
PyTorch adapter: physics objects and records as autograd operations on the CPU, in first-order forward and reverse mode. |
treams_rs.autograd |
HIPS Autograd adapter: physics objects and native records on the CPU. |
Returned types lists the objects that records and solvers return.
How native calls run¶
- numeric_precision: native float64 / complex128; framework outputs follow adapter precision; metadata uses integer and boolean arrays
- native_pairing: dL = Re(sum(conj(g) * dx))
- derivative_order: 1
- static_parameters: mode counts, integer labels, topology; see each operation's docstring
- context_lifetime: Native recorded contexts are reusable: pushforwards and pullbacks share immutable residuals.
- python_execution: CPU
Backend cpu: precision float64, complex128.
support_catalog() and python -m treams_rs --format json report the
installed optional frameworks. An installed framework does not mean
that treams-rs supports its devices: every adapter runs on the CPU.