pub unsafe fn zip_map3_into_validated<D, A, B, C, OpA, OpB, OpC>(
dest: &mut StridedViewMut<'_, D>,
a: &StridedView<'_, A, OpA>,
b: &StridedView<'_, B, OpB>,
c: &StridedView<'_, C, OpC>,
f: impl Fn(A, B, C) -> D + MaybeSync,
validated: ValidatedDestinationLayout,
) -> Result<(), StridedError>where
D: Copy + MaybeSendSync,
A: Copy + MaybeSendSync,
B: Copy + MaybeSendSync,
C: Copy + MaybeSendSync,
OpA: ElementOp<A>,
OpB: ElementOp<B>,
OpC: ElementOp<C>,Expand description
Prevalidated zip map3 into validated for kernel-family implementations.
§Safety
All input shapes must match the destination. validated must have been
obtained for this destination’s current geometry, proving injectivity;
possessing a marker from another layout is not sufficient. View/descriptor
bounds and aliasing contracts must continue to hold throughout replay.
§Examples
use strided_basic::execution::*;
// SAFETY: the example supplies matching bounded layouts and disjoint storage.
use strided_basic::StridedArray;
let src = StridedArray::<f64>::from_parts(vec![2.0; 2], &[2], &[1], 0).unwrap();
let mut dst = StridedArray::<f64>::col_major(&[2]);
let checked = validate_destination_layout_without_alloc(&[2], &[1]).unwrap();
unsafe { zip_map3_into_validated(&mut dst.view_mut(), &src.view(), &src.view(), &src.view(), |a, b, c| a + b + c, checked) }.unwrap();
assert_eq!(dst.get(&[1]), 6.0);§Errors
Forwards errors from the owning kernel or callback; callers must still satisfy the safety contract before invoking this prevalidated entry.