Skip to main content

ElementOp

Trait ElementOp 

Source
pub trait ElementOp<T>:
    Sealed
    + Copy
    + 'static
where T: NumericElement,
{ // Required methods unsafe fn apply<Arch>( self, a: <Arch as SimdKernel<T>>::Vector, b: <Arch as SimdKernel<T>>::Vector, ) -> <Arch as SimdKernel<T>>::Vector where Arch: SimdKernel<T>; fn apply_scalar(self, a: T, b: T) -> T; }
Expand description

Sealed ZST trait for pairwise SIMD elementwise operations.

Used by zip_reduce, zip_cow, and transform_in_place to parameterize binary vector operations without code duplication.

§Scalar Tail

apply_scalar(a, b) handles elements that do not fill a complete SIMD vector. Implementations use direct T: Scalar arithmetic so no vector load/store boundary conditions apply. The default does NOT exist — every impl must provide both apply (vector) and apply_scalar (scalar element).

Required Methods§

Source

unsafe fn apply<Arch>( self, a: <Arch as SimdKernel<T>>::Vector, b: <Arch as SimdKernel<T>>::Vector, ) -> <Arch as SimdKernel<T>>::Vector
where Arch: SimdKernel<T>,

Apply the operation to two vectors lane-wise.

Takes self by value — for ZSTs this is free; for Clamp it captures the bounds.

§Safety

Processor must support the target feature of Arch.

Source

fn apply_scalar(self, a: T, b: T) -> T

Apply the operation to two individual scalar elements.

Used for the SIMD tail (elements that do not fill a complete vector). Takes self by value — for ZSTs this is free; for Clamp it captures the bounds.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> ElementOp<T> for Add
where T: NumericElement,

Source§

impl<T> ElementOp<T> for BitAnd
where T: NumericElement,

Source§

impl<T> ElementOp<T> for BitOr
where T: NumericElement,

Source§

impl<T> ElementOp<T> for BitXor
where T: NumericElement,

Source§

impl<T> ElementOp<T> for Clamp<T>
where T: NumericElement + Copy,

Source§

impl<T> ElementOp<T> for Div
where T: NumericElement,

Source§

impl<T> ElementOp<T> for FmaAdd
where T: NumericElement,

Source§

impl<T> ElementOp<T> for Mul
where T: NumericElement,

Source§

impl<T> ElementOp<T> for Sub
where T: NumericElement,