pub unsafe fn zip_map4_into_validated<D: Copy + MaybeSendSync, A: Copy + MaybeSendSync, B: Copy + MaybeSendSync, C: Copy + MaybeSendSync, E: Copy + MaybeSendSync, OpA: ElementOp<A>, OpB: ElementOp<B>, OpC: ElementOp<C>, OpE: ElementOp<E>>(
dest: &mut StridedViewMut<'_, D>,
a: &StridedView<'_, A, OpA>,
b: &StridedView<'_, B, OpB>,
c: &StridedView<'_, C, OpC>,
e: &StridedView<'_, E, OpE>,
f: impl Fn(A, B, C, E) -> D + MaybeSync,
validated: ValidatedDestinationLayout,
) -> Result<()>Expand description
Prevalidated zip map4 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_map4_into_validated(&mut dst.view_mut(), &src.view(), &src.view(), &src.view(), &src.view(), |a, b, c, d| a + b + c + d, checked) }.unwrap();
assert_eq!(dst.get(&[1]), 8.0);§Errors
Forwards errors from the owning kernel or callback; callers must still satisfy the safety contract before invoking this prevalidated entry.