Skip to main content

cumsum

Function cumsum 

Source
pub fn cumsum<B: Backend, T: Numeric>(
    x: &Array<B, T>,
    axis: usize,
    reverse: bool,
) -> Array<B, T>
Expand description

The cumulative sum along axis (lax.cumsum), from the end with reverse. Integers wrap around.

ยงExamples

use ruxla_core::{Array, Native, lax};

let x = Array::<Native, i32>::from_vec(vec![1, 2, 3, 4], [4]);
assert_eq!(lax::cumsum(&x, 0, false).to_vec(), [1, 3, 6, 10]);
assert_eq!(lax::cumsum(&x, 0, true).to_vec(), [10, 9, 7, 4]);