Type Definition packed_simd::f32x2

source ·
pub type f32x2 = Simd<[f32; 2]>;
Expand description

A 64-bit vector with 2 f32 lanes.

Implementations§

source§

impl f32x2

source

pub const fn new(x0: f32, x1: f32) -> Self

Creates a new instance with each vector elements initialized with the provided values.

source

pub const fn lanes() -> usize

Returns the number of vector lanes.

source

pub const fn splat(value: f32) -> Self

Constructs a new instance with each element initialized to value.

source

pub fn extract(self, index: usize) -> f32

Extracts the value at index.

Panics

If index >= Self::lanes().

source

pub unsafe fn extract_unchecked(self, index: usize) -> f32

Extracts the value at index.

Safety

If index >= Self::lanes() the behavior is undefined.

source

pub fn replace(self, index: usize, new_value: f32) -> Self

Returns a new vector where the value at index is replaced by new_value.

Panics

If index >= Self::lanes().

source

pub unsafe fn replace_unchecked(self, index: usize, new_value: f32) -> Self

Returns a new vector where the value at index is replaced by new_value.

Safety

If index >= Self::lanes() the behavior is undefined.

source§

impl f32x2

source

pub fn min(self, x: Self) -> Self

Minimum of two vectors.

Returns a new vector containing the minimum value of each of the input vector lanes.

source

pub fn max(self, x: Self) -> Self

Maximum of two vectors.

Returns a new vector containing the maximum value of each of the input vector lanes.

source§

impl f32x2

source

pub fn sum(self) -> f32

Horizontal sum of the vector elements.

The intrinsic performs a tree-reduction of the vector elements. That is, for an 8 element vector:

((x0 + x1) + (x2 + x3)) + ((x4 + x5) + (x6 + x7))

If one of the vector element is NaN the reduction returns NaN. The resulting NaN is not required to be equal to any of the NaNs in the vector.

source

pub fn product(self) -> f32

Horizontal product of the vector elements.

The intrinsic performs a tree-reduction of the vector elements. That is, for an 8 element vector:

((x0 * x1) * (x2 * x3)) * ((x4 * x5) * (x6 * x7))

If one of the vector element is NaN the reduction returns NaN. The resulting NaN is not required to be equal to any of the NaNs in the vector.

source§

impl f32x2

source

pub fn max_element(self) -> f32

Largest vector element value.

source

pub fn min_element(self) -> f32

Smallest vector element value.

source§

impl f32x2

source

pub fn from_slice_aligned(slice: &[f32]) -> Self

Instantiates a new vector with the values of the slice.

Panics

If slice.len() < Self::lanes() or &slice[0] is not aligned to an align_of::<Self>() boundary.

source

pub fn from_slice_unaligned(slice: &[f32]) -> Self

Instantiates a new vector with the values of the slice.

Panics

If slice.len() < Self::lanes().

source

pub unsafe fn from_slice_aligned_unchecked(slice: &[f32]) -> Self

Instantiates a new vector with the values of the slice.

Safety

If slice.len() < Self::lanes() or &slice[0] is not aligned to an align_of::<Self>() boundary, the behavior is undefined.

source

pub unsafe fn from_slice_unaligned_unchecked(slice: &[f32]) -> Self

Instantiates a new vector with the values of the slice.

Safety

If slice.len() < Self::lanes() the behavior is undefined.

source§

impl f32x2

source

pub fn write_to_slice_aligned(self, slice: &mut [f32])

Writes the values of the vector to the slice.

Panics

If slice.len() < Self::lanes() or &slice[0] is not aligned to an align_of::<Self>() boundary.

source

pub fn write_to_slice_unaligned(self, slice: &mut [f32])

Writes the values of the vector to the slice.

Panics

If slice.len() < Self::lanes().

source

pub unsafe fn write_to_slice_aligned_unchecked(self, slice: &mut [f32])

Writes the values of the vector to the slice.

Safety

