Struct extendr_api::prelude::utils::simd::SimdFor

pub struct SimdFor<E, S>
where E: Entity, S: Simd,
{ pub simd: S, __marker: PhantomData<E>, }
Expand description

Wrapper for simd operations for type E.

Fields§

§simd: S

Simd token.

§__marker: PhantomData<E>

Implementations§

§

impl<E, S> SimdFor<E, S>
where E: ComplexField, S: Simd,

pub fn new(simd: S) -> SimdFor<E, S>

Create a new wrapper from a simd token.

pub fn align_offset( self, slice: SliceGroup<'_, E>, ) -> Offset<<E as Entity>::SimdMask<S>>

Computes the alignment offset for subsequent aligned loads.

pub fn align_offset_ptr( self, ptr: <<E as Entity>::Group as ForType>::FaerOf<*const <E as Entity>::Unit>, len: usize, ) -> Offset<<E as Entity>::SimdMask<S>>

Computes the alignment offset for subsequent aligned loads from a pointer.

pub fn as_simd( self, slice: SliceGroup<'_, E>, ) -> (SliceGroup<'_, E, <E as Entity>::SimdUnit<S>>, SliceGroup<'_, E>)

Convert a slice to a slice over vector registers, and a scalar tail.

pub fn as_simd_mut( self, slice: SliceGroupMut<'_, E>, ) -> (SliceGroupMut<'_, E, <E as Entity>::SimdUnit<S>>, SliceGroupMut<'_, E>)

Convert a mutable slice to a slice over vector registers, and a scalar tail.

pub fn as_aligned_simd( self, slice: SliceGroup<'_, E>, offset: Offset<<E as Entity>::SimdMask<S>>, ) -> (Prefix<'_, E, S>, SliceGroup<'_, E, <E as Entity>::SimdUnit<S>>, Suffix<'_, E, S>)

Convert a slice to a partial register prefix and suffix, and a vector register slice (body).

pub fn as_aligned_simd_mut( self, slice: SliceGroupMut<'_, E>, offset: Offset<<E as Entity>::SimdMask<S>>, ) -> (PrefixMut<'_, E, S>, SliceGroupMut<'_, E, <E as Entity>::SimdUnit<S>>, SuffixMut<'_, E, S>)

Convert a mutable slice to a partial register prefix and suffix, and a vector register slice (body).

pub fn splat( self, value: E, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Fill all the register lanes with the same value.

pub fn scalar_mul(self, lhs: E, rhs: E) -> E

Returns lhs * rhs.

pub fn scalar_conj_mul(self, lhs: E, rhs: E) -> E

Returns conj(lhs) * rhs.

pub fn scalar_mul_add_e(self, lhs: E, rhs: E, acc: E) -> E

Returns an estimate of lhs * rhs + acc.

pub fn scalar_conj_mul_add_e(self, lhs: E, rhs: E, acc: E) -> E

Returns an estimate of conj(lhs) * rhs + acc.

pub fn scalar_conditional_conj_mul<C>(self, conj: C, lhs: E, rhs: E) -> E
where C: ConjTy,

Returns an estimate of op(lhs) * rhs, where op is either the conjugation or the identity operation.

pub fn scalar_conditional_conj_mul_add_e<C>( self, conj: C, lhs: E, rhs: E, acc: E, ) -> E
where C: ConjTy,

Returns an estimate of op(lhs) * rhs + acc, where op is either the conjugation or the identity operation.

pub fn add( self, lhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns lhs + rhs.

pub fn sub( self, lhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns lhs - rhs.

pub fn neg( self, a: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns -a.

pub fn scale_real( self, lhs: <<<E as ComplexField>::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<<E as ComplexField>::Real as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns lhs * rhs.

pub fn mul( self, lhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns lhs * rhs.

pub fn conj_mul( self, lhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns conj(lhs) * rhs.

pub fn conditional_conj_mul<C>( self, conj: C, lhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>
where C: ConjTy,

Returns op(lhs) * rhs, where op is either the conjugation or the identity operation.

pub fn mul_add_e( self, lhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, acc: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns lhs * rhs + acc.

pub fn conj_mul_add_e( self, lhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, acc: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns conj(lhs) * rhs + acc.

pub fn conditional_conj_mul_add_e<C>( self, conj: C, lhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, rhs: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, acc: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>
where C: ConjTy,

Returns op(lhs) * rhs + acc, where op is either the conjugation or the identity operation.

pub fn abs2_add_e( self, values: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, acc: <<<E as ComplexField>::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<<E as ComplexField>::Real as Entity>::SimdUnit<S>>, ) -> <<<E as ComplexField>::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<<E as ComplexField>::Real as Entity>::SimdUnit<S>>

Returns abs(values) * abs(values) + acc.

pub fn abs2( self, values: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<<E as ComplexField>::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<<E as ComplexField>::Real as Entity>::SimdUnit<S>>

Returns abs(values) * abs(values).

pub fn score( self, values: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<<E as ComplexField>::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<<E as ComplexField>::Real as Entity>::SimdUnit<S>>

Returns abs(values) or abs(values) * abs(values), whichever is cheaper to compute.

pub fn reduce_add( self, values: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> E

Sum the components of a vector register into a single accumulator.

pub fn rotate_left( self, values: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, amount: usize, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Rotate values to the left, with overflowing entries wrapping around to the right side of the register.

§

impl<E, S> SimdFor<E, S>
where E: RealField, S: Simd,

pub fn abs( self, values: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<<E as ComplexField>::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<<E as ComplexField>::Real as Entity>::SimdUnit<S>>

Returns abs(values).

pub fn less_than( self, a: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, b: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <E as Entity>::SimdMask<S>

Returns a < b.

pub fn less_than_or_equal( self, a: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, b: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <E as Entity>::SimdMask<S>

Returns a <= b.

pub fn greater_than( self, a: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, b: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <E as Entity>::SimdMask<S>

Returns a > b.

pub fn greater_than_or_equal( self, a: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, b: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <E as Entity>::SimdMask<S>

Returns a >= b.

pub fn select( self, mask: <E as Entity>::SimdMask<S>, if_true: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, if_false: <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>, ) -> <<E as Entity>::Group as ForCopyType>::FaerOfCopy<<E as Entity>::SimdUnit<S>>

Returns if mask { if_true } else { if_false }

pub fn index_select( self, mask: <E as Entity>::SimdMask<S>, if_true: <E as Entity>::SimdIndex<S>, if_false: <E as Entity>::SimdIndex<S>, ) -> <E as Entity>::SimdIndex<S>

Returns if mask { if_true } else { if_false }

pub fn index_seq(self) -> <E as Entity>::SimdIndex<S>

Returns [0, 1, 2, 3, ..., REGISTER_SIZE - 1]

pub fn index_splat( self, value: <E as Entity>::Index, ) -> <E as Entity>::SimdIndex<S>

Fill all the register lanes with the same value.

pub fn index_add( self, a: <E as Entity>::SimdIndex<S>, b: <E as Entity>::SimdIndex<S>, ) -> <E as Entity>::SimdIndex<S>

Returns a + b.

Trait Implementations§

§

impl<E, S> Clone for SimdFor<E, S>
where E: Entity, S: Simd,

§

fn clone(&self) -> SimdFor<E, S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<E, S> Copy for SimdFor<E, S>
where E: Entity, S: Simd,

Auto Trait Implementations§

§

impl<E, S> Freeze for SimdFor<E, S>
where S: Freeze,

§

impl<E, S> RefUnwindSafe for SimdFor<E, S>

§

impl<E, S> Send for SimdFor<E, S>

§

impl<E, S> Sync for SimdFor<E, S>

§

impl<E, S> Unpin for SimdFor<E, S>
where S: Unpin, E: Unpin,

§

impl<E, S> UnwindSafe for SimdFor<E, S>
where S: UnwindSafe, E: UnwindSafe,

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> 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<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.