Skip to main content

Complex

Struct Complex 

Source
#[repr(C)]
pub struct Complex<V> { pub re: V, pub im: V, }
Expand description

A complex number re + im*i.

The derived PartialOrd is lexicographic on (re, im), matching PartialOrdVector. The crate docs cover the rest of the ordering/sign/rounding semantics.

Fields§

§re: V

The real part.

§im: V

The imaginary part.

Implementations§

Source§

impl<V: RealFloatVector> Complex<V>

Source

pub fn splat_parts(re: V::Element, im: V::Element) -> Self

Splat a real and imaginary part across every lane.

Source§

impl<V: RealValue> Complex<V>

Source

pub const ZERO: Self

Zero: 0 + 0i.

Source

pub const ONE: Self

One: 1 + 0i.

Source

pub const I: Self

The imaginary unit: 0 + 1i.

Source

pub const fn new(re: V, im: V) -> Self

Creates a complex number with the given real and imaginary parts.

Source

pub const fn real(re: V) -> Self

Creates a complex number with the given real part and zero imaginary part.

Source

pub const fn imag(im: V) -> Self

Creates a complex number with zero real part and the given imaginary part.

Source

pub fn conj(self) -> Self

The complex conjugate: re - im*i.

Source

pub fn norm_sqr(self) -> V

The squared modulus $|z|^2 = re^2 + im^2$.

Cheaper than the modulus (no square root), but it squares the range, so it overflows or underflows near the limits of the format.

Source

pub fn inv(self) -> Self

The multiplicative inverse $1/z = \bar{z}/|z|^2$.

Inherits the range limits of norm_sqr; the scaled form is finv.

Trait Implementations§

Source§

impl<V: RealValue> Add for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<V: RealValue> Add<V> for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: V) -> Self

Performs the + operation. Read more
Source§

impl<V: RealValue, T> AddAssign<T> for Complex<V>
where Self: Add<T, Output = Self>,

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl<V: RealFloatVector, Rhs> AddAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Add<Rhs, Output = Self>,

Source§

fn add_assign_c(&mut self, mask: V::Mask, rhs: Rhs)

Computes AddAssign with rhs where mask is true.
Source§

fn add_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)

Merges AddAssign with src using mask, assigning src where mask is false.
Source§

fn add_assign_z(&mut self, mask: V::Mask, rhs: Rhs)

Computes AddAssign masked (zeroed where mask is false).
Source§

impl<V: RealFloatVector, Rhs> AddMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Add<Rhs, Output = Self>,

Source§

fn add_c(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Add with rhs where mask is true.
Source§

fn add_m(self, src: Self, mask: V::Mask, rhs: Rhs) -> Self

Merges Add with src using mask, returning src where mask is false.
Source§

fn add_z(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Add masked (zeroed where mask is false).
Source§

impl<V: RealFloatVector> AddSubExt for Complex<V>

Source§

type Output = Complex<V>

The result of the lane-alternating operation.
Source§

fn addsub(self, b: Self) -> Self

[a0 - b0, a1 + b1, a2 - b2, ...] - even lanes subtract, odd lanes add.
Source§

fn fmaddsub(self, b: Self, c: Self) -> Self

[a0*b0 - c0, a1*b1 + c1, ...] - fused multiply then addsub.
Source§

fn fmsubadd(self, b: Self, c: Self) -> Self

[a0*b0 + c0, a1*b1 - c1, ...] - fused multiply then subadd (opposite parity).
Source§

impl<V: RealFloatVector> AddSubExtMasked<<V as GenericVector>::Mask> for Complex<V>

Source§

fn addsub_c(self, mask: V::Mask, b: Self) -> Self

addsub where mask is true, else self.
Source§

fn addsub_m(self, src: Self, mask: V::Mask, b: Self) -> Self

addsub where mask is true, else src.
Source§

fn addsub_z(self, mask: V::Mask, b: Self) -> Self

addsub where mask is true, else zero.
Source§

fn fmaddsub_c(self, mask: V::Mask, b: Self, c: Self) -> Self

fmaddsub where mask is true, else self.
Source§

fn fmaddsub_m(self, src: Self, mask: V::Mask, b: Self, c: Self) -> Self

fmaddsub where mask is true, else src.
Source§

fn fmaddsub_z(self, mask: V::Mask, b: Self, c: Self) -> Self

fmaddsub where mask is true, else zero.
Source§

fn fmsubadd_c(self, mask: V::Mask, b: Self, c: Self) -> Self

fmsubadd where mask is true, else self.
Source§

fn fmsubadd_m(self, src: Self, mask: V::Mask, b: Self, c: Self) -> Self

fmsubadd where mask is true, else src.
Source§

fn fmsubadd_z(self, mask: V::Mask, b: Self, c: Self) -> Self

fmsubadd where mask is true, else zero.
Source§

impl<V: RealFloatVector> Bounded for Complex<V>

Source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
Source§

fn max_value() -> Self

Returns the largest finite number this type can represent
Source§

impl<FROM, TO> CastVector<Complex<FROM>> for Complex<TO>
where FROM: RealFloatVector + CastVector<TO>, TO: RealFloatVector + CastVector<FROM>,

Source§

fn cast_into(self) -> Complex<FROM>

Convert this vector into a vector of type FROM, lane-by-lane.
Source§

fn cast_from(from: Complex<FROM>) -> Self

Convert a vector of type FROM into Self, lane-by-lane, using as semantics on each element. See the trait docs for what float-to-int does with NaN and out-of-range lanes.
Source§

fn saturating_cast_from(from: FROM) -> Self

Convert lane-by-lane, clamping out-of-range values to Self’s element range rather than wrapping (integers) or producing a backend-defined value (float to int). Read more
Source§

fn fast_cast_from(from: FROM) -> Self

Like cast_from, but may take a faster path that relaxes IEEE corner cases. See GenericVector::fast_cast. Read more
Source§

fn fast_cast_into(self) -> FROM

Like cast_into, but may take a faster path that relaxes IEEE corner cases. See GenericVector::fast_cast.
Source§

impl<V: Clone> Clone for Complex<V>

Source§

fn clone(&self) -> Complex<V>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<V: RealFloatVector> ComplexVector for Complex<V>

Source§

type Real = V

The real vector type of each component, in which a modulus or an argument is measured. Read more
Source§

fn re(self) -> V

The real part.
Source§

fn im(self) -> V

The imaginary part.
Source§

fn from_parts(re: V, im: V) -> Self

Builds a complex vector from its real and imaginary parts. Read more
Source§

unsafe fn store_streaming_block(self, ptr: *mut Self)

Non-temporal store of the whole block to ptr, in Self’s own memory layout (the planar/SoA [re | im] layout for Complex<V>), bypassing the cache. This is for relocating blocks within a [Self] buffer - e.g. an FFT transpose whose output is too large to cache - NOT the AoS boundary (that is store / store_streaming, which interleave re/im). Read more
Source§

fn conj(self) -> Self

The complex conjugate re - im*i.
Source§

fn norm_sqr(self) -> V

The squared modulus $|z|^2 = re^2 + im^2$. Read more
Source§

fn inv(self) -> Self

The multiplicative inverse $1/z = \bar{z}/|z|^2$. Read more
Source§

fn norm_l1(self) -> V

The L1 (“Manhattan”) norm |re| + |im|, a real value.
Source§

fn real(re: Self::Real) -> Self

Builds a complex vector from a real part, with zero imaginary part.
Source§

impl<V: RealValue> ConstDefault for Complex<V>

Source§

const DEFAULT: Self = Self::ZERO

The constant default value.
Source§

impl<V: Copy> Copy for Complex<V>

Source§

impl<V: Debug> Debug for Complex<V>

Source§

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

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

impl<V: Default> Default for Complex<V>

Source§

fn default() -> Complex<V>

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

impl<V: RealValue> Div for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<V: RealValue> Div<V> for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: V) -> Self

Performs the / operation. Read more
Source§

impl<V: RealValue, T> DivAssign<T> for Complex<V>
where Self: Div<T, Output = Self>,

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<V: RealFloatVector, Rhs> DivAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Div<Rhs, Output = Self>,

Source§

fn div_assign_c(&mut self, mask: V::Mask, rhs: Rhs)

Computes DivAssign with rhs where mask is true.
Source§

fn div_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)

Merges DivAssign with src using mask, assigning src where mask is false.
Source§

fn div_assign_z(&mut self, mask: V::Mask, rhs: Rhs)

Computes DivAssign masked (zeroed where mask is false).
Source§

impl<V: RealFloatVector, Rhs> DivMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Div<Rhs, Output = Self>,

Source§

