Skip to main content

VectorReduce

Trait VectorReduce 

Source
pub trait VectorReduce<T: Scalar, const N: usize>: Vector<T, N> {
    // Provided methods
    fn horizontal_sum(&self) -> T { ... }
    fn horizontal_product(&self) -> T { ... }
    fn horizontal_min(&self) -> T { ... }
    fn horizontal_max(&self) -> T { ... }
    fn horizontal_mean(&self) -> T { ... }
}
Expand description

Horizontal reduction operations (vector → scalar).

Provided Methods§

Source

fn horizontal_sum(&self) -> T

Sum of all lanes.

Source

fn horizontal_product(&self) -> T

Product of all lanes.

Source

fn horizontal_min(&self) -> T

Minimum value across all lanes.

Source

fn horizontal_max(&self) -> T

Maximum value across all lanes.

Source

fn horizontal_mean(&self) -> T

Arithmetic mean of all lanes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Scalar, const N: usize, V: Vector<T, N>> VectorReduce<T, N> for V

Blanket implementation: every Vector gets reduce ops for free.

Uses element-wise extraction and accumulation. SIMD types may override individual methods with shuffle-based reductions for better performance.