Skip to main content

SlicePair

Struct SlicePair 

Source
pub struct SlicePair<'a, T>(pub &'a [T], pub &'a [T]);
Expand description

A pair of immutable slices, providing SIMD-accelerated element-wise binary operations that write the result into a pre-allocated output buffer.

§Example

use rill_core::math::vector::ops::SlicePair;
use rill_core::prelude::ScalarVector4;

let a = [1.0f32, 2.0, 3.0, 4.0];
let b = [5.0f32, 6.0, 7.0, 8.0];
let mut out = [0.0f32; 4];

SlicePair::new(&a, &b).add_into::<4, ScalarVector4<f32>>(&mut out);
assert_eq!(out, [6.0, 8.0, 10.0, 12.0]);

Tuple Fields§

§0: &'a [T]§1: &'a [T]

Implementations§

Source§

impl<'a, T: Transcendental> SlicePair<'a, T>

Source

pub fn new(a: &'a [T], b: &'a [T]) -> Self

Create a new pair from two slices.

Source

pub fn add_into<const N: usize, V: Vector<T, N>>(self, out: &mut [T])

Element-wise addition: out[i] = a[i] + b[i].

Source

pub fn sub_into<const N: usize, V: Vector<T, N>>(self, out: &mut [T])

Element-wise subtraction: out[i] = a[i] - b[i].

Source

pub fn mul_into<const N: usize, V: Vector<T, N>>(self, out: &mut [T])

Element-wise multiplication: out[i] = a[i] * b[i].

Source

pub fn div_into<const N: usize, V: Vector<T, N>>(self, out: &mut [T])

Element-wise division: out[i] = a[i] / b[i].

Source

pub fn rem_into<const N: usize, V: Vector<T, N>>(self, out: &mut [T])

Element-wise remainder: out[i] = a[i] % b[i].

Auto Trait Implementations§

§

impl<'a, T> Freeze for SlicePair<'a, T>

§

impl<'a, T> RefUnwindSafe for SlicePair<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for SlicePair<'a, T>
where T: Sync,

§

impl<'a, T> Sync for SlicePair<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for SlicePair<'a, T>

§

impl<'a, T> UnsafeUnpin for SlicePair<'a, T>

§

impl<'a, T> UnwindSafe for SlicePair<'a, T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V