If slice.len() < Self::lanes() or &slice[0] is not aligned to an align_of::<Self>() boundary, the behavior is undefined.

source

pub unsafe fn write_to_slice_unaligned_unchecked(self, slice: &mut [f32])

Writes the values of the vector to the slice.

Safety

If slice.len() < Self::lanes() the behavior is undefined.

source§

impl f32x2

source

pub fn shuffle1_dyn<I>(self, indices: I) -> Selfwhere Self: Shuffle1Dyn<Indices = I>,

Shuffle vector elements according to indices.

source§

impl f32x2

source

pub const EPSILON: f32x2 = _

Machine epsilon value.

source

pub const MIN: f32x2 = _

Smallest finite value.

source

pub const MIN_POSITIVE: f32x2 = _

Smallest positive normal value.

source

pub const MAX: f32x2 = _

Largest finite value.

source

pub const NAN: f32x2 = _

Not a Number (NaN).

source

pub const INFINITY: f32x2 = _

Infinity (∞).

source

pub const NEG_INFINITY: f32x2 = _

Negative infinity (-∞).

source

pub const PI: f32x2 = _

Archimedes’ constant (π)

source

pub const FRAC_PI_2: f32x2 = _

π/2

source

pub const FRAC_PI_3: f32x2 = _

π/3

source

pub const FRAC_PI_4: f32x2 = _

π/4

source

pub const FRAC_PI_6: f32x2 = _

π/6

source

pub const FRAC_PI_8: f32x2 = _

π/8

source

pub const FRAC_1_PI: f32x2 = _

1/π

source

pub const FRAC_2_PI: f32x2 = _

2/π

source

pub const FRAC_2_SQRT_PI: f32x2 = _

2/sqrt(π)

source

pub const SQRT_2: f32x2 = _

sqrt(2)

source

pub const FRAC_1_SQRT_2: f32x2 = _

1/sqrt(2)

source

pub const E: f32x2 = _

Euler’s number (e)

source

pub const LOG2_E: f32x2 = _

log2(e)

source

pub const LOG10_E: f32x2 = _

log10(e)

source

pub const LN_2: f32x2 = _

ln(2)

source

pub const LN_10: f32x2 = _

ln(10)

source§

impl f32x2

source

pub fn is_nan(self) -> m32x2

source

pub fn is_infinite(self) -> m32x2

source

pub fn is_finite(self) -> m32x2

source§

impl f32x2

source

pub fn abs(self) -> Self

Absolute value.

source§

impl f32x2

source

pub fn cos(self) -> Self

Cosine.

source

pub fn cos_pi(self) -> Self

Cosine of self * PI.

source§

impl f32x2

source

pub fn exp(self) -> Self

Returns the exponential function of self: e^(self).

source§

impl f32x2

source

pub fn ln(self) -> Self

Returns the natural logarithm of self.

source§

impl f32x2

source

pub fn mul_add(self, y: Self, z: Self) -> Self

Fused multiply add: self * y + z

source§

impl f32x2

source

pub fn mul_adde(self, y: Self, z: Self) -> Self

Fused multiply add estimate: ~= self * y + z

While fused multiply-add (fma) has infinite precision, mul_adde has at worst the same precision of a multiply followed by an add. This might be more efficient on architectures that do not have an fma instruction.

source§

impl f32x2

source

pub fn powf(self, x: Self) -> Self

Raises self number to the floating point power of x.

source§

impl f32x2

source

pub fn recpre(self) -> Self

Reciprocal estimate: ~= 1. / self.

FIXME: The precision of the estimate is currently unspecified.

source§

impl f32x2

source

pub fn rsqrte(self) -> Self

Reciprocal square-root estimate: ~= 1. / self.sqrt().

FIXME: The precision of the estimate is currently unspecified.

source§

impl f32x2

source

pub fn sin(self) -> Self

Sine.

source

pub fn sin_pi(self) -> Self