fn div_c(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Div with rhs where mask is true.
Source§

fn div_m(self, src: Self, mask: V::Mask, rhs: Rhs) -> Self

Merges Div with src using mask, returning src where mask is false.
Source§

fn div_z(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Div masked (zeroed where mask is false).
Source§

impl<E: RealValue + Element> Element for Complex<E>

Source§

const ZERO: Self = Self::ZERO

Source§

const ONE: Self = Self::ONE

Source§

const ORDER_MAX: Self

The greatest value under this type’s natural total order, and the least. Read more
Source§

const ORDER_MIN: Self

The least value under this type’s natural total order. See ORDER_MAX.
Source§

const HAS_UNORDERED: bool = E::HAS_UNORDERED

Whether values of this type can be unordered under PartialOrd - float NaN. false for every integer type. Read more
Source§

const IS_FLOAT: bool = E::IS_FLOAT

Whether this is a floating-point element type. This is distinct from HAS_UNORDERED because some float types may not have NaN and so are ordered, but still have some special properties of floats.
Source§

type Signed = <E as Element>::Signed

SignedBits integer type to be used with operations that require signed counts, such as shifts.
Source§

type Unsigned = <E as Element>::Unsigned

Unsigned integer type to be used with operations that require unsigned counts, such as shifts.
Source§

fn from_i8(value: i8) -> Self

Source§

fn from_u8(value: u8) -> Self

Source§

fn from_u16(value: u16) -> Self

Source§

impl<E, V: RealFloatVector<Element = E>> ExpIntDetails<Complex<E>, Complex<V>> for Complex<V>
where Complex<V>: FloatVector<Element = Complex<E>, Mask = V::Mask>,

Available on crate feature special only.

All three of the shared expint kernel’s decisions change over C. Everything else about that kernel - the series, the Lentz continued fraction, the order recurrence - is inherited unchanged and simply runs in complex arithmetic.

Source§

fn invalid(z: Complex<V>) -> V::Mask

Nothing but NaN is out of domain.

Real E_N is a half-line function and the default NaNs out x < 0. E_N(z) is holomorphic on the whole cut plane |Arg z| < pi, so the negative reals are in-domain here, approached from above. The cut needs no handling of its own: all of the multivaluedness sits in the -ln z term of the series, and the principal ln this crate provides already carries exactly that branch.

Source§

fn cf_tiny() -> Complex<V>

The default sentinel, MIN_POSITIVE, cannot be used here: a complex reciprocal is conj(z) / |z|^2, and MIN_POSITIVE^2 underflows to zero, so the very first Lentz step divides by zero and every continued-fraction lane comes back NaN.

sqrt(MIN_POSITIVE) / EPSILON is the principled choice: the square root is the hard floor for surviving the squaring, and dividing by EPSILON backs off it far enough that the reciprocal’s square stays inside the exponent range too. Holds with room to spare for f32 and f64 alike.

Source§

fn use_series(z: Complex<V>) -> V::Mask

Lanes that should take the power series rather than the continued fraction. Read more
Source§

impl<V: RealValue + FloatConsts> FloatConsts for Complex<V>

Source§

const NEG_ZERO: Self

Negative zero (-0) (only sign bit set)
Source§

const E: Self

Euler’s number (e)
Source§

const EULER_GAMMA: Self

Euler-Mascheroni constant (γ)
Source§

const PI_SQUARED: Self

$\pi^2$
Source§

const PI_CUBED: Self

$\pi^3$
Source§

const PI_FOURTH: Self

$\pi^4$
Source§

const FRAC_1_PI: Self

$1/\pi$
Source§

const FRAC_1_SQRT_2: Self

$1/\sqrt{2}$
Source§

const FRAC_1_SQRT_3: Self

$1/\sqrt{3}$
Source§

const FRAC_2_PI: Self

$2/\pi$
Source§

const FRAC_1_SQRT_PI: Self

$1/\sqrt{\pi}$
Source§

const FRAC_2_SQRT_PI: Self

$2/\sqrt{\pi}$
Source§

const FRAC_SQRT_PI_2: Self

$\sqrt{\pi}/2$
Source§

const FRAC_1_SQRT_TAU: Self

$1/\sqrt{2\pi}$
Source§

const FRAC_PI_2: Self

$\pi/2$
Source§

const FRAC_PI_3: Self

$\pi/3$
Source§

const FRAC_PI_4: Self

$\pi/4$
Source§

const FRAC_PI_6: Self

$\pi/6$
Source§

const FRAC_PI_8: Self

$\pi/8$
Source§

const FRAC_PI_180: Self

$\pi/180$
Source§

const FRAC_180_PI: Self

$180/\pi$
Source§

const LN_2: Self

$\ln 2$
Source§

const LN_10: Self

$\ln 10$
Source§

const LN_PI: Self

$\ln \pi$
Source§

const FRAC_LN_PI_2: Self

$frac{1}{2}\ln \pi$
Source§

const LOG2_10: Self

$\log_2 10$
Source§

const LOG2_E: Self

$\log_2 e$
Source§

const LOG10_2: Self

$\log_{10} 2$
Source§

const LOG10_E: Self

$\log_{10} e$
Source§

const PI: Self

Archimedes’ constant (π)
Source§

const SQRT_2: Self

$\sqrt{2}$
Source§

const SQRT_3: Self

$\sqrt{3}$
Source§

const SQRT_E: Self

$\sqrt{e}$
Source§

const EPSILON: Self

The machine epsilon
Source§

const SQRT_EPSILON: Self

The square root of the machine epsilon ($\sqrt{ arepsilon}$)
Source§

const FOURTH_ROOT_EPSILON: Self

The fourth root of the machine epsilon ($\sqrt[4]{ arepsilon}$)
Source§

const TAU: Self

The full circle constant (τ)
Source§

const SQRT_FRAC_PI_2: Self

$\sqrt{\pi/2}$
Source§

const SQRT_TAU: Self

$\sqrt{2\pi}$
Source§

const PHI: Self

The golden ratio (φ)
Source§

const FRAC_1_3: Self

$1/3$
Source§

const FRAC_2_3: Self

$2/3$
Source§

const FRAC_1_4: Self

1/4
Source§

const FRAC_1_6: Self

1/6
Source§

const FRAC_NEG_1_E: Self

-1/e
Source§

impl<E: RealValue + FloatElement> FloatElement for Complex<E>

Source§

fn sqrt(this: Self) -> Self

The principal square root, in Kahan’s form; see FloatVector::sqrt below for why the symmetric formula is unusable.

Source§

const HAS_INFINITY: bool = E::HAS_INFINITY

Does the format support Infinity? If FALSE, overflow saturates to MAX_FINITE instead of INF. (e.g., E4M3 = false, E5M2 = true)
Source§

const HAS_SIGNED_ZERO: bool = E::HAS_SIGNED_ZERO

Does the format distinguish between +0 and -0? (Usually true, but some integer-like quantizations might not)
Source§

const HAS_SUBNORMALS: bool = E::HAS_SUBNORMALS

Does the format support subnormal numbers? If FALSE, any value smaller than MinNormal is flushed to zero (FTZ).
Source§

type ConstInt<const VAL: LargeInt> = ComplexIntConst<E, VAL>

Marker type for splatting a compile-time integer constant as this float type. Read more
Source§

type ConstRatio<const NUM: LargeInt, const DEN: LargeInt> = ComplexRatioConst<E, NUM, DEN>

Marker type for splatting a compile-time rational constant (N/D) as this float type. Read more
Source§

fn floor(this: Self) -> Self

Source§

fn ceil(this: Self) -> Self

Source§

fn round(this: Self) -> Self

Source§

fn trunc(this: Self) -> Self

Source§

fn next_up(this: Self) -> Self

Source§

fn next_down(this: Self) -> Self

Source§

fn try_from_int(value: LargeInt) -> Option<Self>

Try to represent this LargeInt value as this float type, returning None if it cannot be represented exactly.
Source§

fn try_from_ratio(n: LargeInt, d: LargeInt) -> Option<Self>

Source§

fn from_int(value: i64) -> Self

Source§

fn from_ratio(n: i64, d: i64) -> Self

Source§

fn fract(value: Self) -> Self

Source§

impl<V: RealFloatVector> FloatVector for Complex<V>

Source§

fn sqrt(self) -> Self

The principal square root, with a branch cut on the negative real axis.

Source§

fn rcp(self) -> Self

$1/z = \bar{z}/|z|^2$

Source§

fn rsqrt(self) -> Self

$1/\sqrt{z} = \overline{\sqrt{z}}/|z|$, since $|\sqrt{z}|^2 = |z|$.

Source§

const HALF: Self

The value 0.5 represented in this vector type.
Source§

const NEG_ZERO: Self

The value -0.0 represented in this vector type.
Source§

const EPSILON: Self

Hardware epsilon value in this vector type.
Source§

const INFINITY: Self

The value infinity represented in this vector type.
Source§

const NEG_INFINITY: Self

The value -infinity represented in this vector type.
Source§

const NAN: Self

The value NaN represented in this vector type.
Source§

const HAS_APPROX_RCP: bool = V::HAS_APPROX_RCP

true if the backend has a hardware approximate-reciprocal instruction (e.g. rcpps on x86). When false, rcp falls back to a full IEEE division and provides no speed advantage over Self::ONE / self.
Source§

const HAS_APPROX_RSQRT: bool = V::HAS_APPROX_RCP

true if the backend has a hardware approximate-reciprocal-square-root instruction (e.g. rsqrtps on x86). When false, rsqrt falls back to Self::ONE / self.sqrt().
Source§

type ExtendedPrecision = Complex<V>

If available, an extended precision floating point vector type corresponding to this vector type. E.g., for f32 vectors, this would be an f64 vector type. Read more
Source§

fn is_nan(self) -> Self::Mask

Check if each element in the vector is NaN, returning a mask.
Source§

fn is_infinite(self) -> Self::Mask

Check if each element in the vector is infinite, returning a mask.
Source§

fn is_finite(self) -> Self::Mask

Check if each element in the vector is finite, returning a mask.
Source§

fn is_zero_or_subnormal(self) -> Self::Mask

Check if each element in the vector is zero or subnormal, returning a mask.
Source§

fn is_normal(self) -> Self::Mask

Check if each element in the vector is normal, returning a mask.
Source§

fn is_subnormal(self) -> Self::Mask

Check if each element in the vector is subnormal, returning a mask.
Source§

fn floor(self) -> Self

Lane-wise floor: largest integer less than or equal to each element. Read more
Source§

fn ceil(self) -> Self

Lane-wise ceiling: smallest integer greater than or equal to each element, kept in the float representation.
Source§

fn round(self) -> Self

Lane-wise round-to-nearest. Read more
Source§

fn trunc(self) -> Self

Lane-wise truncation toward zero (drops the fractional part), kept in the float representation.
Source§

fn fract(self) -> Self

Lane-wise fractional part: self - self.trunc(). Read more
Source§

fn mul_sign(self, sign: Self) -> Self

Effectively self * sign.signum(), multiplying the sign bits.
Source§

fn signed_zero(self) -> Self

Returns zero with the sign of self, i.e.: only the sign bit is set.
Source§

fn next_up(self) -> Self

Returns the next representable value greater than the current value, towards positive infinity.
Source§

fn next_down(self) -> Self

Returns the next representable value less than the current value, towards negative infinity.
Source§

unsafe fn block_autovectorization(&mut self)

Inhibit further LLVM auto-vectorization of code surrounding this call. Read more
Source§

fn mix(self, a: Self, b: Self) -> Self

Linearly interpolates between a and b by self, where self is typically in the range [0, 1]. Read more
Source§

fn sqrt_c(self, mask: Self::Mask) -> Self

Lane-wise IEEE 754 square root. Read more
Source§

fn sqrt_m(self, src: Self, mask: Self::Mask) -> Self

Lane-wise IEEE 754 square root. Read more
Source§

fn sqrt_z(self, mask: Self::Mask) -> Self

Lane-wise IEEE 754 square root. Read more
Source§

fn rsqrt_c(self, mask: Self::Mask) -> Self

Lane-wise approximate reciprocal square root. Read more
Source§

fn rsqrt_m(self, src: Self, mask: Self::Mask) -> Self

Lane-wise approximate reciprocal square root. Read more
Source§

fn rsqrt_z(self, mask: Self::Mask) -> Self

Lane-wise approximate reciprocal square root. Read more
Source§

fn rcp_c(self, mask: Self::Mask) -> Self

Lane-wise approximate reciprocal: 1 / self. Read more
Source§

fn rcp_m(self, src: Self, mask: Self::Mask) -> Self

Lane-wise approximate reciprocal: 1 / self. Read more
Source§

fn rcp_z(self, mask: Self::Mask) -> Self

Lane-wise approximate reciprocal: 1 / self. Read more
Source§

fn floor_c(self, mask: Self::Mask) -> Self

Lane-wise floor: largest integer less than or equal to each element. Read more
Source§

fn floor_m(self, src: Self, mask: Self::Mask) -> Self

Lane-wise floor: largest integer less than or equal to each element. Read more
Source§

fn floor_z(self, mask: Self::Mask) -> Self

Lane-wise floor: largest integer less than or equal to each element. Read more
Source§

fn ceil_c(self, mask: Self::Mask) -> Self

Lane-wise ceiling: smallest integer greater than or equal to each element, kept in the float representation. Computes ceil when mask is true, returns self where false.
Source§

fn ceil_m(self, src: Self, mask: Self::Mask) -> Self

Lane-wise ceiling: smallest integer greater than or equal to each element, kept in the float representation. Merges ceil with src using mask.
Source§

fn ceil_z(self, mask: Self::Mask) -> Self

Lane-wise ceiling: smallest integer greater than or equal to each element, kept in the float representation. Computes ceil masked (zeroed where mask is false).
Source§

fn round_c(self, mask: Self::Mask) -> Self

Lane-wise round-to-nearest. Read more
Source§

fn round_m(self, src: Self, mask: Self::Mask) -> Self

Lane-wise round-to-nearest. Read more
Source§

fn round_z(self, mask: Self::Mask) -> Self

Lane-wise round-to-nearest. Read more
Source§

fn trunc_c(self, mask: Self::Mask) -> Self

Lane-wise truncation toward zero (drops the fractional part), kept in the float representation. Computes trunc when mask is true, returns self where false.
Source§

fn trunc_m(self, src: Self, mask: Self::Mask) -> Self

Lane-wise truncation toward zero (drops the fractional part), kept in the float representation. Merges trunc with src using mask.
Source§

fn trunc_z(self, mask: Self::Mask) -> Self

Lane-wise truncation toward zero (drops the fractional part), kept in the float representation. Computes trunc masked (zeroed where mask is false).
Source§

fn fract_c(self, mask: Self::Mask) -> Self

Lane-wise fractional part: self - self.trunc(). Read more
Source§

fn fract_m(self, src: Self, mask: Self::Mask) -> Self

Lane-wise fractional part: self - self.trunc(). Read more
Source§

fn fract_z(self, mask: Self::Mask) -> Self

Lane-wise fractional part: self - self.trunc(). Read more
Source§

fn signed_zero_c(self, mask: Self::Mask) -> Self

Returns zero with the sign of self, i.e.: only the sign bit is set. Computes signed_zero when mask is true, returns self where false.
Source§

fn signed_zero_m(self, src: Self, mask: Self::Mask) -> Self

Returns zero with the sign of self, i.e.: only the sign bit is set. Merges signed_zero with src using mask.
Source§

fn signed_zero_z(self, mask: Self::Mask) -> Self

Returns zero with the sign of self, i.e.: only the sign bit is set. Computes signed_zero masked (zeroed where mask is false).
Source§

fn next_up_c(self, mask: Self::Mask) -> Self

Returns the next representable value greater than the current value, towards positive infinity. Computes next_up when mask is true, returns self where false.
Source§

fn next_up_m(self, src: Self, mask: Self::Mask) -> Self

Returns the next representable value greater than the current value, towards positive infinity. Merges next_up with src using mask.
Source§

fn next_up_z(self, mask: Self::Mask) -> Self

Returns the next representable value greater than the current value, towards positive infinity. Computes next_up masked (zeroed where mask is false).
Source§

fn next_down_c(self, mask: Self::Mask) -> Self

Returns the next representable value less than the current value, towards negative infinity. Computes next_down when mask is true, returns self where false.
Source§

fn next_down_m(self, src: Self, mask: Self::Mask) -> Self

Returns the next representable value less than the current value, towards negative infinity. Merges next_down with src using mask.
Source§

fn next_down_z(self, mask: Self::Mask) -> Self

Returns the next representable value less than the current value, towards negative infinity. Computes next_down masked (zeroed where mask is false).
Source§

fn mul_sign_c(self, mask: Self::Mask, rhs: Self) -> Self

Effectively self * sign.signum(), multiplying the sign bits. Computes mul_sign when mask is true, returns self where false.
Source§

fn mul_sign_m(self, src: Self, mask: Self::Mask, rhs: Self) -> Self

Effectively self * sign.signum(), multiplying the sign bits. Merges mul_sign with src using mask.
Source§

fn mul_sign_z(self, mask: Self::Mask, rhs: Self) -> Self

Effectively self * sign.signum(), multiplying the sign bits. Computes mul_sign masked (zeroed where mask is false).
Source§

fn one_minus_sq(self) -> Self

Computes $1 - x^2$ accurately, avoiding the cancellation a naive 1 - self * self suffers as self approaches ±1 (where the result is small but self * self is near 1). Read more
Source§

fn with_bits<const N: usize, K>( _values: [Self; N], _kernel: K, ) -> Option<<K as AsFloatVectorWithBitsKernel<Self, N>>::Output>
where K: AsFloatVectorWithBitsKernel<Self, N>,

Attempt to upcast this FloatVector to a FloatVectorWithBits, using the provided kernel. If not possible, returns None.
Source§

impl<V: RealFloatVector> GenericSelectable for Complex<V>

Source§

type SelectableMask = <V as GenericSelectable>::SelectableMask

The mask type whose lane count and layout match Self.
Source§

fn select<M>(mask: M, t: Self, f: Self) -> Self
where Self::SelectableMask: CastMask<M>,

For each lane, take the value from t where mask is true, otherwise from f.
Source§

impl<V: RealFloatVector> GenericVector for Complex<V>

Source§

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

A Complex element is #[repr(C)] over two floats, so one element is load_deinterleaved::<1>, which routes through the inner vector’s register engine and not a lane-by-lane loop.

Source§

unsafe fn load_deinterleaved<const M: usize>( ptr: *const Self::Element, ) -> [Self; M]

M interleaved Complex streams are 2 * M interleaved float streams, i.e. a grouped problem with TAIL = 1 (see StreamGroup). M goes straight to the inner vector’s GenericVector::load_deinterleaved_grouped - a NEON LD2/LD4, or a shuffle network on x86 - for any M.

Source§

unsafe fn store_interleaved<const M: usize>( ptr: *mut Self::Element, values: [Self; M], )

The exact inverse of load_deinterleaved.

Source§

const EMPTY: Self = Self::ZERO

A vector with all elements zeroed.
Source§

const LANES: usize = V::LANES

Number of lanes in the vector.
Source§

const HAS_NATIVE_ALIGN: bool = V::HAS_NATIVE_ALIGN

Whether align is a native cross-register instruction rather than the generic shuffle-and-blend fallback, forwarded from Register::HAS_NATIVE_ALIGN. Read more
Source§

type Element = Complex<<V as GenericVector>::Element>

Scalar element type of the vector.
Source§

type Lanes = <V as GenericVector>::Lanes

Number of lanes in the vector, as a typenum.
Source§

type Unsigned = <V as GenericVector>::Unsigned

Unsigned Integer Type suitable for use with this vector.
Source§

type Signed = <V as GenericVector>::Signed

SignedBits Integer Type suitable for use with this vector.
Source§

type Mask = <V as GenericVector>::Mask

Mask type for this vector. Masks are semantically boolean vectors indicating true or false for each lane. They may or may not be represented as actual bits.
Source§

fn new<const N: usize>(value: [Self::Element; N]) -> Self
where Const<N>: IntoArrayLength<ArrayLength = Self::Lanes>,

Create a new vector from an array of elements. Read more
Source§

fn into_array(self) -> GenericArray<Self::Element, Self::Lanes>

Consume the vector and return its elements as a GenericArray. Read more
Source§

fn splat(value: Self::Element) -> Self

Create a new vector from a single element by splatting it across all lanes.
Source§

fn single(value: Self::Element) -> Self

Create a new vector with the first lane set to the given value, and all other lanes set to zero.
Source§

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

Load a vector from an aligned pointer to its elements. Read more
Source§

unsafe fn load_streaming(ptr: *const Self::Element) -> Self

Load a vector from a pointer to its elements using non-temporal (streaming) loads. Read more
Source§

fn interleave_by<const GROUP: usize>(self, other: Self) -> (Self, Self)

Interleave two vectors at group granularity: blocks of GROUP consecutive elements move as a unit and are never split. GROUP == 1 is interleave; GROUP == 2 is the complex interleave - lo == [a.c0, b.c0, a.c1, b.c1, ...] over the low half of the groups, hi over the high half - which lowers to the doubled-element unpack (unpacklo_pd + permute2f128 on AVX2, zip on NEON) rather than a general permute. The primitive for complex FFT transposes and any group-structured SIMD. GROUP must divide LANES. Read more
Source§

fn deinterleave_by<const GROUP: usize>(self, other: Self) -> (Self, Self)

The inverse of interleave_by - group-granularity de-interleave.
Source§

fn interleave_radix<const N: usize>(inputs: [Self; N]) -> [Self; N]

Radix-N interleave: the generic sibling of interleave (N == 2). Treats the N inputs as one contiguous N * LANES span and gives out with concat(out)[q * N + r] == inputs[r].extract(q). Read more
Source§

fn deinterleave_radix<const N: usize>(inputs: [Self; N]) -> [Self; N]

The inverse of interleave_radix - radix-N de-interleave: out[r].extract(q) == concat(inputs)[q * N + r].
Source§

fn deinterleave_radix_by<const N: usize, const GROUP: usize>( inputs: [Self; N], ) -> [Self; N]

Group-granularity radix-N de-interleave: the two-axis unification of deinterleave_radix (GROUP == 1) and deinterleave_by (N == 2). Each vector is viewed as LANES / GROUP groups of GROUP consecutive elements; out[r] group q is the (q * N + r)-th group of the concatenated input sequence, each group moving as a unit. Read more
Source§

fn interleave_radix_by<const N: usize, const GROUP: usize>( inputs: [Self; N], ) -> [Self; N]

The inverse of deinterleave_radix_by - group-granularity radix-N interleave. For the square case it is the same (self-inverse) register-array transpose.
Source§

unsafe fn load_m(src: Self, mask: Self::Mask, ptr: *const Self::Element) -> Self

Load a vector from an aligned pointer to its elements. Read more
Source§

unsafe fn load_z(mask: Self::Mask, ptr: *const Self::Element) -> Self

Load a vector from an aligned pointer to its elements. Read more
Source§

unsafe fn store(self, ptr: *mut Self::Element)

Store the vector to an aligned pointer to its elements. Read more
Source§

unsafe fn store_unaligned(self, ptr: *mut Self::Element)

Store the vector to an unaligned pointer to its elements. Read more
Source§

unsafe fn store_streaming(self, ptr: *mut Self::Element)

Store the vector to a pointer to its elements using non-temporal (streaming) stores. Read more
Source§

unsafe fn store_masked(self, mask: Self::Mask, ptr: *mut Self::Element)

Store the vector to an aligned pointer to its elements, but only for lanes where the corresponding mask lane is true. For lanes where the mask is false, the store is suppressed without panicking. Read more
Source§

unsafe fn lookup_unchecked( values: &[Self::Element], indices: Self::Unsigned, ) -> Self

Assemble a vector from a slice of elements and a vector of indices into that slice. The indices are NOT checked to be within bounds. Read more
Source§

fn broadcast<const I: usize>(self) -> Self

Broadcast the value of a single lane across all lanes of the vector.
Source§

fn broadcastv(self, idx: usize) -> Self

Broadcast the value of a single lane across all lanes of the vector. Read more
Source§

fn extract<const I: usize>(self) -> Self::Element

Extract a single element from the vector at the const-generic index I. Read more
Source§

fn extractv(self, idx: usize) -> Self::Element

Extract a single element from the vector at the runtime index idx. Read more
Source§

fn insert<const I: usize>(self, value: Self::Element) -> Self

Replace a single element in the vector at the const-generic index I. Read more
Source§

fn insertv(self, idx: usize, value: Self::Element) -> Self

Replace a single element in the vector at the runtime index idx. Read more
Source§

fn reverse(self) -> Self

Reverse the order of the elements in the vector. Read more
Source§

fn swap_bytes(self) -> Self

Swap the byte order of each element in the vector, converting between little-endian and big-endian representations lane-by-lane. Read more
Source§

fn zz(self, mask: Self::Mask) -> Self

(Zero If False) Zero elements if the corresponding mask lane is false; otherwise, leave unchanged. Read more
Source§

fn nz(self, mask: Self::Mask) -> Self

(Zero If True) Zero elements if the corresponding mask lane is true; otherwise, leave unchanged. Read more
Source§

fn compress(self, mask: Self::Mask) -> Self

Left-pack (a.k.a. compress): gather the lanes where mask is true into the low lanes, preserving their relative order. The unselected lanes are kept (not zeroed) and packed into the high lanes, also in order - a stable partition of the vector by mask. Read more
Source§

fn compress_z(self, mask: Self::Mask) -> Self

Zero-filling left-pack: like compress, but the lanes beyond the mask population count are zeroed instead of holding the unselected elements. Matches AVX-512 zero-masking vpcompress*. Read more
Source§

fn compress_m(self, src: Self, mask: Self::Mask) -> Self

Merge-masked left-pack: like compress, but the lanes at and beyond the mask population count take their values from src (at their own positions). Matches AVX-512 merge-masked vpcompress*. Read more
Source§

fn expand(self, mask: Self::Mask) -> Self

Inverse left-pack (expand): scatter this vector’s packed low lanes back out to the lanes where mask is set, preserving order; the unselected lanes read the tail. The exact inverse permutation of compress: v.compress(m).expand(m) == v and v.expand(m).compress(m) == v for every v and m. Read more
Source§

fn expand_z(self, mask: Self::Mask) -> Self

Zero-filling inverse left-pack: like expand, but the unselected lanes are zeroed. Matches AVX-512 zero-masking vpexpand*. Read more
Source§

fn expand_m(self, src: Self, mask: Self::Mask) -> Self

Merge-masked inverse left-pack: like expand, but the unselected lanes take their values from src. Matches AVX-512 merge-masked vpexpand*. Read more
Source§

fn align<const OFFSET: usize>(self, other: Self) -> Self

Two-register element align (the palignr family): the window of LANES lanes starting at lane OFFSET of the concatenation [self, other] (self’s lanes first, then other’s). OFFSET == 0 returns self, OFFSET == LANES returns other; in between, lanes spill from the tail of self into the head of other. Read more
Source§

fn map<F>(self, f: F) -> Self
where F: Fn(Self::Element) -> Self::Element,

Apply a function to each element in the vector, returning a new vector with the results. Read more
Source§

fn fold<F>(self, init: Self::Element, f: F) -> Self::Element
where F: Fn(Self::Element, Self::Element) -> Self::Element,

Fold the elements of the vector using the provided function and initial value. Read more
Source§

fn reduce<F>(self, f: F) -> Self::Element
where F: Fn(Self::Element, Self::Element) -> Self::Element,

Reduce the elements of the vector using the provided function. Read more
Source§

fn splat_m(src: Self, mask: Self::Mask, value: Self::Element) -> Self

Create a new vector from a single element by splatting it across all lanes. Merges splat with src using mask.
Source§

fn splat_z(mask: Self::Mask, value: Self::Element) -> Self

Create a new vector from a single element by splatting it across all lanes. Computes splat masked (zeroed where mask is false).
Source§

fn broadcast_c<const I: usize>(self, mask: Self::Mask) -> Self

Broadcast the value of a single lane across all lanes of the vector. Computes broadcast when mask is true, returns self where false.
Source§

fn broadcast_m<const I: usize>(self, src: Self, mask: Self::Mask) -> Self

Broadcast the value of a single lane across all lanes of the vector. Merges broadcast with src using mask.
Source§

fn broadcast_z<const I: usize>(self, mask: Self::Mask) -> Self

Broadcast the value of a single lane across all lanes of the vector. Computes broadcast masked (zeroed where mask is false).
Source§

fn broadcastv_c(self, mask: Self::Mask, idx: usize) -> Self

Broadcast the value of a single lane across all lanes of the vector. Read more
Source§

fn broadcastv_m(self, src: Self, mask: Self::Mask, idx: usize) -> Self

Broadcast the value of a single lane across all lanes of the vector. Read more
Source§

fn broadcastv_z(self, mask: Self::Mask, idx: usize) -> Self

Broadcast the value of a single lane across all lanes of the vector. Read more
Source§

fn reverse_c(self, mask: Self::Mask) -> Self

Reverse the order of the elements in the vector. Read more
Source§

fn reverse_m(self, src: Self, mask: Self::Mask) -> Self

Reverse the order of the elements in the vector. Read more
Source§

fn reverse_z(self, mask: Self::Mask) -> Self

Reverse the order of the elements in the vector. Read more
Source§

fn swap_bytes_c(self, mask: Self::Mask) -> Self

Swap the byte order of each element in the vector, converting between little-endian and big-endian representations lane-by-lane. Read more
Source§

fn swap_bytes_m(self, src: Self, mask: Self::Mask) -> Self

Swap the byte order of each element in the vector, converting between little-endian and big-endian representations lane-by-lane. Read more
Source§

fn swap_bytes_z(self, mask: Self::Mask) -> Self

Swap the byte order of each element in the vector, converting between little-endian and big-endian representations lane-by-lane. Read more
Source§

fn lanes() -> usize

Number of lanes in the vector, as a runtime value. Read more
Source§

fn concat<INTO>(self, hi: Self) -> INTO
where INTO: ConcatVector<Self, Element = Self::Element>,

Combine two vectors of the same type into one wider vector, with self as the lower half and hi as the upper half.
Source§

fn split<INTO>(self) -> (INTO, INTO)
where INTO: GenericVector, Self: ConcatVector<INTO, Element = <INTO as GenericVector>::Element>,

Split this vector into two narrower vectors of the same type, with the lower lanes in the first vector and the upper lanes in the second vector.
Source§

fn extend<INTO>(self) -> INTO
where INTO: ExtendVector<Self, Element = Self::Element>,

Zero-extend a narrower vector into this wider vector type, placing the original values in the lower lanes and filling the upper lanes with zeros.
Source§

fn narrow<INTO>(self) -> INTO
where INTO: GenericVector, Self: ExtendVector<INTO, Element = <INTO as GenericVector>::Element>,

Narrow this wider vector into a narrower vector by taking the lower lanes. Read more
Source§

fn align_slice( slice: &[Self::Element], ) -> (&[Self::Element], &[Self], &[Self::Element])

Align a slice of elements to the vector’s lane count, returning the aligned portion and any unaligned head or tail. Read more
Source§

fn align_slice_mut( slice: &mut [Self::Element], ) -> (&mut [Self::Element], &mut [Self], &mut [Self::Element])

Align a mutable slice of elements to the vector’s lane count, returning the aligned portion and any unaligned head or tail. Read more
Source§

fn from_slice(slice: &[Self::Element]) -> Self

Create a new vector from a slice of elements. The slice must have at least as many elements as the vector’s lanes. Read more
Source§

fn copy_to_slice(self, slice: &mut [Self::Element])

Copy the elements of the vector into a slice. The slice must have at least as many elements as the vector’s lanes. Read more
Source§

fn iter_unaligned<'a>( values: &'a [Self::Element], ) -> (Unaligned<'a, Self>, &'a [Self::Element])

Transform a slice of element values into an unaligned iterator of vectors, returning any remaining elements as a suffix slice.
Source§

fn iter_mut_unaligned<'a>( values: &'a mut [Self::Element], ) -> (UnalignedMut<'a, Self>, &'a mut [Self::Element])

