Skip to main content

checked

Function checked 

Source
pub fn checked<P: Sync, O: Send>(
    points: &[P],
    options: &PrecisionOptions,
    run: impl Fn(&P, Precision) -> Result<O, GreenError> + Sync,
    distance: impl Fn(&O, &O) -> f64,
) -> (Vec<Result<O, GreenError>>, PrecisionReport)
Expand description

Runs run(point, precision) on every point, in parallel, in options.precision. In reduced precision, one point in options.every is recomputed in double precision and compared with distance; if one of them differs by more than options.tolerance, the whole batch is recomputed in double precision. Points that fail in reduced precision are computed in double precision. The checked points return their double-precision values.

ⓘ
let (t, report) = checked(&energies, &PrecisionOptions::single(), |&e, p| {
    sys.transmission_with_precision(&sys.self_energies(e)?, p)
}, |a, b| (a - b).abs());