Sine of self * PI.

source

pub fn sin_cos_pi(self) -> (Self, Self)

Sine and cosine of self * PI.

source§

impl f32x2

source

pub fn sqrt(self) -> Self

source§

impl f32x2

source

pub fn sqrte(self) -> Self

Square-root estimate.

FIXME: The precision of the estimate is currently unspecified.

source§

impl f32x2

source

pub fn tanh(self) -> Self

Tanh.

source§

impl f32x2

source

pub fn eq(self, other: Self) -> m32x2

Lane-wise equality comparison.

source

pub fn ne(self, other: Self) -> m32x2

Lane-wise inequality comparison.

source

pub fn lt(self, other: Self) -> m32x2

Lane-wise less-than comparison.

source

pub fn le(self, other: Self) -> m32x2

Lane-wise less-than-or-equals comparison.

source

pub fn gt(self, other: Self) -> m32x2

Lane-wise greater-than comparison.

source

pub fn ge(self, other: Self) -> m32x2

Lane-wise greater-than-or-equals comparison.

Trait Implementations§

source§

impl Add<Simd<[f32; 2]>> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl Add<f32> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the + operator.
source§

fn add(self, other: f32) -> Self

Performs the + operation. Read more
source§

impl AddAssign<Simd<[f32; 2]>> for f32x2

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl AddAssign<f32> for f32x2

source§

fn add_assign(&mut self, other: f32)

Performs the += operation. Read more
source§

impl Debug for f32x2

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for f32x2

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Div<Simd<[f32; 2]>> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
source§

impl Div<f32> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the / operator.
source§

fn div(self, other: f32) -> Self

Performs the / operation. Read more
source§

impl DivAssign<Simd<[f32; 2]>> for f32x2

source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
source§

impl DivAssign<f32> for f32x2

source§

fn div_assign(&mut self, other: f32)

Performs the /= operation. Read more
source§

impl From<[f32; 2]> for f32x2

source§

fn from(array: [f32; 2]) -> Self

Converts to this type from the input type.
source§

impl From<Simd<[i16; 2]>> for f32x2

source§

fn from(source: i16x2) -> Self

Converts to this type from the input type.
source§

impl From<Simd<[i8; 2]>> for f32x2

source§

fn from(source: i8x2) -> Self

Converts to this type from the input type.
source§

impl From<Simd<[u16; 2]>> for f32x2

source§

fn from(source: u16x2) -> Self

Converts to this type from the input type.
source§

impl From<Simd<[u8; 2]>> for f32x2

source§

fn from(source: u8x2) -> Self

Converts to this type from the input type.
source§

impl FromBits<Simd<[i16; 4]>> for f32x2

source§

fn from_bits(x: i16x4) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromBits<Simd<[i32; 2]>> for f32x2

source§

fn from_bits(x: i32x2) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromBits<Simd<[i8; 8]>> for f32x2

source§

fn from_bits(x: i8x8) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromBits<Simd<[m16; 4]>> for f32x2

source§

fn from_bits(x: m16x4) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromBits<Simd<[m32; 2]>> for f32x2

source§

fn from_bits(x: m32x2) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromBits<Simd<[m8; 8]>> for f32x2

source§

fn from_bits(x: m8x8) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromBits<Simd<[u16; 4]>> for f32x2

source§

fn from_bits(x: u16x4) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromBits<Simd<[u32; 2]>> for f32x2

source§

fn from_bits(x: u32x2) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromBits<Simd<[u8; 8]>> for f32x2

source§

fn from_bits(x: u8x8) -> Self

Available on crate feature into_bits only.
Safe lossless bitwise transmute from T to Self.
source§

impl FromCast<Simd<[f64; 2]>> for f32x2

source§