Transform a mutable slice of element values into an unaligned iterator of vectors, returning any remaining elements as a suffix slice.
Source§

fn stream_aligned_slice<'a>( values: &'a [Self::Element], ) -> impl DoubleEndedIterator

Iterate over a slice of element values as Vectors using non-temporal (streaming) loads. Read more
Source§

fn stream_aligned_slice_mut<'a>( values: &'a mut [Self::Element], ) -> impl DoubleEndedIterator

Iterate over a mutable slice of element values as Vectors using non-temporal (streaming) loads and stores. Read more
Source§

fn gather<I>(slice: &[Self::Element], indices: I) -> Self
where I: VectorIndices<Self>,

Gather elements from memory at the specified indices and return a new vector with those elements. Read more
Source§

fn gather_or<I>(slice: &[Self::Element], indices: I, or: Self) -> Self
where I: VectorIndices<Self>, Self::Mask: CastMask<<I as GenericVector>::Mask>,

Gather elements from memory at the specified indices, or return or if the index is out of bounds. Read more
Source§

fn gather_or_zero<I>(slice: &[Self::Element], indices: I) -> Self
where I: VectorIndices<Self>, Self::Mask: CastMask<<I as GenericVector>::Mask>,

Gather elements from memory at the specified indices, or set the lane to zero if the index is out of bounds. Read more
Source§

fn gather_if<I>( slice: &[Self::Element], enable: Self::Mask, indices: I, or: Self, ) -> Self
where I: VectorIndices<Self>, Self::Mask: CastMask<<I as GenericVector>::Mask>, Self::Element: Default,

Gather elements from memory at the specified indices, or return or if the enable mask is false OR if any index is out of bounds. Read more
Source§

fn scatter<I>(self, slice: &mut [Self::Element], indices: I)
where I: VectorIndices<Self>, Self::Mask: CastMask<<I as GenericVector>::Mask>,

Scatter elements from the given vector into memory at the specified indices. If the index is outside of the bounds of the provided slice, the write is suppressed without panicking.
Source§

fn scatter_if<I>( self, slice: &mut [Self::Element], enable: Self::Mask, indices: I, )
where I: VectorIndices<Self>, Self::Mask: CastMask<<I as GenericVector>::Mask>,

Scatter elements from the given vector into memory at the specified indices, but only for lanes where the enable mask is true. If the index is outside of the bounds of the provided slice, the write is suppressed without panicking.
Source§

unsafe fn load_deinterleaved_arrays<const M: usize, const C: usize>( ptr: *const Self::Element, ) -> [[Self; C]; M]

Load M interleaved AoS records of C components each and de-interleave them: reads M * C * LANES contiguous elements, and out[j][c] holds component c of record j (out[j][c].extract(lane) == ptr[lane * M * C + j * C + c]). Read more
Source§

unsafe fn store_interleaved_arrays<const M: usize, const C: usize>( ptr: *mut Self::Element, values: [[Self; C]; M], )

Interleave M records of C components and store them contiguously - the exact inverse of load_deinterleaved_arrays, with the same lane-wise default. Read more
Source§

unsafe fn load_deinterleaved_grouped<const M: usize, const TAIL: usize>( ptr: *const Self::Element, ) -> [StreamGroup<Self, TAIL>; M]

Load M interleaved composite streams of 1 + TAIL components each and de-interleave them into M StreamGroups: reads M * (TAIL + 1) * LANES contiguous elements, and group j’s head/tail[c - 1] hold the de-interleaved components of composite stream j. See StreamGroup for why the component count is a separate const generic, and Register::load_deinterleaved_grouped for the register-level strategy. Read more
Source§

unsafe fn store_interleaved_grouped<const M: usize, const TAIL: usize>( ptr: *mut Self::Element, values: [StreamGroup<Self, TAIL>; M], )

Interleave M StreamGroups and store them as a contiguous array-of-structures - the exact inverse of load_deinterleaved_grouped, with the same lane-wise default and the same override expectations. Read more
Source§

fn lookup(values: &[Self::Element], indices: Self::Unsigned) -> Self

Assemble a vector from a slice of elements and a vector of indices into that slice. If an index is outside the bounds of the given slice, the resulting lane will be the first element of the input slice. Read more
Source§

fn first(self) -> Self::Element

Extract lane 0 – the scalar counterpart to single. Read more
Source§

fn prefix_mask(n: usize) -> Self::Mask

Construct a mask whose first n lanes are true and the remaining lanes false. Read more
Source§

fn suffix_mask(n: usize) -> Self::Mask

Construct a mask whose last n lanes are true and the remaining lanes false. Read more
Source§

fn cast<INTO>(self) -> INTO
where INTO: CastVector<Self>,

Numeric cast to another vector type, matching the semantics of Rust’s as operator on the underlying scalar elements for in-range, finite inputs. Read more
Source§

fn fast_cast<INTO>(self) -> INTO
where INTO: CastVector<Self>,

Fast numeric cast to another vector type. Read more
Source§

fn into_bits<INTO>(self) -> INTO
where INTO: BitCastVector<Self>,

Reinterpret the bits of this vector as another vector type of the same size and lane count. Read more
Source§

fn saturating_cast<INTO>(self) -> INTO
where INTO: CastVector<Self>,

Cast that saturates (clamps) out-of-range values to the destination element range, rather than wrapping (integers) or producing a backend-defined value (float-to-int) like cast. Read more
Source§

impl<V: HasIsa> HasIsa for Complex<V>

Source§

const ISA: InstructionSet = V::ISA

The instruction set this backend implements. Read more
Source§

type Native = <V as HasIsa>::Native

The backend this type executes on. Read more
Source§

impl<V: RealFloatVector> Interleave for Complex<V>

Source§

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

Unpack and interleave elements from two vectors. Read more
Source§

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

Pack and deinterleave elements from two vectors. This is the inverse operation of interleave. Read more
Source§

impl<V: RealValue> Mul for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<V: RealValue> Mul<V> for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: V) -> Self

Performs the * operation. Read more
Source§

impl<V: RealValue, A, B> MulAddAssignExt<A, B> for Complex<V>
where Self: MulAddExt<A, B, Output = Self>,

Source§

fn mul_add_assign(&mut self, a: A, b: B)

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_sub_assign(&mut self, a: A, b: B)

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn nmul_add_assign(&mut self, a: A, b: B)

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_sub_assign(&mut self, a: A, b: B)

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn mul_adde_assign(&mut self, a: A, b: B)

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA.
Source§

fn mul_sube_assign(&mut self, a: A, b: B)

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA.
Source§

fn nmul_adde_assign(&mut self, a: A, b: B)

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA.
Source§

fn nmul_sube_assign(&mut self, a: A, b: B)

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA.
Source§

impl<V: RealFloatVector, A, B> MulAddAssignExtMasked<<V as GenericVector>::Mask, A, B> for Complex<V>
where Complex<V>: MulAddExt<A, B, Output = Self>,

Source§

fn mul_add_assign_c(&mut self, mask: V::Mask, a: A, b: B)

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_add_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_add_assign_z(&mut self, mask: V::Mask, a: A, b: B)

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_sub_assign_c(&mut self, mask: V::Mask, a: A, b: B)

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn mul_sub_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn mul_sub_assign_z(&mut self, mask: V::Mask, a: A, b: B)

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn nmul_add_assign_c(&mut self, mask: V::Mask, a: A, b: B)

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_add_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_add_assign_z(&mut self, mask: V::Mask, a: A, b: B)

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_sub_assign_c(&mut self, mask: V::Mask, a: A, b: B)

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn nmul_sub_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn nmul_sub_assign_z(&mut self, mask: V::Mask, a: A, b: B)

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn mul_adde_assign_c(&mut self, mask: V::Mask, a: A, b: B)

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn mul_adde_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn mul_adde_assign_z(&mut self, mask: V::Mask, a: A, b: B)

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn mul_sube_assign_c(&mut self, mask: V::Mask, a: A, b: B)

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn mul_sube_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn mul_sube_assign_z(&mut self, mask: V::Mask, a: A, b: B)

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn nmul_adde_assign_c(&mut self, mask: V::Mask, a: A, b: B)

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn nmul_adde_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn nmul_adde_assign_z(&mut self, mask: V::Mask, a: A, b: B)

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn nmul_sube_assign_c(&mut self, mask: V::Mask, a: A, b: B)

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn nmul_sube_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn nmul_sube_assign_z(&mut self, mask: V::Mask, a: A, b: B)

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

impl<V: RealValue> MulAddExt for Complex<V>

Source§

const HAS_TRUE_FMA: bool = false

Indicates whether the implementation uses true fused-multiply-add instructions. Read more
Source§

type Output = Complex<V>

The result of the fused operation.
Source§

fn mul_add(self, a: Self, b: Self) -> Self

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_sub(self, a: Self, b: Self) -> Self

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn nmul_add(self, a: Self, b: Self) -> Self

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_sub(self, a: Self, b: Self) -> Self

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn mul_adde(self, a: Self, b: Self) -> Self

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA.
Source§

fn mul_sube(self, a: Self, b: Self) -> Self

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA.
Source§

fn nmul_adde(self, a: Self, b: Self) -> Self

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA.
Source§

fn nmul_sube(self, a: Self, b: Self) -> Self

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA.
Source§

impl<V: RealValue> MulAddExt<V> for Complex<V>

Source§

const HAS_TRUE_FMA: bool

Indicates whether the implementation uses true fused-multiply-add instructions. Read more
Source§

type Output = Complex<V>

The result of the fused operation.
Source§

fn mul_add(self, a: V, b: Self) -> Self

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_sub(self, a: V, b: Self) -> Self

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn nmul_add(self, a: V, b: Self) -> Self

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_sub(self, a: V, b: Self) -> Self

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn mul_adde(self, a: V, b: Self) -> Self

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA.
Source§

fn mul_sube(self, a: V, b: Self) -> Self

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA.
Source§

fn nmul_adde(self, a: V, b: Self) -> Self

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA.
Source§

fn nmul_sube(self, a: V, b: Self) -> Self

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA.
Source§

impl<V: RealFloatVector, A, B> MulAddExtMasked<<V as GenericVector>::Mask, A, B> for Complex<V>
where Complex<V>: MulAddExt<A, B, Output = Self>,

Source§

