Skip to main content

add_assign

Function add_assign 

Source
pub fn add_assign<T>(backend: ComputeBackend, y: &mut Field<T>, x: &Field<T>)
where T: Copy + Send + Sync + Add<Output = T>,
Expand description

In-place accumulation y[i] += x[i].

Allocation-free — the preferred form inside a timestep loop, where the out-of-place add allocates a fresh Vec every call.

Units: y and x are the same physical quantity.

§Panics

Panics if y.len() != x.len().