Skip to main content

axpby_accum

Function axpby_accum 

Source
pub fn axpby_accum<T>(y: &mut [T], x: &[T], alpha: T, beta: T) -> Result<()>
where T: Copy + Send + Sync + Add<Output = T> + Mul<Output = T>,
Expand description

Update caller-owned contiguous storage: y = alpha * x + beta * y.

This is an accumulation operation: it reads the old y, even for beta=0 (including ordinary IEEE NaN propagation). No temporary tensor is allocated. Execution obeys the active execution policy and shared parallel threshold.

§Examples

let mut y = [3.0, 4.0];
strided_basic::axpby_accum(&mut y, &[1.0, 2.0], 2.0, 3.0).unwrap();
assert_eq!(y, [11.0, 16.0]);

§Errors

Returns ShapeMismatch for unequal slice lengths, before modifying y.