Trait lance_linalg::simd::SIMD

source ·
pub trait SIMD<T: Num + Copy, const N: usize>: Debug + AddAssign<Self> + Add<Self, Output = Self> + Mul<Self, Output = Self> + Sub<Self, Output = Self> + SubAssign<Self> + Copy + Clone + Sized + for<'a> From<&'a [T]> + for<'a> From<&'a [T; N]> {
    const LANES: usize = N;

    // Required methods
    fn splat(val: T) -> Self;
    fn zeros() -> Self;
    unsafe fn load(ptr: *const T) -> Self;
    unsafe fn load_unaligned(ptr: *const T) -> Self;
    unsafe fn store(&self, ptr: *mut T);
    unsafe fn store_unaligned(&self, ptr: *mut T);
    fn reduce_sum(&self) -> T;
    fn reduce_min(&self) -> T;
    fn min(&self, rhs: &Self) -> Self;
    fn find(&self, val: T) -> Option<i32>;

    // Provided method
    fn as_array(&self) -> [T; N] { ... }
}
Expand description

Lance SIMD lib

Provided Associated Constants§

source

const LANES: usize = N

Required Methods§

source

fn splat(val: T) -> Self

Create a new instance with all lanes set to val.

source

fn zeros() -> Self

Create a new instance with all lanes set to zero.

source

unsafe fn load(ptr: *const T) -> Self

Gather elements from the slice, using i32 indices. Load aligned data from aligned memory.

Safety

It crashes if the ptr is not aligned.

source

unsafe fn load_unaligned(ptr: *const T) -> Self

Load unaligned data from memory.

Safety
source

unsafe fn store(&self, ptr: *mut T)

Store the values to aligned memory.

Safety

It crashes if the ptr is not aligned

source

unsafe fn store_unaligned(&self, ptr: *mut T)

Store the values to unaligned memory.

Safety
source

fn reduce_sum(&self) -> T

Calculate the sum across this vector.

source

fn reduce_min(&self) -> T

Find the minimal value in the vector.

source

fn min(&self, rhs: &Self) -> Self

Return the minimal value of these two vectors.

source

fn find(&self, val: T) -> Option<i32>

Find the index of value in the vector. If not found, return None.

Provided Methods§

source

fn as_array(&self) -> [T; N]

Return the values as an array.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl SIMD<f32, 8> for f32x8

source§

impl SIMD<f32, 16> for f32x16

source§

impl SIMD<i32, 8> for i32x8