pub fn replay_map_raw<D, S, F>(
dest: &mut RawStridedMut<'_, D>,
src: &RawStridedRef<'_, S>,
f: F,
exec: Exec<'_>,
) -> Result<()>Expand description
f(&mut dest[i], src[i]) for every element, replaying the axes of the two
views exactly as given.
Traversal, width and errors are those of replay_copy_raw, and so is the
allocation guarantee, which covers the replay only: allocations made by f
are its own. f runs once per logical element with exactly its arithmetic,
so an accumulate such as |d, s| *d += s is exact. The order in which
elements are visited is unspecified, and on a parallel replay f runs
concurrently on disjoint slots: the result is defined only for an f whose
effect depends on the supplied slot values alone. On a destination that is
not proven injective, the elements are visited serially in column-major
order of the given axes.
For an FnMut, or for element types that are not Send + Sync, use
replay_map_raw_serial.
§Errors
As replay_copy_raw.
§Examples
use strided_basic::{replay_map_raw, Exec, RawStridedMut, RawStridedRef};
let src = [1.0f64, 2.0, 3.0, 4.0];
let mut acc = [10.0f64, 20.0, 30.0, 40.0];
let source = RawStridedRef::new(&src, &[2, 2], &[2, 1], 0).unwrap();
let mut dst = RawStridedMut::new(&mut acc, &[2, 2], &[1, 2], 0).unwrap();
replay_map_raw(&mut dst, &source, |d, s| *d += s, Exec::serial()).unwrap();
assert_eq!(acc, [11.0, 23.0, 32.0, 44.0]);