Skip to main content

VectorReduce

Trait VectorReduce 

Source
pub trait VectorReduce<T, const N: usize>: Vector<T, N>
where T: Scalar,
{ // 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, const N: usize, V> VectorReduce<T, N> for V
where T: Scalar, V: Vector<T, N>,

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.