Skip to main content

ScatterScalar

Trait ScatterScalar 

Source
pub trait ScatterScalar:
    Sealed
    + Copy
    + Send
    + Sync {
    // Required method
    fn wrapping_add(self, rhs: Self) -> Self;
}
Expand description

Element types accepted by ScatterPlan::execute.

The trait is sealed: it is implemented for f32, f64, i32, i64, Complex32 and Complex64 (the dtypes the erased scatter entry dispatches) and cannot be implemented outside this crate. Its one method is the accumulating combine of additive scatter, so the typed and dtype-erased entries share the same element arithmetic.

Required Methods§

Source

fn wrapping_add(self, rhs: Self) -> Self

The additive-scatter combine, self + rhs.

Integer types wrap on overflow in every build profile (i32::wrapping_add, i64::wrapping_add); floating-point and complex types use IEEE addition, which has no overflow panic.

§Examples
use strided_basic::ScatterScalar;
assert_eq!(ScatterScalar::wrapping_add(i32::MAX, 1), i32::MIN);
assert_eq!(ScatterScalar::wrapping_add(1.5_f64, 2.0), 3.5);

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ScatterScalar for Complex32

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

impl ScatterScalar for Complex64

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

impl ScatterScalar for f32

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

impl ScatterScalar for f64

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

impl ScatterScalar for i32

Source§

fn wrapping_add(self, rhs: Self) -> Self

Source§

impl ScatterScalar for i64

Source§

fn wrapping_add(self, rhs: Self) -> Self

Implementors§