fn from_cast(x: f64x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[i128; 2]>> for f32x2

source§

fn from_cast(x: i128x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[i16; 2]>> for f32x2

source§

fn from_cast(x: i16x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[i32; 2]>> for f32x2

source§

fn from_cast(x: i32x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[i64; 2]>> for f32x2

source§

fn from_cast(x: i64x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[i8; 2]>> for f32x2

source§

fn from_cast(x: i8x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[isize; 2]>> for f32x2

source§

fn from_cast(x: isizex2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[m128; 2]>> for f32x2

source§

fn from_cast(x: m128x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[m16; 2]>> for f32x2

source§

fn from_cast(x: m16x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[m32; 2]>> for f32x2

source§

fn from_cast(x: m32x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[m64; 2]>> for f32x2

source§

fn from_cast(x: m64x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[m8; 2]>> for f32x2

source§

fn from_cast(x: m8x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[msize; 2]>> for f32x2

source§

fn from_cast(x: msizex2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[u128; 2]>> for f32x2

source§

fn from_cast(x: u128x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[u16; 2]>> for f32x2

source§

fn from_cast(x: u16x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[u32; 2]>> for f32x2

source§

fn from_cast(x: u32x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[u64; 2]>> for f32x2

source§

fn from_cast(x: u64x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[u8; 2]>> for f32x2

source§

fn from_cast(x: u8x2) -> Self

Numeric cast from T to Self.
source§

impl FromCast<Simd<[usize; 2]>> for f32x2

source§

fn from_cast(x: usizex2) -> Self

Numeric cast from T to Self.
source§

impl Mul<Simd<[f32; 2]>> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
source§

impl Mul<f32> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the * operator.
source§

fn mul(self, other: f32) -> Self

Performs the * operation. Read more
source§

impl MulAssign<Simd<[f32; 2]>> for f32x2

source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
source§

impl MulAssign<f32> for f32x2

source§

fn mul_assign(&mut self, other: f32)

Performs the *= operation. Read more
source§

impl Neg for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl PartialEq<Simd<[f32; 2]>> for f32x2

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
source§

fn ne(&self, other: &Self) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Product<&'a Simd<[f32; 2]>> for f32x2

source§

fn product<I: Iterator<Item = &'a f32x2>>(iter: I) -> f32x2

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Product<Simd<[f32; 2]>> for f32x2

source§

fn product<I: Iterator<Item = f32x2>>(iter: I) -> f32x2

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Rem<Simd<[f32; 2]>> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the % operator.
source§

fn rem(self, other: Self) -> Self

Performs the % operation. Read more
source§

impl Rem<f32> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the % operator.
source§

fn rem(self, other: f32) -> Self

Performs the % operation. Read more
source§

impl RemAssign<Simd<[f32; 2]>> for f32x2

source§

fn rem_assign(&mut self, other: Self)

Performs the %= operation. Read more
source§

impl RemAssign<f32> for f32x2

source§

fn rem_assign(&mut self, other: f32)

Performs the %= operation. Read more
source§

impl Simd for f32x2

§

type Element = f32

Element type of the SIMD vector
source§

const LANES: usize = 2usize

The number of elements in the SIMD vector.
§

type LanesType = [u32; 2]

The type: [u32; Self::N].
source§

impl Sub<Simd<[f32; 2]>> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl Sub<f32> for f32x2

§

type Output = Simd<[f32; 2]>

The resulting type after applying the - operator.
source§

fn sub(self, other: f32) -> Self

Performs the - operation. Read more
source§

impl SubAssign<Simd<[f32; 2]>> for f32x2

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl SubAssign<f32> for f32x2

source§

fn sub_assign(&mut self, other: f32)

Performs the -= operation. Read more
source§

impl<'a> Sum<&'a Simd<[f32; 2]>> for f32x2

source§

fn sum<I: Iterator<Item = &'a f32x2>>(iter: I) -> f32x2

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Sum<Simd<[f32; 2]>> for f32x2

source§

fn sum<I: Iterator<Item = f32x2>>(iter: I) -> f32x2

Method which takes an iterator and generates Self from the elements by “summing up” the items.