[][src]Trait generic_simd::vector::Vector

pub unsafe trait Vector: Copy {
    type Scalar: Copy;
    type Token: Token;
    type Width: Width;
    type Underlying: Copy;
    fn zeroed(token: Self::Token) -> Self;
fn splat(token: Self::Token, from: Self::Scalar) -> Self; fn width() -> usize { ... }
fn to_token(self) -> Self::Token { ... }
fn as_slice(&self) -> &[Self::Scalar] { ... }
fn as_slice_mut(&mut self) -> &mut [Self::Scalar] { ... }
fn to_underlying(self) -> Self::Underlying { ... }
fn from_underlying(token: Self::Token, underlying: Self::Underlying) -> Self { ... }
unsafe fn read_ptr(token: Self::Token, from: *const Self::Scalar) -> Self { ... }
unsafe fn read_aligned_ptr(
        token: Self::Token,
        from: *const Self::Scalar
    ) -> Self { ... }
unsafe fn read_unchecked(token: Self::Token, from: &[Self::Scalar]) -> Self { ... }
fn read(token: Self::Token, from: &[Self::Scalar]) -> Self { ... }
unsafe fn write_ptr(self, to: *mut Self::Scalar) { ... }
unsafe fn write_aligned_ptr(self, to: *mut Self::Scalar) { ... }
unsafe fn write_unchecked(self, to: &mut [Self::Scalar]) { ... }
fn write(self, to: &mut [Self::Scalar]) { ... } }

The fundamental vector type.

Safety

This trait may only be implemented for types that have the memory layout of an array of Scalar with length width().

Associated Types

type Scalar: Copy

The type of elements in the vector.

type Token: Token

The token that proves support for this vector on the CPU.

type Width: Width

The number of elements in the vector.

type Underlying: Copy

The underlying type

Loading content...

Required methods

fn zeroed(token: Self::Token) -> Self

Create a new vector with each lane containing zeroes.

fn splat(token: Self::Token, from: Self::Scalar) -> Self

Create a new vector with each lane containing the provided value.

Loading content...

Provided methods

fn width() -> usize

Returns the number of lanes.

fn to_token(self) -> Self::Token

Creates a new instance of Token from a vector.

fn as_slice(&self) -> &[Self::Scalar]

Returns a slice containing the vector.

fn as_slice_mut(&mut self) -> &mut [Self::Scalar]

Returns a mutable slice containing the vector.

fn to_underlying(self) -> Self::Underlying

Converts this vector to its underlying type.

fn from_underlying(token: Self::Token, underlying: Self::Underlying) -> Self

Converts the underlying type to a vector.

unsafe fn read_ptr(token: Self::Token, from: *const Self::Scalar) -> Self

Read from a pointer.

Safety

  • from must point to an array of length at least width().

unsafe fn read_aligned_ptr(
    token: Self::Token,
    from: *const Self::Scalar
) -> Self

Read from a vector-aligned pointer.

Safety

  • from must point to an array of length at least width().
  • from must be aligned for the vector type.

unsafe fn read_unchecked(token: Self::Token, from: &[Self::Scalar]) -> Self

Read from a vector-aligned pointer. Read from a slice without checking the length.

Safety

  • from be length at least width().

fn read(token: Self::Token, from: &[Self::Scalar]) -> Self

Read from a slice.

Panic

Panics if the length of from is less than width().

unsafe fn write_ptr(self, to: *mut Self::Scalar)

Write to a pointer.

Safety

from must point to an array of length at least width()

unsafe fn write_aligned_ptr(self, to: *mut Self::Scalar)

Write to a pointer.

Safety

from must point to an array of length at least width() from must be aligned for the vector type.

unsafe fn write_unchecked(self, to: &mut [Self::Scalar])

Write to a slice without checking the length.

Safety

from must be length at least width().

fn write(self, to: &mut [Self::Scalar])

Write to a slice.

Panics

Panics if the length of from is less than width().

Loading content...

Implementors

impl Vector for cf32x1[src]

type Scalar = Complex<f32>

type Token = Generic

type Width = W1

type Underlying = Complex<f32>

impl Vector for generic_simd::arch::generic::cf64x1[src]

type Scalar = Complex<f64>

type Token = Generic

type Width = W1

type Underlying = Complex<f64>

impl Vector for f32x1[src]

type Scalar = f32

type Token = Generic

type Width = W1

type Underlying = f32

impl Vector for f64x1[src]

type Scalar = f64

type Token = Generic

type Width = W1

type Underlying = f64

impl Vector for cf32x2[src]

type Scalar = Complex<f32>

type Token = Sse

type Width = W2

type Underlying = __m128

impl Vector for cf32x4[src]

type Scalar = Complex<f32>

type Token = Avx

type Width = W4

type Underlying = __m256

impl Vector for generic_simd::arch::x86::cf64x1[src]

type Scalar = Complex<f64>

type Token = Sse

type Width = W1

type Underlying = __m128d

impl Vector for cf64x2[src]

type Scalar = Complex<f64>

type Token = Avx

type Width = W2

type Underlying = __m256d

impl Vector for f32x4[src]

type Scalar = f32

type Token = Sse

type Width = W4

type Underlying = __m128

impl Vector for f32x8[src]

type Scalar = f32

type Token = Avx

type Width = W8

type Underlying = __m256

impl Vector for f64x2[src]

type Scalar = f64

type Token = Sse

type Width = W2

type Underlying = __m128d

impl Vector for f64x4[src]

type Scalar = f64

type Token = Avx

type Width = W4

type Underlying = __m256d

impl<Underlying, Scalar> Vector for Shim2<Underlying, Scalar> where
    Underlying: Vector<Scalar = Scalar>,
    Underlying::Width: Double,
    Scalar: Copy
[src]

type Scalar = Scalar

type Token = <Underlying as Vector>::Token

type Width = <Underlying::Width as Double>::Doubled

type Underlying = [<Underlying as Vector>::Underlying; 2]

impl<Underlying, Scalar, Token> Vector for ShimToken<Underlying, Scalar, Token> where
    Underlying: Vector<Scalar = Scalar>,
    Scalar: Copy,
    Token: Token + Into<<Underlying as Vector>::Token>, 
[src]

type Scalar = Scalar

type Token = Token

type Width = <Underlying as Vector>::Width

type Underlying = <Underlying as Vector>::Underlying

Loading content...