Skip to main content

uniaxial_reflectivity_batch

Function uniaxial_reflectivity_batch 

Source
pub fn uniaxial_reflectivity_batch(
    q: &[f64],
    layers: &[Vec<Layer>],
    tensor: &[Vec<Matrix3<Complex<f64>>>],
    energies_ev: &[f64],
) -> Result<UniaxialBatchOutput>
Expand description

GPU counterpart of refloxide_tmm::uniaxial::uniaxial_reflectivity_batch.

Inputs are validated with the CPU contract, packed into susceptibility records in f64, then explicitly narrowed to f32 for the device. The shader evaluates the decoupled uniaxial-z recursion, whose reflectance agrees with the f64 4x4 kernel to about 1e-4 relative in the worst validated case. Every stack must have the same number of layers.

Transmission is not computed: tran has the CPU layout but every entry is NaN + NaN i, so accidental use propagates visibly rather than silently. Cross-polarized reflectance entries are exactly zero.

ยงErrors

Shape and energy errors as for the CPU batch kernel, RefloxideError::InvalidShape for ragged layer counts, and RefloxideError::Gpu for device failures.