Skip to main content

uniaxial_reflectivity_points_jvp

Function uniaxial_reflectivity_points_jvp 

Source
pub fn uniaxial_reflectivity_points_jvp(
    q: &[f64],
    stack_of: &[usize],
    layers: &[Vec<Layer>],
    tensor: &[Vec<Matrix3<Complex<f64>>>],
    energies_ev: &[f64],
    tangents: &PointsTangents,
) -> Result<PointsJvpOutput>
Expand description

GPU counterpart of refloxide_tmm::uniaxial::uniaxial_reflectivity_points_jvp.

Values and tangents are narrowed to f32 on the device; derivatives are forward-mode exact for the single-precision recursion, so their relative accuracy matches the reflectance (about 1e-4 worst case) instead of suffering finite-difference cancellation. All (direction, point) pairs run in one dispatch. Every stack must have the same number of layers.

ยงErrors

As for the CPU JVP kernel, RefloxideError::InvalidShape for ragged layer counts, and RefloxideError::Gpu for device failures.