pub fn zip_update3_into<D, A, B, OpD, OpA, OpB>(
dest: &mut StridedViewMut<'_, D>,
a: &StridedView<'_, A, OpA>,
b: &StridedView<'_, B, OpB>,
f: impl Fn(D, A, B) -> D + MaybeSync,
) -> Result<()>where
D: Copy + MaybeSendSync,
A: Copy + MaybeSendSync,
B: Copy + MaybeSendSync,
OpD: ElementOp<D>,
OpA: ElementOp<A>,
OpB: ElementOp<B>,Expand description
Update in place from two inputs:
dest[i] = f(OpD(dest[i]), OpA(a[i]), OpB(b[i])).
§Errors
As zip_update2_into.
§Examples
use strided_basic::{zip_update3_into, Conj, Identity, StridedArray};
use num_complex::Complex64;
let one = Complex64::new(1.0, 1.0);
let a = StridedArray::<Complex64>::from_fn_col_major(&[2], |_| one);
let b = StridedArray::<Complex64>::from_fn_col_major(&[2], |_| one);
let mut d = StridedArray::<Complex64>::from_fn_col_major(&[2], |_| one);
// d = conj(d) + a * b
zip_update3_into::<_, _, _, Conj, Identity, Identity>(
&mut d.view_mut(), &a.view(), &b.view(), |d, a, b| d + a * b,
)
.unwrap();
assert_eq!(d.get(&[0]), Complex64::new(1.0, 1.0)); // (1 - i) + 2i