fn mul_add_c(self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_add_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_add_z(self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-multiply-add operation. Read more
Source§

fn mul_sub_c(self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn mul_sub_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn mul_sub_z(self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-multiply-subtract operation. Read more
Source§

fn nmul_add_c(self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_add_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_add_z(self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-negated-multiply-add operation. Read more
Source§

fn nmul_sub_c(self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn nmul_sub_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn nmul_sub_z(self, mask: V::Mask, a: A, b: B) -> Self

Guaranteed fused-negated-multiply-subtract operation. Read more
Source§

fn mul_adde_c(self, mask: V::Mask, a: A, b: B) -> Self

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn mul_adde_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn mul_adde_z(self, mask: V::Mask, a: A, b: B) -> Self

Fused-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn mul_sube_c(self, mask: V::Mask, a: A, b: B) -> Self

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn mul_sube_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn mul_sube_z(self, mask: V::Mask, a: A, b: B) -> Self

Fused-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn nmul_adde_c(self, mask: V::Mask, a: A, b: B) -> Self

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn nmul_adde_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn nmul_adde_z(self, mask: V::Mask, a: A, b: B) -> Self

Fused-negated-multiply-add operation where possible. May gracefully degrade to separate multiply and add if the target architecture does not support native FMA. Read more
Source§

fn nmul_sube_c(self, mask: V::Mask, a: A, b: B) -> Self

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn nmul_sube_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

fn nmul_sube_z(self, mask: V::Mask, a: A, b: B) -> Self

Fused-negated-multiply-subtract operation where possible. May gracefully degrade to separate multiply and subtract if the target architecture does not support native FMA. Read more
Source§

impl<V: RealValue, T> MulAssign<T> for Complex<V>
where Self: Mul<T, Output = Self>,

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<V: RealFloatVector, Rhs> MulAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Mul<Rhs, Output = Self>,

Source§

fn mul_assign_c(&mut self, mask: V::Mask, rhs: Rhs)

Computes MulAssign with rhs where mask is true.
Source§

fn mul_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)

Merges MulAssign with src using mask, assigning src where mask is false.
Source§

fn mul_assign_z(&mut self, mask: V::Mask, rhs: Rhs)

Computes MulAssign masked (zeroed where mask is false).
Source§

impl<V: RealFloatVector, Rhs> MulMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Mul<Rhs, Output = Self>,

Source§

fn mul_c(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Mul with rhs where mask is true.
Source§

fn mul_m(self, src: Self, mask: V::Mask, rhs: Rhs) -> Self

Merges Mul with src using mask, returning src where mask is false.
Source§

fn mul_z(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Mul masked (zeroed where mask is false).
Source§

impl<V: RealValue> Neg for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<V: RealFloatVector> NegMasked<<V as GenericVector>::Mask> for Complex<V>

Source§

fn neg_c(self, mask: V::Mask) -> Self

Computes Neg where mask is true, does nothing where false.
Source§

fn neg_m(self, src: Self, mask: V::Mask) -> Self

Merges Neg with src using mask, returning src where mask is false.
Source§

fn neg_z(self, mask: V::Mask) -> Self

Computes Neg masked (zeroed where mask is false).
Source§

impl<V: RealFloatVector> NewVector<Complex<<V as GenericVector>::Element>, <V as GenericVector>::Lanes> for Complex<V>

Source§

type New<T: NewConst<Complex<V::Element>, V::Lanes>> = ComplexNewImpl

For a given array carrier T, the type exposing the constructed vector constant via VectorValue.
Source§

impl<V: RealFloatVector> NumericVector for Complex<V>

Source§

const ZERO: Self

A vector of the value “0” in the element type.
Source§

const ONE: Self

A vector of the value “1” in the element type.
Source§

const TWO: Self

A vector of the value “2” in the element type.
Source§

const MIN: Self

A vector of the minimum value the element type of this vector can represent.
Source§

const MAX: Self

A vector of the maximum value the element type of this vector can represent.
Source§

fn to_signed_integer(self) -> Self::Signed

Convert each lane to the companion signed integer type, with as semantics - round toward zero, saturating at the bounds, NaN to zero. Read more
Source§

fn from_signed_integer(v: Self::Signed) -> Self

Convert each lane from the companion signed integer type, with as semantics. Read more
Source§

fn to_unsigned_integer(self) -> Self::Unsigned

Convert each lane to the companion unsigned integer type, with as semantics. See to_signed_integer.
Source§

fn from_unsigned_integer(v: Self::Unsigned) -> Self

Convert each lane from the companion unsigned integer type, with as semantics. See from_signed_integer.
Source§

fn is_zero(self) -> Self::Mask

For each element in the vector, return a mask indicating whether that element is zero.
Source§

fn is_all_zero(self) -> bool

Returns true if all elements in the vector are zero, false otherwise. Read more
Source§

fn sort_by<O: SortOrder>(self) -> Self

Sort the lanes of this vector in O order. Read more
Source§

fn bitonic_clean_by<O: SortOrder>(self) -> Self

Sort the lanes of a bitonic vector in O order - one that rises then falls, or a rotation of one. Read more
Source§

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

Return the minimum of two vectors, element-wise.
Source§

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

Return the maximum of two vectors, element-wise.
Source§

fn clamp(self, min: Self, max: Self) -> Self

Clamps the elements of the vector between the given minimum and maximum values.
Source§

fn min_element(self) -> Self::Element

Returns the minimum value in the vector. Read more
Source§

fn max_element(self) -> Self::Element

Returns the maximum value in the vector. Read more
Source§

fn min_max_element(self) -> (Self::Element, Self::Element)

Returns both the minimum and maximum values in the vector simultaneously. Read more
Source§

fn arg_minmax(self) -> (usize, usize)

Returns the indices of the minimum and maximum elements in the vector, respectively.
Source§

fn sum_elements(self) -> Self::Element

Returns the sum of all elements in the vector. Read more
Source§

fn prefix_sum(self) -> Self

Inclusive forward prefix sum (“running total”): out[i] = self[0] + .. + self[i]. Read more
Source§

fn reverse_prefix_sum(self) -> Self

Inclusive reverse (suffix) sum: out[i] = self[i] + .. + self[LANES-1].
Source§

fn prefix_min(self) -> Self

Inclusive forward prefix minimum: out[i] = min(self[0], .., self[i]). Read more
Source§

fn prefix_max(self) -> Self

Inclusive forward prefix maximum: out[i] = max(self[0], .., self[i]). Read more
Source§

fn reverse_prefix_min(self) -> Self

Inclusive reverse (suffix) minimum: out[i] = min(self[i], .., self[LANES-1]). Read more
Source§

fn reverse_prefix_max(self) -> Self

Inclusive reverse (suffix) maximum: out[i] = max(self[i], .., self[LANES-1]). Read more
Source§

fn prod_elements(self) -> Self::Element

Returns the product of all elements in the vector. Read more
Source§

fn offset() -> Self

Returns a vector whose every lane equals LANES, converted into the element type. Read more
Source§

fn indexed() -> Self

Returns a vector where each lane holds its own index, cast to the element type: [0, 1, 2, ..., LANES-1]. Read more
Source§

fn scale(self, factor: Self::Element) -> Self

Scales each element in the vector by the given factor. Read more
Source§

fn scale_c(self, mask: Self::Mask, factor: Self::Element) -> Self

Scales each element in the vector by the given factor. Read more
Source§

fn scale_m(self, src: Self, mask: Self::Mask, factor: Self::Element) -> Self

Scales each element in the vector by the given factor. Read more
Source§

fn scale_z(self, mask: Self::Mask, factor: Self::Element) -> Self

Scales each element in the vector by the given factor. Read more
Source§

fn min_c(self, mask: Self::Mask, rhs: Self) -> Self

Return the minimum of two vectors, element-wise. Computes min when mask is true, returns self where false.
Source§

fn min_m(self, src: Self, mask: Self::Mask, rhs: Self) -> Self

Return the minimum of two vectors, element-wise. Merges min with src using mask.
Source§

fn min_z(self, mask: Self::Mask, rhs: Self) -> Self

Return the minimum of two vectors, element-wise. Computes min masked (zeroed where mask is false).
Source§

fn max_c(self, mask: Self::Mask, rhs: Self) -> Self

Return the maximum of two vectors, element-wise. Computes max when mask is true, returns self where false.
Source§

fn max_m(self, src: Self, mask: Self::Mask, rhs: Self) -> Self

Return the maximum of two vectors, element-wise. Merges max with src using mask.
Source§

fn max_z(self, mask: Self::Mask, rhs: Self) -> Self

Return the maximum of two vectors, element-wise. Computes max masked (zeroed where mask is false).
Source§

fn pairwise_sum(lo: Self, hi: Self) -> Self

Sums adjacent lane pairs from lo and hi, returning a vector of the same width. Read more
Source§

fn relaxed_pairwise_sum(lo: Self, hi: Self) -> Self

Like pairwise_sum, but may return a relaxed (implementation-defined) lane ordering for performance. Treat this as if randomly shuffling the result of pairwise_sum, with better performance than pairwise_sum. Read more
Source§

fn fast_to_signed_integer(self) -> Self::Signed

Like to_signed_integer, but may relax IEEE corner cases (out-of-range and NaN inputs) for speed. Defaults to the exact form.
Source§

fn fast_to_unsigned_integer(self) -> Self::Unsigned

Like to_unsigned_integer, but may relax IEEE corner cases. Defaults to the exact form.
Source§

fn sort(self) -> Self

Sort the lanes ascending. Shorthand for sort_by::<Ascending>.
Source§

fn bitonic_clean(self) -> Self

Sort the lanes of a bitonic vector ascending. Shorthand for bitonic_clean_by::<Ascending>.
Source§

impl<V: PartialEq> PartialEq for Complex<V>

Source§

fn eq(&self, other: &Complex<V>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<V: PartialOrd> PartialOrd for Complex<V>

Source§

fn partial_cmp(&self, other: &Complex<V>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<V: RealFloatVector> PartialOrdVector for Complex<V>

Source§

fn cmp_eq(self, other: Self) -> Self::Mask

Lane-wise self == other.
Source§

fn cmp_ne(self, other: Self) -> Self::Mask

Lane-wise self != other.
Source§

fn cmp_lt(self, other: Self) -> Self::Mask

Lane-wise self < other.
Source§

fn cmp_gt(self, other: Self) -> Self::Mask

Lane-wise self > other.
Source§

fn cmp_le(self, other: Self) -> Self::Mask

Lane-wise self <= other.
Source§

fn cmp_ge(self, other: Self) -> Self::Mask

Lane-wise self >= other.
Source§

fn group_by_value(self, valid: Self::Mask) -> ValueGroups<Self>

Partition the lanes selected by valid into groups of equal value. Read more
Source§

impl<V: RealValue> Product for Complex<V>

Source§

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

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<V: RealValue> Rem for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<V: RealValue> Rem<V> for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: V) -> Self

Performs the % operation. Read more
Source§

impl<V: RealValue, T> RemAssign<T> for Complex<V>
where Self: Rem<T, Output = Self>,

Source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation. Read more
Source§

impl<V: RealFloatVector, Rhs> RemAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Rem<Rhs, Output = Self>,

Source§

fn rem_assign_c(&mut self, mask: V::Mask, rhs: Rhs)

Computes RemAssign with rhs where mask is true.
Source§

fn rem_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)

Merges RemAssign with src using mask, assigning src where mask is false.
Source§

fn rem_assign_z(&mut self, mask: V::Mask, rhs: Rhs)

Computes RemAssign masked (zeroed where mask is false).
Source§

impl<V: RealFloatVector, Rhs> RemMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Rem<Rhs, Output = Self>,

Source§

fn rem_c(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Rem with rhs where mask is true.
Source§

fn rem_m(self, src: Self, mask: V::Mask, rhs: Rhs) -> Self

Merges Rem with src using mask, returning src where mask is false.
Source§

fn rem_z(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Rem masked (zeroed where mask is false).
Source§

impl<E: RealValue + FloatElement> SignedElement for Complex<E>

Source§

fn abs(self) -> Self

The modulus $|z|$, as a real complex number.

Source§

fn signum(self) -> Self

$z/|z|$, the unit complex number along z, and zero at the origin.

Source§

impl<V: RealFloatVector> SignedVector for Complex<V>

Source§

fn abs(self) -> Self

The modulus $|z|$, as a real complex number.

Source§

fn signum(self) -> Self

$z/|z|$, the unit complex number along z, and zero at the origin.

Preserves the real identity abs(z) * signum(z) == z.

Source§

const NEG_ONE: Self

A vector of the value “-1” in the element type.
Source§

const MIN_POSITIVE: Self

A vector of the smallest positive (non-zero) value in the element type.
Source§

fn is_positive(self) -> Self::Mask

For each element in the vector, return a mask indicating whether that element is negative.
Source§

fn is_negative(self) -> Self::Mask

For each element in the vector, return a mask indicating whether that element is positive.
Source§

fn select_negative(self, if_neg: Self, if_pos: Self) -> Self

Based on if self is negative, select between if_neg and if_pos.
Source§

fn copysign(self, sign: Self) -> Self

For each element in the vector, set the sign of that element to the sign of the corresponding element in the other vector.
Source§

fn abs_c(self, mask: Self::Mask) -> Self

Take the absolute value of the vector, element-wise. Computes abs when mask is true, returns self where false.
Source§

fn abs_m(self, src: Self, mask: Self::Mask) -> Self

Take the absolute value of the vector, element-wise. Merges abs with src using mask.
Source§

fn abs_z(self, mask: Self::Mask) -> Self

Take the absolute value of the vector, element-wise. Computes abs masked (zeroed where mask is false).
Source§

fn copysign_c(self, mask: Self::Mask, rhs: Self) -> Self

For each element in the vector, set the sign of that element to the sign of the corresponding element in the other vector. Computes copysign when mask is true, returns self where false.
Source§

fn copysign_m(self, src: Self, mask: Self::Mask, rhs: Self) -> Self

For each element in the vector, set the sign of that element to the sign of the corresponding element in the other vector. Merges copysign with src using mask.
Source§

fn copysign_z(self, mask: Self::Mask, rhs: Self) -> Self

For each element in the vector, set the sign of that element to the sign of the corresponding element in the other vector. Computes copysign masked (zeroed where mask is false).
Source§

impl<V: RealFloatVector> SortKey<Complex<V>> for Complex<V>

The lane-sort key: strictly-before under the lexicographic (re, im) order, i.e. cmp_lt. See thermite::sort::SortKey for why this is a static trait method and not a closure.

Source§

fn key_lt(a: Self, b: Self) -> V::Mask

Which lanes of a sort strictly before those of b, by the key.
Source§

impl<V: RealFloatVector> SpecializedComplexMath<Complex<<V as GenericVector>::Element>> for Complex<V>

Source§

fn norm<P: Policy>(self) -> V

The modulus (magnitude) |z|.
Source§

fn arg<P: Policy>(self) -> V

The principal argument arg(z), in (-pi, pi].
Source§

fn from_polar<P: Policy>(r: V, theta: V) -> Self

Builds a complex number from a polar representation r * exp(i*theta).
Source§

fn powfr<P: Policy>(self, e: V) -> Self

Raises self to a real power.
Source§

fn expf<P: Policy>(self, base: V) -> Self

Raises a real base to the complex power self.
Source§

fn logr<P: Policy>(self, base: V) -> Self

The logarithm of self in an arbitrary real base.
Source§

fn finv<P: Policy>(self) -> Self

1/self, scaling by the modulus and not its square. Read more
Source§

fn to_polar<P: Policy>(self) -> (Self::Real, Self::Real)

Polar form (r, theta), such that self == r * exp(i*theta).
Source§

fn fdiv<P: Policy>(self, rhs: Self) -> Self

self/rhs, scaling by the modulus and not its square. Read more
Source§

impl<E, V: FloatVector<Element = E>, const N: usize> SpecializedComplexSpecialMath<Complex<Dual<E, N>>> for Complex<Dual<V, N>>
where E: FloatElementWithBits + DualValue, Dual<V, N>: RealFloatVector<Element = Dual<E, N>>,

Available on crate features dual and special only.
Source§

fn complex_trigamma<P: Policy>(self) -> Self

The shared body is already generic over RealValue, so it differentiates itself; all Dual has to supply is the same table with zero derivative parts, which is what Dual::constant means.

This is psi_2 by forward-mode AD, without a tetragamma ever being written.

Source§

fn complex_tgamma<P: Policy>(self) -> Self

Source§

fn complex_lgamma<P: Policy>(self) -> Self

Source§

fn complex_digamma<P: Policy>(self) -> Self

Source§

fn complex_lambert_w<P: Policy>(self) -> (Self, Self)

Source§

fn faddeeva_w<P: Policy>(self) -> Self

The Faddeeva function $w(z) = e^{-z^2}\operatorname{erfc}(-iz)$. Read more
Source§

fn erfcx<P: Policy>(self) -> Self

$\operatorname{erfcx}(z) = e^{z^2}\operatorname{erfc}(z) = w(iz)$. Read more
Source§

fn voigt<P: Policy>(self) -> Self::Real

The Voigt function $K(x, y) = \operatorname{Re} w(x + iy)$, the convolution of a Gaussian and a Lorentzian in normalized coordinates, as a real value. Read more
Source§

fn complex_beta<P: Policy>(self, b: Self) -> Self

$B(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$ Read more
Source§

impl<V: RealFloatVector<Element = f32>> SpecializedComplexSpecialMath<Complex<f32>> for Complex<V>

Available on crate feature special only.
Source§

fn complex_tgamma<P: Policy>(self) -> Self

Source§

fn complex_lgamma<P: Policy>(self) -> Self

Source§

fn complex_digamma<P: Policy>(self) -> Self

Source§

fn complex_trigamma<P: Policy>(self) -> Self

Source§

fn complex_lambert_w<P: Policy>(self) -> (Self, Self)

Source§

fn faddeeva_w<P: Policy>(self) -> Self

The Faddeeva function $w(z) = e^{-z^2}\operatorname{erfc}(-iz)$. Read more
Source§

fn erfcx<P: Policy>(self) -> Self

$\operatorname{erfcx}(z) = e^{z^2}\operatorname{erfc}(z) = w(iz)$. Read more
Source§

fn voigt<P: Policy>(self) -> Self::Real

The Voigt function $K(x, y) = \operatorname{Re} w(x + iy)$, the convolution of a Gaussian and a Lorentzian in normalized coordinates, as a real value. Read more
Source§

fn complex_beta<P: Policy>(self, b: Self) -> Self

$B(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$ Read more
Source§

impl<V: RealFloatVector<Element = f64>> SpecializedComplexSpecialMath<Complex<f64>> for Complex<V>

Available on crate feature special only.
Source§

fn complex_tgamma<P: Policy>(self) -> Self

Source§

fn complex_lgamma<P: Policy>(self) -> Self

Source§

fn complex_digamma<P: Policy>(self) -> Self

Source§

fn complex_trigamma<P: Policy>(self) -> Self

Source§

fn complex_lambert_w<P: Policy>(self) -> (Self, Self)

Source§

fn faddeeva_w<P: Policy>(self) -> Self

The Faddeeva function $w(z) = e^{-z^2}\operatorname{erfc}(-iz)$. Read more
Source§

fn erfcx<P: Policy>(self) -> Self

$\operatorname{erfcx}(z) = e^{z^2}\operatorname{erfc}(z) = w(iz)$. Read more
Source§

fn voigt<P: Policy>(self) -> Self::Real

The Voigt function $K(x, y) = \operatorname{Re} w(x + iy)$, the convolution of a Gaussian and a Lorentzian in normalized coordinates, as a real value. Read more
Source§

fn complex_beta<P: Policy>(self, b: Self) -> Self

$B(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$ Read more
Source§

impl<V: RealFloatVector> SpecializedCoreMath<Complex<<V as GenericVector>::Element>> for Complex<V>

Source§

fn poly_rational<P: Policy, const N: usize, const D: usize>( self, numerator: &[Complex<V::Element>; N], denominator: &[Complex<V::Element>; D], ) -> Self

P(z)/Q(z), evaluated directly or through 1/z depending on which is better conditioned.

Overridden only to change which quantity that decision is made on. The generic default tests x.cmp_gt(ONE), which over C is the lexicographic order on (re, im) - so it keys off the real part alone and will happily evaluate the direct form at z = 10^150 i, overflowing, while reporting that z is “not greater than one”. The condition that actually matters is |z| > 1.

Both forms are the same rational function (P_rev(1/z)/Q_rev(1/z) differs from P(z)/Q(z) only by z^(D-N), corrected below), so this is a conditioning fix, not a correctness one - except where the wrong choice overflows outright.

Source§

fn inverse_sqrt<P: Policy>(self) -> Self

Source§

fn poly<P, const N: usize>(self, coeffs: &[E; N]) -> Self
where P: Policy,

Source§

fn poly_rev<P, const N: usize>(self, coeffs: &[E; N]) -> Self
where P: Policy,

Source§

fn reciprocal<P>(self) -> Self
where P: Policy,

Source§

fn approx_div<P>(self, rhs: Self) -> Self
where P: Policy,

Source§

fn reciprocal_adde<P>(self, a: Self) -> Self
where P: Policy,

Source§

fn powi<P>(self, e: i32) -> Self
where P: Policy,

Source§

fn powic<P, const N: i32>(self) -> Self
where P: Policy,

Source§

fn powiv<P>(self, e: Self::Signed) -> Self
where P: Policy,

Source§

impl<V: RealFloatVector> SpecializedSpatialMath<Complex<<V as GenericVector>::Element>> for Complex<V>

Source§

fn hypot_n<P: Policy, const N: usize>(values: [Self; N]) -> Self

$\sqrt{\sum_i |z_i|^2}$, as a real complex number.

Must be overridden, and not only for tuning. The generic hypot_n changes meaning over C depending on the precision policy: its high-precision path opens with abs(), which here is the modulus, so everything after it is real and the result is the norm - but the PrecisionPolicy::Worst path skips that and squares directly, giving the analytic continuation sqrt(sum z_i^2) instead. Two different functions behind one name, chosen by a policy.

This pins the norm, matching l2_norm and the crate docs. Taking the modulus of each term first costs N extra square roots and buys the same overflow safety the real hypot_n has.

Source§

fn inv_hypot_n<P: Policy, const N: usize>(values: [Self; N]) -> Self

$1/\sqrt{\sum_i |z_i|^2}$, as a real complex number. See hypot_n.

Source§

fn l1_norm<P: Policy>(self) -> Self

|re| + |im|, as a real complex number.

Source§

fn l2_norm_squared<P: Policy>(self) -> Self

$|z|^2 = z\bar{z}$, as a real complex number.

Source§

fn l2_norm<P: Policy>(self) -> Self

The modulus $|z|$, as a real complex number.

The default sqrt(l2_norm_squared()) squares the range and overflows for large components; hypot does not.

Source§

fn hypot<P>(self, y: Self) -> Self
where P: Policy,

Source§

impl<E, V: RealFloatVector<Element = E>> SpecializedSpecialMath<Complex<E>> for Complex<V>

Available on crate feature special only.
Source§

fn erf<P: Policy>(self) -> Self

The error function over the whole complex plane.

erf is entire and odd. The negative-real half-plane comes from erf(-z) = -erf(z), a conditional negation, not a branch.

Source§

fn erfc<P: Policy>(self) -> Self

The complementary error function over the whole complex plane.

The 1 - erf(z) default cancels for large Re z, where erfc is the function one wants in the first place; the continued fraction computes it directly there. The negative half-plane uses erfc(z) = 2 - erfc(-z).

Source§

fn logistic_sigmoid<P: Policy>(self) -> Self

$\sigma(z) = \frac{1}{1 + e^{-z}}$

The default stabilizes for the real axis by negating on is_positive() and selecting, neither of which is holomorphic. The plain definition is, and the default itself falls back to it at lower precision policies.

Source§

fn softplus<P: Policy>(self, k: Self, rcp_k: Self) -> Self

$\frac{1}{k}\ln(1 + e^{kz})$

The default’s max(x, 0) + ln1p(e^{-|kx|}) is the real-axis overflow-stable rearrangement, and neither |x| nor max is holomorphic. This uses the analytic definition, and so overflows for large Re(kz) where the real form would not.

Source§

fn lambert_w<P: Policy>(self) -> (Self, Self)

Both $W_0$ and $W_{-1}$ are genuine branches of the complex Lambert W, so the real signature carries over unchanged - it simply cannot reach $W_k$ for $|k| \ge 2$.

Source§

type ExpIntDetails = Complex<V>

Per-arithmetic details of the expint kernel. Almost always Self, with an empty ExpIntDetails impl taking every default.
Source§

fn tgamma<P: Policy>(self) -> Self

Source§

fn lgamma<P: Policy>(self) -> Self

Source§

fn digamma<P: Policy>(self) -> Self

Source§

fn trigamma<P: Policy>(self) -> Self

The trigamma function psi_1(x) = d/dx psi(x), the second derivative of ln Gamma. Read more
Source§

fn beta<P: Policy>(a: Self, b: Self) -> Self

Source§

fn expint<P, const N: usize>(self) -> Self
where P: Policy,

Computes the exponential integral E_N(x) for integer order N.
Source§

fn expint_primal<P, const N: usize>(self) -> (Self, Self)
where P: Policy,

Computes $E_N(x)$ together with the adjacent lower order $E_{N-1}(x)$. Read more
Source§

fn hermite<P, const N: usize>(x: Self) -> Self
where P: Policy,

Source§

fn hermitev<P>(x: Self, n: Self::Unsigned) -> Self
where P: Policy,

Source§

fn chebyshev<P, const K: usize, const N: usize>( self, coeffs: &[Self::Element; N], ) -> Self
where P: Policy,

Source§

fn jacobi<P>(x: Self, alpha: Self, beta: Self, n: u32, m: u32) -> Self
where P: Policy,

Source§

fn gaussian<P>(x: Self, a: Self, c: Self) -> Self
where P: Policy,

Source§

fn legendre0<P, const N: u32>(x: Self, n: u32) -> Self
where P: Policy,

Source§

fn legendre<P>(x: Self, n: u32, m: u32) -> Self
where P: Policy,

Source§

impl<V: RealFloatVector> SpecializedTranscendentalMath<Complex<<V as GenericVector>::Element>> for Complex<V>

Source§

fn sin_cos<P: Policy>(self) -> (Self, Self)

sin(a + bi) = sin(a)cosh(b) + i*cos(a)sinh(b), cos(a + bi) = cos(a)cosh(b) - i*sin(a)sinh(b).

Source§

fn sincos_pi<P: Policy>(self) -> (Self, Self)

$\sin(\pi z)$ and $\cos(\pi z)$, from the real sincos_pi.

Must be overridden rather than left to the default. That default is sin_cos(z * pi), which rounds pi * Re z before doing any reduction and so throws away the exact argument reduction real sincos_pi performs near the integers - precisely where the Gamma reflection formulas put their poles, and where sin(pi z) passes through zero. It is also no more work: one real sincos_pi and one real sinh_cosh, the same two calls the default makes.

Source§

fn tan<P: Policy>(self) -> Self

$\tan(a + bi) = \frac{\sin 2a + i\sinh 2b}{\cos 2a + \cosh 2b}$

The doubled-angle form takes one real division, where the default (sin_cos then a complex divide) takes a complex one.

Under check_overflow the saturation is handled: $\tan(z) \to i\,\mathrm{sign}(b)$ as $|b|$ grows, but $\sinh$ and $\cosh$ both overflow past $|2b| \approx 710$ and the quotient becomes inf/inf. tan(1 + 400i) was NaN.

Source§

fn sinh_cosh<P: Policy>(self) -> (Self, Self)

sinh(a + bi) = sinh(a)cos(b) + i*cosh(a)sin(b), cosh(a + bi) = cosh(a)cos(b) + i*sinh(a)sin(b).

Source§

fn tanh<P: Policy>(self) -> Self

tanh(a + bi) = (sinh(2a) + i*sin(2b)) / (cosh(2a) + cos(2b)).

Saturates to $\mathrm{sign}(a)$ for large $|a|$ under check_overflow; see tan, of which this is the transpose.

Source§

fn sinc<P: Policy>(self) -> Self

$\mathrm{sinc}(z) = \sin(z)/z$, with the removable singularity filled in.

Source§

fn sinc_pi<P: Policy>(self) -> Self

$\mathrm{sinc}_\pi(z) = \frac{\sin(\pi z)}{\pi z}$, singularity filled in.

Overridden so the zeros are exact. The default is sinc(z * pi), which rounds pi * Re z before reducing; the subsequent division by pi z cancels most of that error, so the default is accurate to about an ulp - but at a non-zero integer it returns ~1e-16 rather than zero. Going through the real sin_pi, which is exactly zero there, makes this exactly zero too.

That is the property that makes sinc_pi an interpolating kernel: Lanczos and sinc resampling reproduce their samples only if the kernel vanishes at every non-zero integer.

Source§

fn exp<P: Policy>(self) -> Self

e^(a + bi) = e^a * (cos(b) + i*sin(b)).

Source§

fn exph<P: Policy>(self) -> Self

exph(z) = e^z / 2.

Source§

fn exp2<P: Policy>(self) -> Self

$2^z = 2^a e^{ib\ln 2}$.

§Policy

Above Average the real part goes through the real exp2. Rescaling it as exp(a ln 2) instead rounds a ln 2 first, and exp then amplifies that rounding by the argument - exp2(1000) is wrong in its tenth digit (~300 ulp) that way. The imaginary part can afford the multiply either way, feeding a sincos that reduces its own argument.

At or below Average the rescaled form is used, exp2 being the more expensive kernel and 300 ulp being well inside that tier’s budget.

Source§

fn exp10<P: Policy>(self) -> Self

$10^z = 10^a e^{ib\ln 10}$. See exp2, including the policy split.

Source§

fn exp_m1<P: Policy>(self) -> Self

$e^z - 1$, without the cancellation of forming $e^z$ and subtracting one.

Source§

fn exp2_m1<P: Policy>(self) -> Self

$2^z - 1$. Through the real exp2_m1 above Average, as exp2 is.

Source§

fn exp10_m1<P: Policy>(self) -> Self

$10^z - 1$. Through the real exp10_m1 above Average, as exp10 is.

Source§

fn powf<P: Policy>(self, e: Self) -> Self

z^w, the principal value.

Source§

fn cbrt<P: Policy>(self) -> Self

The principal cube root.

This does not agree with the real cube root of a negative real: the real cube root of -8 is -2, the principal complex one $1 + i\sqrt{3}$.

Source§

fn nth_root<P: Policy, const N: usize>(self) -> Self

The principal Nth root, $z^{1/N} = |z|^{1/N} e^{i\arg(z)/N}$.

The trait default is real-only: for odd N it takes abs() and restores the sign afterwards, which over C collapses z to its modulus and returns a real root.

Source§

fn ln<P: Policy>(self) -> Self

The principal natural logarithm: ln(z) = ln|z| + i*arg(z).

Branch cut on (-inf, 0], continuous from above; -pi <= Im(ln z) <= pi.

Source§

fn ln_1p<P: Policy>(self) -> Self

$\ln(1 + z)$, without the cancellation of forming 1 + z first.

Source§

fn log2<P: Policy>(self) -> Self

$\log_2 z = \log_2|z| + i\arg(z)\log_2 e$.

Through the real log2 rather than ln(z) * log2(e), which is the same work (one multiply fewer, in fact - the argument is scaled but ln|z| is not) and picks up whatever the element’s own log2 does. Measured identical to the rescaled form on f64, where thermite’s log2 is ln * LOG2_E; f32 has a dedicated kernel, so no policy gate is warranted either way.

Source§

fn log10<P: Policy>(self) -> Self

$\log_{10} z = \log_{10}|z| + i\arg(z)\log_{10} e$. See log2.

Source§

fn log_n<P: Policy, const N: usize>(self) -> Self

log_N(z) = ln(z) / ln(N) for a compile-time integer base.

Source§

fn ln1m_expnx_ext<P: Policy>(self, _lnx: Self) -> Self

$\ln(1 - e^{-z})$.

The _ext form lets a real vector reuse an already-computed ln(x). There is no such shortcut over C, so it forwards to the plain form.

Source§

fn asin<P: Policy>(self) -> Self

asin(z) = -i ln(iz + sqrt(1 - z^2)).

Branch cuts on (-inf, -1) (continuous from above) and (1, inf) (continuous from below); -pi/2 <= Re(asin z) <= pi/2.

Source§

fn acos<P: Policy>(self) -> Self

acos(z) = -i ln(z + i sqrt(1 - z^2)).

Branch cuts on (-inf, -1) and (1, inf); 0 <= Re(acos z) <= pi.

Source§

fn atan<P: Policy>(self) -> Self

atan(z) = (ln(1 + iz) - ln(1 - iz)) / (2i).

Branch cuts on (-inf*i, -i] and [i, inf*i); -pi/2 <= Re(atan z) <= pi/2.

Source§

fn asinh<P: Policy>(self) -> Self

asinh(z) = ln(z + sqrt(1 + z^2)).

Source§

fn acosh<P: Policy>(self) -> Self

acosh(z) = 2 ln(sqrt((z+1)/2) + sqrt((z-1)/2)).

Branch cut on (-inf, 1), continuous from above.

Source§

fn atanh<P: Policy>(self) -> Self

atanh(z) = (ln(1 + z) - ln(1 - z)) / 2.

Branch cuts on (-inf, -1] and [1, inf).

Source§

fn sin<P>(self) -> Self
where P: Policy,

Source§

fn cos<P>(self) -> Self
where P: Policy,

Source§

fn sin_pi<P>(self) -> Self
where P: Policy,

Source§

fn cos_pi<P>(self) -> Self
where P: Policy,

Source§

fn tan_pi<P>(self) -> Self
where P: Policy,

Source§

fn sinh<P>(self) -> Self
where P: Policy,

Source§

fn cosh<P>(self) -> Self
where P: Policy,

Source§

fn sqrt1pm1<P>(self) -> Self
where P: Policy,

Source§

fn compound<P>(self, n: Self) -> Self
where P: Policy,

Source§

fn powf_m1<P>(self, e: Self) -> Self
where P: Policy,

Source§

fn haversin<P>(self) -> Self
where P: Policy,

Source§

fn versin<P>(self) -> Self
where P: Policy,

Source§

fn cos_m1<P>(self) -> Self
where P: Policy,

Source§

fn log2_p1<P>(self) -> Self
where P: Policy,

Source§

fn log10_p1<P>(self) -> Self
where P: Policy,

Source§

fn log<P>(self, base: Self) -> Self
where P: Policy,

Source§

fn ln1m_expnx<P>(self) -> Self
where P: Policy,

ln(1 - e^(-x))
Source§

impl<V: RealFloatVector> SplatVector<Complex<<V as GenericVector>::Element>> for Complex<V>

Source§

type Splat<T: SplatConst<Complex<V::Element>>> = Complex<V>

For a given constant carrier T, the type exposing the splatted vector constant via VectorValue.
Source§

impl<V: RealValue> Square for Complex<V>

Source§

type Output = Complex<V>

The squared value. Not always Self: a type may widen to hold the product.
Source§

fn square(self) -> Self

Computes self * self.
Source§

impl<V: RealFloatVector> SquareMasked<<V as GenericVector>::Mask> for Complex<V>

Source§

fn square_c(self, mask: V::Mask) -> Self::Output

Computes Square where mask is true, does nothing where false.
Source§

fn square_m(self, src: Self, mask: V::Mask) -> Self::Output

Merges Square with src using mask, returning src where mask is false.
Source§

fn square_z(self, mask: V::Mask) -> Self::Output

Computes Square masked (zeroed where mask is false).
Source§

impl<V: PartialEq> StructuralPartialEq for Complex<V>

Source§

impl<V: RealValue> Sub for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<V: RealValue> Sub<V> for Complex<V>

Source§

type Output = Complex<V>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: V) -> Self

Performs the - operation. Read more
Source§

impl<V: RealValue, T> SubAssign<T> for Complex<V>
where Self: Sub<T, Output = Self>,

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl<V: RealFloatVector, Rhs> SubAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Sub<Rhs, Output = Self>,

Source§

fn sub_assign_c(&mut self, mask: V::Mask, rhs: Rhs)

Computes SubAssign with rhs where mask is true.
Source§

fn sub_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)

Merges SubAssign with src using mask, assigning src where mask is false.
Source§

fn sub_assign_z(&mut self, mask: V::Mask, rhs: Rhs)

Computes SubAssign masked (zeroed where mask is false).
Source§

impl<V: RealFloatVector, Rhs> SubMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
where Complex<V>: Sub<Rhs, Output = Self>,

Source§

fn sub_c(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Sub with rhs where mask is true.
Source§

fn sub_m(self, src: Self, mask: V::Mask, rhs: Rhs) -> Self

Merges Sub with src using mask, returning src where mask is false.
Source§

fn sub_z(self, mask: V::Mask, rhs: Rhs) -> Self

Computes Sub masked (zeroed where mask is false).
Source§

impl<V: RealValue> Sum for Complex<V>

Source§

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

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<V: RealFloatVector> Swizzle<<V as GenericVector>::Lanes> for Complex<V>

Source§

fn swizzle(self, other: Self, indices: GenericArray<u32, V::Lanes>) -> Self

Swizzle lanes from two vectors according to the given indices.
Source§

fn permute(self, indices: GenericArray<u32, V::Lanes>) -> Self

Permute lanes from a single vector according to the given indices.
Source§

fn swizzle_const<I: SwizzleIndices<V::Lanes>>(self, other: Self) -> Self

Source§

fn permute_const<I: SwizzleIndices<V::Lanes>>(self) -> Self

Source§

impl<V: RealFloatVector, E: SplatConst<Complex<V::Element>>> VectorValue<E, Complex<V>> for Complex<V>

Source§

const VALUE: Complex<V>

The materialized vector constant.

Auto Trait Implementations§

§

impl<V> Freeze for Complex<V>
where V: Freeze,

§

impl<V> RefUnwindSafe for Complex<V>
where V: RefUnwindSafe,

§

impl<V> Send for Complex<V>
where V: Send,

§

impl<V> Sync for Complex<V>
where V: Sync,

§

impl<V> Unpin for Complex<V>
where V: Unpin,

§

impl<V> UnsafeUnpin for Complex<V>
where V: UnsafeUnpin,

§

impl<V> UnwindSafe for Complex<V>
where V: 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<V, Mask, Rhs> AssignMaskedNumOps<Mask, Rhs> for V
where V: AddAssignMasked<Mask, Rhs> + SubAssignMasked<Mask, Rhs> + MulAssignMasked<Mask, Rhs> + DivAssignMasked<Mask, Rhs> + RemAssignMasked<Mask, Rhs>,

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CompensatedGammaOps for T

Source§

impl<M> ComplexMath for M

Source§

fn norm(self) -> Self::Real

The modulus $|z|$, as a real value. Read more
Source§

fn arg(self) -> Self::Real

The principal argument arg(z), in (-pi, pi], as a real value.
Source§

fn to_polar(self) -> (Self::Real, Self::Real)

Converts to polar form (r, theta), such that self == r * exp(i*theta).
Source§

fn from_polar(r: Self::Real, theta: Self::Real) -> Self

Builds a complex number from a polar representation r * exp(i*theta).
Source§

fn powfr(self, e: Self::Real) -> Self

Raises self to a real power. Read more
Source§

fn expf(self, base: Self::Real) -> Self

Raises a real base to the complex power self.
Source§

fn logr(self, base: Self::Real) -> Self

The logarithm of self in an arbitrary real base. Read more
Source§

fn finv(self) -> Self

1/self, scaling by the modulus and not its square. Read more
Source§

fn fdiv(self, rhs: Self) -> Self

self/rhs, scaling by the modulus and not its square. Read more
Source§

impl<E, V> ComplexMathWithPolicy for V

Source§

fn norm_p<P>(self) -> <V as ComplexVector>::Real
where P: Policy,

The modulus $|z|$, as a real value.

Uses hypot, so it does not overflow for large components the way sqrt(norm_sqr()) would.

Source§

fn arg_p<P>(self) -> <V as ComplexVector>::Real
where P: Policy,

The principal argument arg(z), in (-pi, pi], as a real value.

Source§

fn to_polar_p<P>( self, ) -> (<V as ComplexVector>::Real, <V as ComplexVector>::Real)
where P: Policy,

Converts to polar form (r, theta), such that self == r * exp(i*theta).

Source§

fn from_polar_p<P>( r: <V as ComplexVector>::Real, theta: <V as ComplexVector>::Real, ) -> V
where P: Policy,

Builds a complex number from a polar representation r * exp(i*theta).

Source§

fn powfr_p<P>(self, e: <V as ComplexVector>::Real) -> V
where P: Policy,

Raises self to a real power.

The complex-exponent form is powf.

Source§

fn expf_p<P>(self, base: <V as ComplexVector>::Real) -> V
where P: Policy,

Raises a real base to the complex power self.

Source§

fn logr_p<P>(self, base: <V as ComplexVector>::Real) -> V
where P: Policy,

The logarithm of self in an arbitrary real base.

The complex-base form is log.

Source§

fn finv_p<P>(self) -> V
where P: Policy,

1/self, scaling by the modulus and not its square.

Survives the magnitudes where inv would have norm_sqr() overflow to infinity or underflow to zero.

Source§

fn fdiv_p<P>(self, rhs: V) -> V
where P: Policy,

self/rhs, scaling by the modulus and not its square.

Survives the magnitudes where / would have rhs.norm_sqr() overflow to infinity or underflow to zero.

Source§

impl<M> ComplexSpecialMath for M

Source§

fn faddeeva_w(self) -> Self

Available on crate feature special only.
$w(z) = e^{-z^2}\operatorname{erfc}(-iz)$, the Faddeeva function (also the complex error function, or the plasma dispersion function up to a factor). Read more
Source§

fn erfcx(self) -> Self

Available on crate feature special only.
$\operatorname{erfcx}(z) = e^{z^2}\operatorname{erfc}(z) = w(iz)$, the scaled complementary error function.
Source§

fn voigt(self) -> Self::Real

Available on crate feature special only.
The Voigt function $K(x, y) = \operatorname{Re} w(x + iy)$, as a real value.
Source§

impl<E, V> ComplexSpecialMathWithPolicy for V

Source§

fn faddeeva_w_p<P>(self) -> V
where P: Policy,

Available on crate feature special only.

$w(z) = e^{-z^2}\operatorname{erfc}(-iz)$, the Faddeeva function (also the complex error function, or the plasma dispersion function up to a factor).

See faddeeva for the algorithm, the accuracy ladder, and the one caveat that matters ($\operatorname{Re} w$ near the real axis).

Source§

fn erfcx_p<P>(self) -> V
where P: Policy,

Available on crate feature special only.

$\operatorname{erfcx}(z) = e^{z^2}\operatorname{erfc}(z) = w(iz)$, the scaled complementary error function.

Source§

fn voigt_p<P>(self) -> <V as ComplexVector>::Real
where P: Policy,

Available on crate feature special only.

The Voigt function $K(x, y) = \operatorname{Re} w(x + iy)$, as a real value.

Source§

impl<M> CoreMath for M

Source§

fn poly<const N: usize>(self, coeffs: &[Self::Element; N]) -> Self

Computes the polynomial with the given coefficients at self. Read more
Source§

fn poly_rev<const N: usize>(self, coeffs: &[Self::Element; N]) -> Self

Computes the polynomial with the given coefficients at self, but with the coefficients in reverse order. Read more
Source§

fn poly_rational<const N: usize, const D: usize>( self, numerator: &[Self::Element; N], denominator: &[Self::Element; D], ) -> Self

Computes the ratio of two polynomials at self, given the numerator and denominator coefficients. Read more
Source§

fn reciprocal(self) -> Self

Returns the multiplicative inverse of self, which is 1 / self. Read more
Source§

fn approx_div(self, divisor: Self) -> Self

Returns the result of dividing self by divisor, i.e., self / divisor. Read more
Source§

fn inverse_sqrt(self) -> Self

Returns the inverse square root of self, which is 1 / sqrt(self). Read more
Source§

fn powi(self, e: i32) -> Self

Returns self raised to the signed integer power of e.
Source§

fn powiv(self, e: Self::Signed) -> Self

Returns self raised to the signed integer power of each element in e.
Source§

impl<E, V> CoreMathWithPolicy for V
where E: FloatElement, V: FloatVector<Element = E> + FloatVector + SpecializedCoreMath<E>,

Source§

fn poly_p<P, const N: usize>( self, coeffs: &[<V as GenericVector>::Element; N], ) -> V
where P: Policy,

Computes the polynomial with the given coefficients at self.

This will use fused multiply-add instructions where available for improved performance and accuracy, but falls back to standard operations if not.

Source§

fn poly_rev_p<P, const N: usize>( self, coeffs: &[<V as GenericVector>::Element; N], ) -> V
where P: Policy,

Computes the polynomial with the given coefficients at self, but with the coefficients in reverse order.

This will use fused multiply-add instructions where available for improved performance and accuracy, but falls back to standard operations if not.

Source§

fn poly_rational_p<P, const N: usize, const D: usize>( self, numerator: &[<V as GenericVector>::Element; N], denominator: &[<V as GenericVector>::Element; D], ) -> V
where P: Policy,

Computes the ratio of two polynomials at self, given the numerator and denominator coefficients.

Equivalent to poly(numerator) / poly(denominator), but with improved numerical stability in some cases.

This will use fused multiply-add instructions where available for improved performance and accuracy, but falls back to standard operations if not.

Source§

fn reciprocal_p<P>(self) -> V
where P: Policy,

Returns the multiplicative inverse of self, which is 1 / self.

If using the policy version, you may select lower precision policies for extra performance, at the cost of accuracy.

Source§

fn approx_div_p<P>(self, divisor: V) -> V
where P: Policy,

Returns the result of dividing self by divisor, i.e., self / divisor.

Depending on the precision policy and available features, this may be optimized to use approximate reciprocal and multiplication for better performance, at the cost of accuracy.

Source§

fn inverse_sqrt_p<P>(self) -> V
where P: Policy,

Returns the inverse square root of self, which is 1 / sqrt(self).

If using the policy version, you may select lower precision policies for extra performance, at the cost of accuracy.

Source§

fn powi_p<P>(self, e: i32) -> V
where P: Policy,

Returns self raised to the signed integer power of e.

Source§

fn powiv_p<P>(self, e: <V as GenericVector>::Signed) -> V
where P: Policy,

Returns self raised to the signed integer power of each element in e.

Source§

impl<T> ElementExt for T
where T: Element,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<V> GenericVector2 for V
where V: GenericVector<Lanes = UInt<UInt<UTerm, B1>, B0>>,

Source§

fn x(&self) -> Self::Element

Returns the value of lane 0.
Source§

fn y(&self) -> Self::Element

Returns the value of lane 1.
Source§

impl<V> GenericVector3 for V
where V: GenericVector<Lanes = UInt<UInt<UTerm, B1>, B1>>,

Source§

fn x(&self) -> Self::Element

Returns the value of lane 0.
Source§

fn y(&self) -> Self::Element

Returns the value of lane 1.
Source§

fn z(&self) -> Self::Element

Returns the value of lane 2.
Source§

impl<V> GenericVector4 for V
where V: GenericVector<Lanes = UInt<UInt<UInt<UTerm, B1>, B0>, B0>>,

Source§

fn x(&self) -> Self::Element

Returns the value of lane 0.
Source§

fn y(&self) -> Self::Element

Returns the value of lane 1.
Source§

fn z(&self) -> Self::Element

Returns the value of lane 2.
Source§

fn w(&self) -> Self::Element

Returns the value of lane 3.
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> LowerBounded for T
where T: Bounded,

Source§

fn min_value() -> T

Returns the smallest finite number this type can represent
Source§

impl<T, A, B> MaskInteroperable<A, B> for T

Source§

impl<V, Mask, Rhs> MaskedNumOps<Mask, Rhs> for V
where V: AddMasked<Mask, Rhs> + SubMasked<Mask, Rhs> + MulMasked<Mask, Rhs> + DivMasked<Mask, Rhs> + RemMasked<Mask, Rhs>,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<V, A, B> PartiallyInteroperable<A, B> for V

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<M> SpatialMath for M

Source§

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

Computes the Euclidean norm (hypotenuse) of self and other, i.e., sqrt(self^2 + other^2). Read more
Source§

fn hypot_n<const N: usize>(values: [Self; N]) -> Self

Computes the Euclidean norm (hypotenuse) of N values, i.e., $\sqrt{x_1^2 + x_2^2 + \dots + x_N^2}$. Read more
Source§

fn inv_hypot_n<const N: usize>(values: [Self; N]) -> Self

Computes the inverse Euclidean norm (inverse hypotenuse) of N values, i.e., $1/\sqrt{x_1^2 + x_2^2 + \dots + x_N^2}$. Read more
Source§

fn l1_norm(self) -> Self

L1 Norm, or the “Manhattan” distance from the origin. Read more
Source§

fn l2_norm(self) -> Self

L2 Norm, or the “Euclidean” distance from the origin. Read more
Source§

fn l2_norm_squared(self) -> Self

Squared L2 Norm, or the squared “Euclidean” distance from the origin. Read more
Source§

impl<E, V> SpatialMathWithPolicy for V

Source§

fn hypot_p<P>(self, other: V) -> V
where P: Policy,

Computes the Euclidean norm (hypotenuse) of self and other, i.e., sqrt(self^2 + other^2).

This is not higher performance than the naive implementation, but is more resistant to overflow and underflow. If using the worst precision policy, it becomes equivalent to the naive implementation.

Check out hypot_n for a more general version that computes the hypotenuse of N values.

Source§

fn hypot_n_p<P, const N: usize>(values: [V; N]) -> V
where P: Policy,

Computes the Euclidean norm (hypotenuse) of N values, i.e., $\sqrt{x_1^2 + x_2^2 + \dots + x_N^2}$.

This is typically higher performance than naively computing the sum of squares and then taking the square root, especially for larger N, and is more resistant to overflow and underflow when using average or higher precision policies.

Source§

fn inv_hypot_n_p<P, const N: usize>(values: [V; N]) -> V
where P: Policy,

Computes the inverse Euclidean norm (inverse hypotenuse) of N values, i.e., $1/\sqrt{x_1^2 + x_2^2 + \dots + x_N^2}$.

This is typically higher performance than naively computing the sum of squares, taking the square root, and then inverting, especially for larger N, and is more resistant to overflow and underflow when using average or higher precision policies.

At lower precision policies, we can take advantage of fast approximate inverse square root implementations for better performance.

Source§

fn l1_norm_p<P>(self) -> V
where P: Policy,

L1 Norm, or the “Manhattan” distance from the origin.

For 1D vectors, this is equivalent to the absolute value.

Source§

fn l2_norm_p<P>(self) -> V
where P: Policy,

L2 Norm, or the “Euclidean” distance from the origin.

For 1D vectors, this is equivalent to the absolute value.

Source§

fn l2_norm_squared_p<P>(self) -> V
where P: Policy,

Squared L2 Norm, or the squared “Euclidean” distance from the origin.

For 1D vectors, this is equivalent to squaring the value.

Source§

impl<M> SpecialMath for M

Source§

fn erf(self) -> Self

Computes the error function. Read more
Source§

fn erfc(self) -> Self

Computes the complementary error function.
Source§

fn logistic_sigmoid(self) -> Self

Computes the Logistic sigmoid function, defined as $\sigma(x) = \frac{1}{1 + e^{-x}}$. Read more
Source§

fn softplus(self, k: Self, rcp_k: Self) -> Self

Computes the softplus function, defined as $\frac{1}{k}\ln(1 + e^{kx})$. Read more
Source§

fn tgamma(self) -> Self

Computes the Gamma function ($\Gamma(z)$) for any real input, for each value in a vector. Read more
Source§

fn lgamma(self) -> Self

Computes the natural log of the Gamma function ($\ln|\Gamma(x)|$) for any real input, for each value in a vector.
Source§

fn digamma(self) -> Self

Computes the digamma function $\psi(x) = \frac{\mathrm{d}}{\mathrm{d}x}\ln\Gamma(x) = \frac{\Gamma'(x)}{\Gamma(x)}$ for any real input, for each value in a vector. Read more
Source§

fn beta(self, y: Self) -> Self

Computes the Beta function $\mathrm{B}(x, y)$
Source§

fn jacobi(self, alpha: Self, beta: Self, n: u32, m: u32) -> Self

Computes the m-th derivative of the n-th degree Jacobi polynomial Read more
Source§

fn hermite<const N: usize>(self) -> Self

Computes the N-th degree physicists’ Hermite polynomial H_n(x) where x is self and N is the polynomial degree. Read more
Source§

fn hermitev(self, n: Self::Unsigned) -> Self

Computes the n-th degree physicists’ Hermite polynomial H_n(x) where x is self and n is a vector of unsigned integers representing the polynomial degree. Read more
Source§

fn chebyshev<const K: usize, const N: usize>( self, coeffs: &[Self::Element; N], ) -> Self

Evaluates a finite series of Chebyshev polynomials of the K-th kind at x = self: Read more
Source§

fn gaussian(self, a: Self, c: Self) -> Self

Computes the Gaussian function with amplitude a and standard deviation c, defined as $a\, e^{-\frac{1}{2}(x/c)^2}$. Read more
Source§

fn legendre(self, n: u32, m: u32) -> Self

Computes the m-th associated n-th degree Legendre polynomial, where m=0 signifies the regular n-th degree Legendre polynomial. Read more
Source§

fn lambert_w(self) -> (Self, Self)

Computes both branches of the Lambert W function simultaneously: ($W_0(x)$, $W_{-1}(x)$). Read more
Source§

fn expint<const N: usize>(self) -> Self

Computes the generalized exponential integral E_n(x) for integer order n.
Source§

fn carlson<K>(kind: K) -> Self
where K: CarlsonKind<Output = Self>,

Carlson symmetric elliptic integral, selected by a CarlsonKind request struct with named fields - the arity (and which argument is the parameter / repeated one) is fixed per kind, so the wrong shape is a compile error. Read more
Source§

fn ellint<K>(kind: K) -> Self
where K: EllipticKind<Output = Self>,

Legendre elliptic integral, selected by an EllipticKind request struct. Each form (EllintK/EllintF/EllintE/ EllintEInc/EllintD/EllintDInc/ EllintPi/EllintPiInc) carries exactly its own arguments; completeness is encoded by whether the struct has a phi field. Read more
Source§

impl<E, V> SpecialMathWithPolicy for V

Source§

fn erf_p<P>(self) -> V
where P: Policy,

Computes the error function.

For f32 vectors, this is still decently accurate even with the Medium and Worst precision policies, thanks to good approximations that don’t rely on the precision of exp. Subsequently, performance of the lower precision policies is excellent. Furthermore, if using on a GPU with native exp support, all precision policies will have good performance and accuracy.

Source§

fn erfc_p<P>(self) -> V
where P: Policy,

Computes the complementary error function.

Source§

fn logistic_sigmoid_p<P>(self) -> V
where P: Policy,

Computes the Logistic sigmoid function, defined as $\sigma(x) = \frac{1}{1 + e^{-x}}$.

It’s worth mentioning that the derivative of the logistic sigmoid can be computed very cheaply from the output of the logistic sigmoid itself, in the form of:

let s = x.logistic_sigmoid();
let derivative = s * (1.0 - s); // or s.nmul_adde(s, s), which may be slightly faster

Notably, for f32 and f64 this implementation still has good precision for the Worst precision policy, and for the Best precision policies handles very large positive and negative inputs without overflow or underflow issues.

Source§

fn softplus_p<P>(self, k: V, rcp_k: V) -> V
where P: Policy,

Computes the softplus function, defined as $\frac{1}{k}\ln(1 + e^{kx})$.

This is a smooth approximation to the ReLU function that is more numerically stable for large inputs.

The parameter k controls the steepness of the curve, with larger values approaching ReLU more closely. Pass k = 1 and rcp_k = 1 for the standard softplus with no steepness scaling.

rcp_k must equal 1/k. It is passed explicitly so callers that invoke softplus repeatedly with the same k can pre-compute the reciprocal once rather than recomputing it per call.

To also obtain the derivative with respect to x, use softplus_d.

Source§

fn tgamma_p<P>(self) -> V
where P: Policy,

Computes the Gamma function ($\Gamma(z)$) for any real input, for each value in a vector.

This implementation uses a few different behaviors to ensure the greatest precision where possible.

  • For non-integer positive inputs, it uses the Lanczos approximation.
  • For small non-integer negative inputs, it uses the recursive identity $\Gamma(z) = \Gamma(z+1)/z$ until z is positive.
  • For large non-integer negative inputs, it uses the reflection formula $-\pi / (\Gamma(z)\sin(\pi z)\,z)$.
  • For positive integers, it simply computes the factorial in a tight loop to ensure precision. Lookup tables could not be used with SIMD.
  • At zero, the result will be positive or negative infinity based on the input sign (signed zero is a thing).

NOTE: The Gamma function is not defined for negative integers.

Source§

fn lgamma_p<P>(self) -> V
where P: Policy,

Computes the natural log of the Gamma function ($\ln|\Gamma(x)|$) for any real input, for each value in a vector.

Source§

fn digamma_p<P>(self) -> V
where P: Policy,

Computes the digamma function $\psi(x) = \frac{\mathrm{d}}{\mathrm{d}x}\ln\Gamma(x) = \frac{\Gamma'(x)}{\Gamma(x)}$ for any real input, for each value in a vector.

The argument is handled in three regimes:

  • For x >= 10, an asymptotic expansion in $1/x^2$ is used.
  • For smaller x, the recurrence $\psi(x) = \psi(x+1) - 1/x$ shifts the argument into [1, 2], where a rational minimax approximation $\psi(x) = (x - x_0)(Y + R(x-1))$ is used ($x_0$ is the positive root of $\psi$).
  • For x <= -1, the reflection formula $\psi(1-x) = \psi(x) + \pi\cot(\pi x)$ is applied.

NOTE: The digamma function is not defined at zero or the negative integers; those inputs yield NaN when overflow checking is enabled.

Source§

fn beta_p<P>(self, y: V) -> V
where P: Policy,

Computes the Beta function $\mathrm{B}(x, y)$

Source§

fn jacobi_p<P>(self, alpha: V, beta: V, n: u32, m: u32) -> V
where P: Policy,

Computes the m-th derivative of the n-th degree Jacobi polynomial

A the special case where α and β are both zero, the Jacobi polynomial reduces to a Legendre polynomial.

NOTE: Given constant α, β or n, LLVM will happily optimize those away and unroll loops.

Source§

fn hermite_p<P, const N: usize>(self) -> V
where P: Policy,

Computes the N-th degree physicists’ Hermite polynomial H_n(x) where x is self and N is the polynomial degree.

This uses the recurrence relation to compute the polynomial iteratively.

Source§

fn hermitev_p<P>(self, n: <V as GenericVector>::Unsigned) -> V
where P: Policy,

Computes the n-th degree physicists’ Hermite polynomial H_n(x) where x is self and n is a vector of unsigned integers representing the polynomial degree.

The polynomial is calculated independently per-lane with the given degree in n.

This uses the recurrence relation to compute the polynomial iteratively.

Source§

fn chebyshev_p<P, const K: usize, const N: usize>( self, coeffs: &[<V as GenericVector>::Element; N], ) -> V
where P: Policy,

Evaluates a finite series of Chebyshev polynomials of the K-th kind at x = self:

\sum_{k=0}^{N-1} \mathrm{coeffs}[k] \cdot P_k(x)

where P_k is T_k, U_k, V_k, or W_k depending on K. All four kinds share the recurrence $P_{k+1}(x) = 2x \cdot P_k(x) - P_{k-1}(x)$ with P_0(x) = 1; they differ only in P_1(x):

KKindP_1(x)Notes
1First (T_k)xMost common; minimax/approximation basis on [-1, 1].
2Second (U_k)2xRelated to $\sin((k+1)\theta)/\sin(\theta)$ under $x = \cos\theta$.
3Third (V_k)2x - 1“Airfoil” polynomials; $\cos((k+\tfrac12)\theta)/\cos(\theta/2)$.
4Fourth (W_k)2x + 1$\sin((k+\tfrac12)\theta)/\sin(\theta/2)$.

Any other value of K is a compile-time error.

Evaluation is done via Clenshaw’s backward recurrence with FMA, which is more numerically stable than a forward sum when the partial sums of $\sum c_k P_k$ are much smaller than $\max_k |c_k P_k|$ (e.g. fitted minimax series with alternating-sign coefficients). N is the length of the coefficient slice, so the highest polynomial term is P_{N-1}; N = 0 is rejected, N = 1 evaluates to coeffs[0].

coeffs[0] multiplies P_0 = 1, coeffs[1] multiplies P_1(x) (which depends on K), and so on. Because LLVM sees both K and N as constants, the recurrence loop and the P_1 selection are fully unrolled and specialized at monomorphization time.

Source§

fn gaussian_p<P>(self, a: V, c: V) -> V
where P: Policy,

Computes the Gaussian function with amplitude a and standard deviation c, defined as $a\, e^{-\frac{1}{2}(x/c)^2}$.

The position b is assumed to be zero. For a non-zero position, use self - b as the input.

Source§

fn legendre_p<P>(self, n: u32, m: u32) -> V
where P: Policy,

Computes the m-th associated n-th degree Legendre polynomial, where m=0 signifies the regular n-th degree Legendre polynomial.

If m is odd, the input is only valid between -1 and 1

NOTE: Given constant n and/or m, LLVM will happily unroll and optimize inner loops.

Internally, this is computed with jacobi when m > 0.

Source§

fn lambert_w_p<P>(self) -> (V, V)
where P: Policy,

Computes both branches of the Lambert W function simultaneously: ($W_0(x)$, $W_{-1}(x)$).

The $W_0$ result is valid for x >= -1/e; the $W_{-1}$ result is valid for -1/e <= x < 0. Outside these domains, the respective result is NaN (when overflow checking is enabled).

Source§

fn expint_p<P, const N: usize>(self) -> V
where P: Policy,

Computes the generalized exponential integral E_n(x) for integer order n.

Source§

fn carlson_p<P, K>(kind: K) -> V
where P: Policy, K: CarlsonKind<Output = V>,

Carlson symmetric elliptic integral, selected by a CarlsonKind request struct with named fields - the arity (and which argument is the parameter / repeated one) is fixed per kind, so the wrong shape is a compile error.

let rf = V::carlson(CarlsonRf { x, y, z });
let rj = V::carlson_p::<Precision, _>(CarlsonRj { x, y, z, p });
Source§

fn ellint_p<P, K>(kind: K) -> V
where P: Policy, K: EllipticKind<Output = V>,

Legendre elliptic integral, selected by an EllipticKind request struct. Each form (EllintK/EllintF/EllintE/ EllintEInc/EllintD/EllintDInc/ EllintPi/EllintPiInc) carries exactly its own arguments; completeness is encoded by whether the struct has a phi field.

let k_int = V::ellint(EllintK { k });                       // K(k)
let e_inc = V::ellint_p::<Precision, _>(EllintEInc { phi, k }); // E(phi, k)
Source§

impl<V> Swizzle3 for V
where V: SwizzleVector<Lanes = UInt<UInt<UTerm, B1>, B1>>,

Source§

fn xyz(self) -> V

Source§

fn xxx(self) -> V

Source§

fn xxy(self) -> V

Source§

fn xxz(self) -> V

Source§

fn xyx(self) -> V

Source§

fn xyy(self) -> V

Source§

fn xzx(self) -> V

Source§

fn xzy(self) -> V

Source§

fn xzz(self) -> V

Source§

fn yxx(self) -> V

Source§

fn yxy(self) -> V

Source§

fn yxz(self) -> V

Source§

fn yyx(self) -> V

Source§

fn yyy(self) -> V

Source§

fn yyz(self) -> V

Source§

fn yzx(self) -> V

Source§

fn yzy(self) -> V

Source§

fn yzz(self) -> V

Source§

fn zxx(self) -> V

Source§

fn zxy(self) -> V

Source§

fn zxz(self) -> V

Source§

fn zyx(self) -> V

Source§

fn zyy(self) -> V

Source§

fn zyz(self) -> V

Source§

fn zzx(self) -> V

Source§

fn zzy(self) -> V

Source§

fn zzz(self) -> V

Source§

impl<V> Swizzle4 for V
where V: SwizzleVector<Lanes = UInt<UInt<UInt<UTerm, B1>, B0>, B0>>,

Source§

fn xyzw(self) -> V

Source§

fn xxxx(self) -> V

Source§

fn xxxy(self) -> V

Source§

fn xxxz(self) -> V

Source§

fn xxxw(self) -> V

Source§

fn xxyx(self) -> V

Source§

fn xxyy(self) -> V

Source§

fn xxyz(self) -> V

Source§

fn xxyw(self) -> V

Source§

fn xxzx(self) -> V

Source§

fn xxzy(self) -> V

Source§

fn xxzz(self) -> V

Source§

fn xxzw(self) -> V

Source§

fn xxwx(self) -> V

Source§

fn xxwy(self) -> V

Source§

fn xxwz(self) -> V

Source§

fn xxww(self) -> V

Source§

fn xyxx(self) -> V

Source§

fn xyxy(self) -> V

Source§

fn xyxz(self) -> V

Source§

fn xyxw(self) -> V

Source§

fn xyyx(self) -> V

Source§

fn xyyy(self) -> V

Source§

fn xyyz(self) -> V

Source§

fn xyyw(self) -> V

Source§

fn xyzx(self) -> V

Source§

fn xyzy(self) -> V

Source§

fn xyzz(self) -> V

Source§

fn xywx(self) -> V

Source§

fn xywy(self) -> V

Source§

fn xywz(self) -> V

Source§

fn xyww(self) -> V

Source§

fn xzxx(self) -> V

Source§

fn xzxy(self) -> V

Source§

fn xzxz(self) -> V

Source§

fn xzxw(self) -> V

Source§

fn xzyx(self) -> V

Source§

fn xzyy(self) -> V

Source§

fn xzyz(self) -> V

Source§

fn xzyw(self) -> V

Source§

fn xzzx(self) -> V

Source§

fn xzzy(self) -> V

Source§

fn xzzz(self) -> V

Source§

fn xzzw(self) -> V

Source§

fn xzwx(self) -> V

Source§

fn xzwy(self) -> V

Source§

fn xzwz(self) -> V

Source§

fn xzww(self) -> V

Source§

fn xwxx(self) -> V

Source§

fn xwxy(self) -> V

Source§

fn xwxz(self) -> V

Source§

fn xwxw(self) -> V

Source§

fn xwyx(self) -> V

Source§

fn xwyy(self) -> V

Source§

fn xwyz(self) -> V

Source§

fn xwyw(self) -> V

Source§

fn xwzx(self) -> V

Source§

fn xwzy(self) -> V

Source§

fn xwzz(self) -> V

Source§

fn xwzw(self) -> V

Source§

fn xwwx(self) -> V

Source§

fn xwwy(self) -> V

Source§

fn xwwz(self) -> V

Source§

fn xwww(self) -> V

Source§

fn yxxx(self) -> V

Source§

fn yxxy(self) -> V

Source§

fn yxxz(self) -> V

Source§

fn yxxw(self) -> V

Source§

fn yxyx(self) -> V

Source§

fn yxyy(self) -> V

Source§

fn yxyz(self) -> V

Source§

fn yxyw(self) -> V

Source§

fn yxzx(self) -> V

Source§

fn yxzy(self) -> V

Source§

fn yxzz(self) -> V

Source§

fn yxzw(self) -> V

Source§

fn yxwx(self) -> V

Source§

fn yxwy(self) -> V

Source§

fn yxwz(self) -> V

Source§

fn yxww(self) -> V

Source§

fn yyxx(self) -> V

Source§

fn yyxy(self) -> V

Source§

fn yyxz(self) -> V

Source§

fn yyxw(self) -> V

Source§

fn yyyx(self) -> V

Source§

fn yyyy(self) -> V

Source§

fn yyyz(self) -> V

Source§

fn yyyw(self) -> V

Source§

fn yyzx(self) -> V

Source§

fn yyzy(self) -> V

Source§

fn yyzz(self) -> V

Source§

fn yyzw(self) -> V

Source§

fn yywx(self) -> V

Source§

fn yywy(self) -> V

Source§

fn yywz(self) -> V

Source§

fn yyww(self) -> V

Source§

fn yzxx(self) -> V

Source§

fn yzxy(self) -> V

Source§

fn yzxz(self) -> V

Source§

fn yzxw(self) -> V

Source§

fn yzyx(self) -> V

Source§

fn yzyy(self) -> V

Source§

fn yzyz(self) -> V

Source§

fn yzyw(self) -> V

Source§

fn yzzx(self) -> V

Source§

fn yzzy(self) -> V

Source§

fn yzzz(self) -> V

Source§

fn yzzw(self) -> V

Source§

fn yzwx(self) -> V

Source§

fn yzwy(self) -> V

Source§

fn yzwz(self) -> V

Source§

fn yzww(self) -> V

Source§

fn ywxx(self) -> V

Source§

fn ywxy(self) -> V

Source§

fn ywxz(self) -> V

Source§

fn ywxw(self) -> V

Source§

fn ywyx(self) -> V

Source§

fn ywyy(self) -> V

Source§

fn ywyz(self) -> V

Source§

fn ywyw(self) -> V

Source§

fn ywzx(self) -> V

Source§

fn ywzy(self) -> V

Source§

fn ywzz(self) -> V

Source§

fn ywzw(self) -> V

Source§

fn ywwx(self) -> V

Source§

fn ywwy(self) -> V

Source§

fn ywwz(self) -> V

Source§

fn ywww(self) -> V

Source§

fn zxxx(self) -> V

Source§

fn zxxy(self) -> V

Source§

fn zxxz(self) -> V

Source§

fn zxxw(self) -> V

Source§

fn zxyx(self) -> V

Source§

fn zxyy(self) -> V

Source§

fn zxyz(self) -> V

Source§

fn zxyw(self) -> V

Source§

fn zxzx(self) -> V

Source§

fn zxzy(self) -> V

Source§

fn zxzz(self) -> V

Source§

fn zxzw(self) -> V

Source§

fn zxwx(self) -> V

Source§

fn zxwy(self) -> V

Source§

fn zxwz(self) -> V

Source§

fn zxww(self) -> V

Source§

fn zyxx(self) -> V

Source§

fn zyxy(self) -> V

Source§

fn zyxz(self) -> V

Source§

fn zyxw(self) -> V

Source§

fn zyyx(self) -> V

Source§

fn zyyy(self) -> V

Source§

fn zyyz(self) -> V

Source§

fn zyyw(self) -> V

Source§

fn zyzx(self) -> V

Source§

fn zyzy(self) -> V

Source§

fn zyzz(self) -> V

Source§

fn zyzw(self) -> V

Source§

fn zywx(self) -> V

Source§

fn zywy(self) -> V

Source§

fn zywz(self) -> V

Source§

fn zyww(self) -> V

Source§

fn zzxx(self) -> V

Source§

fn zzxy(self) -> V

Source§

fn zzxz(self) -> V

Source§

fn zzxw(self) -> V

Source§

fn zzyx(self) -> V

Source§

fn zzyy(self) -> V

Source§

fn zzyz(self) -> V

Source§

fn zzyw(self) -> V

Source§

fn zzzx(self) -> V

Source§

fn zzzy(self) -> V

Source§

fn zzzz(self) -> V

Source§

fn zzzw(self) -> V

Source§

fn zzwx(self) -> V

Source§

fn zzwy(self) -> V

Source§

fn zzwz(self) -> V

Source§

fn zzww(self) -> V

Source§

fn zwxx(self) -> V

Source§

fn zwxy(self) -> V

Source§

fn zwxz(self) -> V

Source§

fn zwxw(self) -> V

Source§

fn zwyx(self) -> V

Source§

fn zwyy(self) -> V

Source§

fn zwyz(self) -> V

Source§

fn zwyw(self) -> V

Source§

fn zwzx(self) -> V

Source§

fn zwzy(self) -> V

Source§

fn zwzz(self) -> V

Source§

fn zwzw(self) -> V

Source§

fn zwwx(self) -> V

Source§

fn zwwy(self) -> V

Source§

fn zwwz(self) -> V

Source§

fn zwww(self) -> V

Source§

fn wxxx(self) -> V

Source§

fn wxxy(self) -> V

Source§

fn wxxz(self) -> V

Source§

fn wxxw(self) -> V

Source§

fn wxyx(self) -> V

Source§

fn wxyy(self) -> V

Source§

fn wxyz(self) -> V

Source§

fn wxyw(self) -> V

Source§

fn wxzx(self) -> V

Source§

fn wxzy(self) -> V

Source§

fn wxzz(self) -> V

Source§

fn wxzw(self) -> V

Source§

fn wxwx(self) -> V

Source§

fn wxwy(self) -> V

Source§

fn wxwz(self) -> V

Source§

fn wxww(self) -> V

Source§

fn wyxx(self) -> V

Source§

fn wyxy(self) -> V

Source§

fn wyxz(self) -> V

Source§

fn wyxw(self) -> V

Source§

fn wyyx(self) -> V

Source§

fn wyyy(self) -> V

Source§

fn wyyz(self) -> V

Source§

fn wyyw(self) -> V

Source§

fn wyzx(self) -> V

Source§

fn wyzy(self) -> V

Source§

fn wyzz(self) -> V

Source§

fn wyzw(self) -> V

Source§

fn wywx(self) -> V

Source§

fn wywy(self) -> V

Source§

fn wywz(self) -> V

Source§

fn wyww(self) -> V

Source§

fn wzxx(self) -> V

Source§

fn wzxy(self) -> V

Source§

fn wzxz(self) -> V

Source§

fn wzxw(self) -> V

Source§

fn wzyx(self) -> V

Source§

fn wzyy(self) -> V

Source§

fn wzyz(self) -> V

Source§

fn wzyw(self) -> V

Source§

fn wzzx(self) -> V

Source§

fn wzzy(self) -> V

Source§

fn wzzz(self) -> V

Source§

fn wzzw(self) -> V

Source§

fn wzwx(self) -> V

Source§

fn wzwy(self) -> V

Source§

fn wzwz(self) -> V

Source§

fn wzww(self) -> V

Source§

fn wwxx(self) -> V

Source§

fn wwxy(self) -> V

Source§

fn wwxz(self) -> V

Source§

fn wwxw(self) -> V

Source§

fn wwyx(self) -> V

Source§

fn wwyy(self) -> V

Source§

fn wwyz(self) -> V

Source§

fn wwyw(self) -> V

Source§

fn wwzx(self) -> V

Source§

fn wwzy(self) -> V

Source§

fn wwzz(self) -> V

Source§

fn wwzw(self) -> V

Source§

fn wwwx(self) -> V

Source§

fn wwwy(self) -> V

Source§

fn wwwz(self) -> V

Source§

fn wwww(self) -> V

Source§

impl<V> SwizzleVector for V

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<M> TranscendentalMath for M

Source§

fn sin_cos(self) -> (Self, Self)

Trigonometric sine and cosine, together. This will be more efficient than calling sin and cos separately.
Source§

fn sin(self) -> Self

Trigonometric sine
Source§

fn cos(self) -> Self

Trigonometric cosine
Source§

fn tan(self) -> Self

Trigonometric tangent
Source§

fn cos_m1(self) -> Self

Returns cos(x) - 1 of self, which is more precise than cos(x) - 1 directly near zero. Read more
Source§

fn versin(self) -> Self

Returns the versine $1 - \cos(x)$ of self, evaluated as $2\sin^2(x/2)$ (accurate near zero).
Source§

fn haversin(self) -> Self

Returns the haversine $\tfrac{1 - \cos(x)}{2}$ of self, evaluated as $\sin^2(x/2)$ (accurate near zero). Read more
Source§

fn sincos_pi(self) -> (Self, Self)

Sine and cosine of pi * x, together. This will be more efficient than calling sin_pi and cos_pi separately, and more precise than computing them manually with sin(pi * x) and cos(pi * x).
Source§

fn sin_pi(self) -> Self

Trigonometric sine of pi * x, with improved precision when the policy allows.
Source§

fn cos_pi(self) -> Self

Trigonometric cosine of pi * x, with improved precision when the policy allows.
Source§

fn tan_pi(self) -> Self

Trigonometric tangent of pi * x, with improved precision when the policy allows.
Source§

fn sinc(self) -> Self

Computes sin(x) / x with improved precision when the policy allows.
Source§

fn sinc_pi(self) -> Self

Computes $\frac{\sin(\pi x)}{\pi x}$ with improved precision when the policy allows.
Source§

fn sinh_cosh(self) -> (Self, Self)

Hyperbolic sine and cosine, together. This will be more efficient than calling sinh and cosh separately.
Source§

fn sinh(self) -> Self

Hyperbolic sine
Source§

fn cosh(self) -> Self

Hyperbolic cosine
Source§

fn tanh(self) -> Self

Hyperbolic tangent
Source§

fn asin(self) -> Self

Returns the arcsine of self.
Source§

fn acos(self) -> Self

Returns the arccosine of self.
Source§

fn atan(self) -> Self

Returns the arctangent of self.
Source§

fn asinh(self) -> Self

Inverse hyperbolic sine
Source§

fn acosh(self) -> Self

Inverse hyperbolic cosine
Source§

fn atanh(self) -> Self

Inverse hyperbolic tangent
Source§

fn exp(self) -> Self

The exponential function, returns e^(self).
Source§

fn exph(self) -> Self

The Half exponential function, returns 0.5 * e^(self).
Source§

fn exp2(self) -> Self

The base-2 exponential function, returns 2^(self).
Source§

fn exp10(self) -> Self

The base-10 exponential function, returns 10^(self).
Source§

fn exp_m1(self) -> Self

Returns exp(self) - 1 of self, which is more precise than calculating exp(self) - 1 directly.
Source§

fn exp2_m1(self) -> Self

Returns 2^(self) - 1, which is more precise than calculating exp2(self) - 1 directly.
Source§

fn exp10_m1(self) -> Self

Returns 10^(self) - 1, which is more precise than calculating exp10(self) - 1 directly.
Source§

fn sqrt1pm1(self) -> Self

Returns $\sqrt{1 + x} - 1$ of self, which is more precise than sqrt(1 + x) - 1 directly near zero. Read more
Source§

fn powf(self, e: Self) -> Self

Returns self raised to the power of e.
Source§

fn powf_m1(self, e: Self) -> Self

Returns $x^e - 1$ where x = self, computed accurately as $e^{e \ln(x)}$-style expm1. Read more
Source§

fn compound(self, n: Self) -> Self

Returns $(1 + x)^n$ where x = self, computed accurately near x = 0 as $e^{n \ln(1 + x)}$. Read more
Source§

fn cbrt(self) -> Self

Returns the cube root of self.
Source§

fn nth_root<const N: usize>(self) -> Self

Returns the Nth root of self. Read more
Source§

fn ln(self) -> Self

Returns the natural logarithm of self. Read more
Source§

fn ln_1p(self) -> Self

Returns $\ln(1 + x)$ of self.
Source§

fn log2(self) -> Self

Returns the base-2 logarithm of self.
Source§

fn log10(self) -> Self

Returns the base-10 logarithm of self.
Source§

fn log2_p1(self) -> Self

Returns $\log_2(1 + x)$ of self, which is more precise than log2(1 + x) directly near zero.
Source§

fn log10_p1(self) -> Self

Returns $\log_{10}(1 + x)$ of self, which is more precise than log10(1 + x) directly near zero.
Source§

fn log(self, base: Self) -> Self

Returns the logarithm of self with respect to the given base.
Source§

fn log_n<const N: usize>(self) -> Self

Returns the logarithm of self with respect to the given integer base N. Read more
Source§

fn ln1m_expnx(self) -> Self

Returns $\ln(1 - e^{-x})$, which depending on the policy may be an approximation more performant than the exact calculation. If you’re using a policy with below average precision, and happen to have ln(x) available, you can use ln1m_expnx_ext instead to provide that.
Source§

fn ln1m_expnx_ext(self, lnx: Self) -> Self

Returns ln(1 - exp(lnx)), which depending on the policy may be an approximation more performant than the exact calculation. If you’re using a policy with below average precision, it’s recommended to use this function instead of ln1m_expnx to provide ln(x) directly. Read more
Source§

impl<E, V> TranscendentalMathWithPolicy for V

Source§

fn sin_cos_p<P>(self) -> (V, V)
where P: Policy,

Trigonometric sine and cosine, together. This will be more efficient than calling sin and cos separately.

Source§

fn sin_p<P>(self) -> V
where P: Policy,

Trigonometric sine

Source§

fn cos_p<P>(self) -> V
where P: Policy,

Trigonometric cosine

Source§

fn tan_p<P>(self) -> V
where P: Policy,

Trigonometric tangent

Source§

fn cos_m1_p<P>(self) -> V
where P: Policy,

Returns cos(x) - 1 of self, which is more precise than cos(x) - 1 directly near zero.

Evaluated as $-2\sin^2(x/2)$, which has no cancellation near x = 0.

Source§

fn versin_p<P>(self) -> V
where P: Policy,

Returns the versine $1 - \cos(x)$ of self, evaluated as $2\sin^2(x/2)$ (accurate near zero).

Source§

fn haversin_p<P>(self) -> V
where P: Policy,

Returns the haversine $\tfrac{1 - \cos(x)}{2}$ of self, evaluated as $\sin^2(x/2)$ (accurate near zero).

This is the kernel of the haversine great-circle-distance formula.

Source§

fn sincos_pi_p<P>(self) -> (V, V)
where P: Policy,

Sine and cosine of pi * x, together. This will be more efficient than calling sin_pi and cos_pi separately, and more precise than computing them manually with sin(pi * x) and cos(pi * x).

Source§

fn sin_pi_p<P>(self) -> V
where P: Policy,

Trigonometric sine of pi * x, with improved precision when the policy allows.

Source§

fn cos_pi_p<P>(self) -> V
where P: Policy,

Trigonometric cosine of pi * x, with improved precision when the policy allows.

Source§

fn tan_pi_p<P>(self) -> V
where P: Policy,

Trigonometric tangent of pi * x, with improved precision when the policy allows.

Source§

fn sinc_p<P>(self) -> V
where P: Policy,

Computes sin(x) / x with improved precision when the policy allows.

Source§

fn sinc_pi_p<P>(self) -> V
where P: Policy,

Computes $\frac{\sin(\pi x)}{\pi x}$ with improved precision when the policy allows.

Source§

fn sinh_cosh_p<P>(self) -> (V, V)
where P: Policy,

Hyperbolic sine and cosine, together. This will be more efficient than calling sinh and cosh separately.

Source§

fn sinh_p<P>(self) -> V
where P: Policy,

Hyperbolic sine

Source§

fn cosh_p<P>(self) -> V
where P: Policy,

Hyperbolic cosine

Source§

fn tanh_p<P>(self) -> V
where P: Policy,

Hyperbolic tangent

Source§

fn asin_p<P>(self) -> V
where P: Policy,

Returns the arcsine of self.

Source§

fn acos_p<P>(self) -> V
where P: Policy,

Returns the arccosine of self.

Source§

fn atan_p<P>(self) -> V
where P: Policy,

Returns the arctangent of self.

Source§

fn asinh_p<P>(self) -> V
where P: Policy,

Inverse hyperbolic sine

Source§

fn acosh_p<P>(self) -> V
where P: Policy,

Inverse hyperbolic cosine

Source§

fn atanh_p<P>(self) -> V
where P: Policy,

Inverse hyperbolic tangent

Source§

fn exp_p<P>(self) -> V
where P: Policy,

The exponential function, returns e^(self).

Source§

fn exph_p<P>(self) -> V
where P: Policy,

The Half exponential function, returns 0.5 * e^(self).

Source§

fn exp2_p<P>(self) -> V
where P: Policy,

The base-2 exponential function, returns 2^(self).

Source§

fn exp10_p<P>(self) -> V
where P: Policy,

The base-10 exponential function, returns 10^(self).

Source§

fn exp_m1_p<P>(self) -> V
where P: Policy,

Returns exp(self) - 1 of self, which is more precise than calculating exp(self) - 1 directly.

Source§

fn exp2_m1_p<P>(self) -> V
where P: Policy,

Returns 2^(self) - 1, which is more precise than calculating exp2(self) - 1 directly.

Source§

fn exp10_m1_p<P>(self) -> V
where P: Policy,

Returns 10^(self) - 1, which is more precise than calculating exp10(self) - 1 directly.

Source§

fn sqrt1pm1_p<P>(self) -> V
where P: Policy,

Returns $\sqrt{1 + x} - 1$ of self, which is more precise than sqrt(1 + x) - 1 directly near zero.

Evaluated as $\frac{x}{\sqrt{1 + x} + 1}$, which has no cancellation near x = 0.

Source§

fn powf_p<P>(self, e: V) -> V
where P: Policy,

Returns self raised to the power of e.

Source§

fn powf_m1_p<P>(self, e: V) -> V
where P: Policy,

Returns $x^e - 1$ where x = self, computed accurately as $e^{e \ln(x)}$-style expm1.

More precise than powf(x, e) - 1 when the result is near zero (i.e. x near 1 or e near 0), e.g. compound returns/growth rates.

Source§

fn compound_p<P>(self, n: V) -> V
where P: Policy,

Returns $(1 + x)^n$ where x = self, computed accurately near x = 0 as $e^{n \ln(1 + x)}$.

This is the IEEE 754 compound operation, and is more precise than powf(1 + x, n) for small x (e.g. compound-growth/interest over n periods at rate x).

Source§

fn cbrt_p<P>(self) -> V
where P: Policy,

Returns the cube root of self.

Source§

fn nth_root_p<P, const N: usize>(self) -> V
where P: Policy,

Returns the Nth root of self.

This is often faster and more accurate than using powf(1.0 / N as float). Supports negative numbers for odd N.

Source§

fn ln_p<P>(self) -> V
where P: Policy,

Returns the natural logarithm of self.

§Examples

Every math function takes a precision policy via its _p variant; a quick sweep against a scalar reference is the cheapest way to validate that a policy choice is accurate enough for your domain:

use thermite::prelude::*;
use thermite::math::policy::policies::Precision;

type V = Vector<f64>;

let mut max_err = 0.0f64;
for i in 1..=1000 {
    let x = i as f64 * 0.05;
    let y = V::splat(x).ln_p::<Precision>().extract::<0>();
    max_err = max_err.max((y - x.ln()).abs() / x.ln().abs().max(1.0));
}
assert!(max_err < 1e-14, "max relative error {max_err}");
Source§

fn ln_1p_p<P>(self) -> V
where P: Policy,

Returns $\ln(1 + x)$ of self.

Source§

fn log2_p<P>(self) -> V
where P: Policy,

Returns the base-2 logarithm of self.

Source§

fn log10_p<P>(self) -> V
where P: Policy,

Returns the base-10 logarithm of self.

Source§

fn log2_p1_p<P>(self) -> V
where P: Policy,

Returns $\log_2(1 + x)$ of self, which is more precise than log2(1 + x) directly near zero.

Source§

fn log10_p1_p<P>(self) -> V
where P: Policy,

Returns $\log_{10}(1 + x)$ of self, which is more precise than log10(1 + x) directly near zero.

Source§

fn log_p<P>(self, base: V) -> V
where P: Policy,

Returns the logarithm of self with respect to the given base.

Source§

fn log_n_p<P, const N: usize>(self) -> V
where P: Policy,

Returns the logarithm of self with respect to the given integer base N.

This is efficient for bases <=32 using a lookup table, and falls back to the general log(x)/libm::log(N) implementation for larger bases.

For bases 0 and 1, the result is 0 and Infinity respectively.

Source§

fn ln1m_expnx_p<P>(self) -> V
where P: Policy,

Returns $\ln(1 - e^{-x})$, which depending on the policy may be an approximation more performant than the exact calculation. If you’re using a policy with below average precision, and happen to have ln(x) available, you can use ln1m_expnx_ext instead to provide that.

Source§

fn ln1m_expnx_ext_p<P>(self, lnx: V) -> V
where P: Policy,

Returns ln(1 - exp(lnx)), which depending on the policy may be an approximation more performant than the exact calculation. If you’re using a policy with below average precision, it’s recommended to use this function instead of ln1m_expnx to provide ln(x) directly.

Although not obvious, ln(x) is used internally for the approximation, and if it’s already available, you may as well use this function to avoid recomputing it.

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<T> UpperBounded for T
where T: Bounded,

Source§

fn max_value() -> T

Returns the largest finite number this type can represent