#[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: VThe real part.
im: VThe imaginary part.
Implementations§
Source§impl<V: RealFloatVector> Complex<V>
impl<V: RealFloatVector> Complex<V>
Sourcepub fn splat_parts(re: V::Element, im: V::Element) -> Self
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>
impl<V: RealValue> Complex<V>
Sourcepub const fn new(re: V, im: V) -> Self
pub const fn new(re: V, im: V) -> Self
Creates a complex number with the given real and imaginary parts.
Sourcepub const fn real(re: V) -> Self
pub const fn real(re: V) -> Self
Creates a complex number with the given real part and zero imaginary part.
Sourcepub const fn imag(im: V) -> Self
pub const fn imag(im: V) -> Self
Creates a complex number with zero real part and the given imaginary part.
Trait Implementations§
Source§impl<V: RealValue, T> AddAssign<T> for Complex<V>where
Self: Add<T, Output = Self>,
impl<V: RealValue, T> AddAssign<T> for Complex<V>where
Self: Add<T, Output = Self>,
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moreSource§impl<V: RealFloatVector, Rhs> AddAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> AddAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§fn add_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
fn add_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
Source§fn add_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
fn add_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
Source§fn add_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
fn add_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
AddAssign masked (zeroed where mask is false).Source§impl<V: RealFloatVector, Rhs> AddMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> AddMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§impl<V: RealFloatVector> AddSubExt for Complex<V>
impl<V: RealFloatVector> AddSubExt for Complex<V>
Source§impl<V: RealFloatVector> AddSubExtMasked<<V as GenericVector>::Mask> for Complex<V>
impl<V: RealFloatVector> AddSubExtMasked<<V as GenericVector>::Mask> for Complex<V>
Source§fn fmaddsub_c(self, mask: V::Mask, b: Self, c: Self) -> Self
fn fmaddsub_c(self, mask: V::Mask, b: Self, c: Self) -> Self
Source§fn fmaddsub_m(self, src: Self, mask: V::Mask, b: Self, c: Self) -> Self
fn fmaddsub_m(self, src: Self, mask: V::Mask, b: Self, c: Self) -> Self
Source§fn fmaddsub_z(self, mask: V::Mask, b: Self, c: Self) -> Self
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
fn fmsubadd_c(self, mask: V::Mask, b: Self, c: Self) -> Self
Source§fn fmsubadd_m(self, src: Self, mask: V::Mask, b: Self, c: Self) -> Self
fn fmsubadd_m(self, src: Self, mask: V::Mask, b: Self, c: Self) -> Self
Source§fn fmsubadd_z(self, mask: V::Mask, b: Self, c: Self) -> Self
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>
impl<V: RealFloatVector> Bounded for Complex<V>
Source§impl<FROM, TO> CastVector<Complex<FROM>> for Complex<TO>
impl<FROM, TO> CastVector<Complex<FROM>> for Complex<TO>
Source§fn cast_into(self) -> Complex<FROM>
fn cast_into(self) -> Complex<FROM>
FROM, lane-by-lane.Source§fn cast_from(from: Complex<FROM>) -> Self
fn cast_from(from: Complex<FROM>) -> Self
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
fn saturating_cast_from(from: FROM) -> Self
Self’s element
range rather than wrapping (integers) or producing a backend-defined
value (float to int). Read moreSource§fn fast_cast_from(from: FROM) -> Self
fn fast_cast_from(from: FROM) -> Self
cast_from, but may take a faster path that
relaxes IEEE corner cases. See GenericVector::fast_cast. Read moreSource§fn fast_cast_into(self) -> FROM
fn fast_cast_into(self) -> FROM
cast_into, but may take a faster path that
relaxes IEEE corner cases. See GenericVector::fast_cast.Source§impl<V: RealFloatVector> ComplexVector for Complex<V>
impl<V: RealFloatVector> ComplexVector for Complex<V>
Source§type Real = V
type Real = V
Source§fn from_parts(re: V, im: V) -> Self
fn from_parts(re: V, im: V) -> Self
Source§unsafe fn store_streaming_block(self, ptr: *mut Self)
unsafe fn store_streaming_block(self, ptr: *mut Self)
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 moreSource§impl<V: RealValue> ConstDefault for Complex<V>
impl<V: RealValue> ConstDefault for Complex<V>
impl<V: Copy> Copy for Complex<V>
Source§impl<V: RealValue, T> DivAssign<T> for Complex<V>where
Self: Div<T, Output = Self>,
impl<V: RealValue, T> DivAssign<T> for Complex<V>where
Self: Div<T, Output = Self>,
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moreSource§impl<V: RealFloatVector, Rhs> DivAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> DivAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§fn div_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
fn div_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
Source§fn div_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
fn div_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
Source§fn div_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
fn div_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
DivAssign masked (zeroed where mask is false).Source§impl<V: RealFloatVector, Rhs> DivMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> DivMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§impl<E: RealValue + Element> Element for Complex<E>
impl<E: RealValue + Element> Element for Complex<E>
const ZERO: Self = Self::ZERO
const ONE: Self = Self::ONE
Source§const ORDER_MAX: Self
const ORDER_MAX: Self
Source§const HAS_UNORDERED: bool = E::HAS_UNORDERED
const HAS_UNORDERED: bool = E::HAS_UNORDERED
PartialOrd -
float NaN. false for every integer type. Read moreSource§const IS_FLOAT: bool = E::IS_FLOAT
const IS_FLOAT: bool = E::IS_FLOAT
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
type Signed = <E as Element>::Signed
Source§type Unsigned = <E as Element>::Unsigned
type Unsigned = <E as Element>::Unsigned
fn from_i8(value: i8) -> Self
fn from_u8(value: u8) -> Self
fn from_u16(value: u16) -> Self
Source§impl<E, V: RealFloatVector<Element = E>> ExpIntDetails<Complex<E>, Complex<V>> for Complex<V>
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.
impl<E, V: RealFloatVector<Element = E>> ExpIntDetails<Complex<E>, Complex<V>> for Complex<V>
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
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>
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§impl<V: RealValue + FloatConsts> FloatConsts for Complex<V>
impl<V: RealValue + FloatConsts> FloatConsts for Complex<V>
Source§const EULER_GAMMA: Self
const EULER_GAMMA: Self
Source§const PI_SQUARED: Self
const PI_SQUARED: Self
$\pi^2$Source§const FRAC_1_SQRT_2: Self
const FRAC_1_SQRT_2: Self
$1/\sqrt{2}$Source§const FRAC_1_SQRT_3: Self
const FRAC_1_SQRT_3: Self
$1/\sqrt{3}$Source§const FRAC_1_SQRT_PI: Self
const FRAC_1_SQRT_PI: Self
$1/\sqrt{\pi}$Source§const FRAC_2_SQRT_PI: Self
const FRAC_2_SQRT_PI: Self
$2/\sqrt{\pi}$Source§const FRAC_SQRT_PI_2: Self
const FRAC_SQRT_PI_2: Self
$\sqrt{\pi}/2$Source§const FRAC_1_SQRT_TAU: Self
const FRAC_1_SQRT_TAU: Self
$1/\sqrt{2\pi}$Source§const FRAC_PI_180: Self
const FRAC_PI_180: Self
$\pi/180$Source§const FRAC_180_PI: Self
const FRAC_180_PI: Self
$180/\pi$Source§const FRAC_LN_PI_2: Self
const FRAC_LN_PI_2: Self
$frac{1}{2}\ln \pi$Source§const SQRT_EPSILON: Self
const SQRT_EPSILON: Self
$\sqrt{arepsilon}$)Source§const FOURTH_ROOT_EPSILON: Self
const FOURTH_ROOT_EPSILON: Self
$\sqrt[4]{arepsilon}$)Source§const SQRT_FRAC_PI_2: Self
const SQRT_FRAC_PI_2: Self
$\sqrt{\pi/2}$Source§const FRAC_NEG_1_E: Self
const FRAC_NEG_1_E: Self
Source§impl<E: RealValue + FloatElement> FloatElement for Complex<E>
impl<E: RealValue + FloatElement> FloatElement for Complex<E>
Source§fn sqrt(this: Self) -> Self
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
const HAS_INFINITY: bool = E::HAS_INFINITY
Source§const HAS_SIGNED_ZERO: bool = E::HAS_SIGNED_ZERO
const HAS_SIGNED_ZERO: bool = E::HAS_SIGNED_ZERO
Source§const HAS_SUBNORMALS: bool = E::HAS_SUBNORMALS
const HAS_SUBNORMALS: bool = E::HAS_SUBNORMALS
Source§type ConstInt<const VAL: LargeInt> = ComplexIntConst<E, VAL>
type ConstInt<const VAL: LargeInt> = ComplexIntConst<E, VAL>
Source§type ConstRatio<const NUM: LargeInt, const DEN: LargeInt> = ComplexRatioConst<E, NUM, DEN>
type ConstRatio<const NUM: LargeInt, const DEN: LargeInt> = ComplexRatioConst<E, NUM, DEN>
fn floor(this: Self) -> Self
fn ceil(this: Self) -> Self
fn round(this: Self) -> Self
fn trunc(this: Self) -> Self
fn next_up(this: Self) -> Self
fn next_down(this: Self) -> Self
Source§fn try_from_int(value: LargeInt) -> Option<Self>
fn try_from_int(value: LargeInt) -> Option<Self>
fn try_from_ratio(n: LargeInt, d: LargeInt) -> Option<Self>
fn from_int(value: i64) -> Self
fn from_ratio(n: i64, d: i64) -> Self
fn fract(value: Self) -> Self
Source§impl<V: RealFloatVector> FloatVector for Complex<V>
impl<V: RealFloatVector> FloatVector for Complex<V>
Source§const NEG_INFINITY: Self
const NEG_INFINITY: Self
-infinity represented in this vector type.Source§const HAS_APPROX_RCP: bool = V::HAS_APPROX_RCP
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
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>
type ExtendedPrecision = Complex<V>
f32 vectors, this
would be an f64 vector type. Read moreSource§fn is_infinite(self) -> Self::Mask
fn is_infinite(self) -> Self::Mask
Source§fn is_finite(self) -> Self::Mask
fn is_finite(self) -> Self::Mask
Source§fn is_zero_or_subnormal(self) -> Self::Mask
fn is_zero_or_subnormal(self) -> Self::Mask
Source§fn is_normal(self) -> Self::Mask
fn is_normal(self) -> Self::Mask
Source§fn is_subnormal(self) -> Self::Mask
fn is_subnormal(self) -> Self::Mask
Source§fn floor(self) -> Self
fn floor(self) -> Self
Source§fn ceil(self) -> Self
fn ceil(self) -> Self
Source§fn trunc(self) -> Self
fn trunc(self) -> Self
Source§fn mul_sign(self, sign: Self) -> Self
fn mul_sign(self, sign: Self) -> Self
self * sign.signum(), multiplying the sign bits.Source§fn signed_zero(self) -> Self
fn signed_zero(self) -> Self
self, i.e.: only the sign bit is set.Source§fn next_up(self) -> Self
fn next_up(self) -> Self
Source§fn next_down(self) -> Self
fn next_down(self) -> Self
Source§unsafe fn block_autovectorization(&mut self)
unsafe fn block_autovectorization(&mut self)
Source§fn mix(self, a: Self, b: Self) -> Self
fn mix(self, a: Self, b: Self) -> Self
a and b by self, where self is typically in the range [0, 1]. Read moreSource§fn sqrt_m(self, src: Self, mask: Self::Mask) -> Self
fn sqrt_m(self, src: Self, mask: Self::Mask) -> Self
Source§fn rsqrt_c(self, mask: Self::Mask) -> Self
fn rsqrt_c(self, mask: Self::Mask) -> Self
Source§fn rsqrt_m(self, src: Self, mask: Self::Mask) -> Self
fn rsqrt_m(self, src: Self, mask: Self::Mask) -> Self
Source§fn rsqrt_z(self, mask: Self::Mask) -> Self
fn rsqrt_z(self, mask: Self::Mask) -> Self
Source§fn rcp_c(self, mask: Self::Mask) -> Self
fn rcp_c(self, mask: Self::Mask) -> Self
1 / self. Read moreSource§fn rcp_m(self, src: Self, mask: Self::Mask) -> Self
fn rcp_m(self, src: Self, mask: Self::Mask) -> Self
1 / self. Read moreSource§fn rcp_z(self, mask: Self::Mask) -> Self
fn rcp_z(self, mask: Self::Mask) -> Self
1 / self. Read moreSource§fn floor_c(self, mask: Self::Mask) -> Self
fn floor_c(self, mask: Self::Mask) -> Self
Source§fn floor_m(self, src: Self, mask: Self::Mask) -> Self
fn floor_m(self, src: Self, mask: Self::Mask) -> Self
Source§fn floor_z(self, mask: Self::Mask) -> Self
fn floor_z(self, mask: Self::Mask) -> Self
Source§fn ceil_c(self, mask: Self::Mask) -> Self
fn ceil_c(self, mask: Self::Mask) -> Self
ceil when mask is true, returns self where false.Source§fn ceil_m(self, src: Self, mask: Self::Mask) -> Self
fn ceil_m(self, src: Self, mask: Self::Mask) -> Self
ceil with src using mask.Source§fn ceil_z(self, mask: Self::Mask) -> Self
fn ceil_z(self, mask: Self::Mask) -> Self
ceil masked (zeroed where mask is false).Source§fn trunc_c(self, mask: Self::Mask) -> Self
fn trunc_c(self, mask: Self::Mask) -> Self
trunc when mask is true, returns self where false.Source§fn trunc_m(self, src: Self, mask: Self::Mask) -> Self
fn trunc_m(self, src: Self, mask: Self::Mask) -> Self
trunc with src using mask.Source§fn trunc_z(self, mask: Self::Mask) -> Self
fn trunc_z(self, mask: Self::Mask) -> Self
trunc masked (zeroed where mask is false).Source§fn fract_c(self, mask: Self::Mask) -> Self
fn fract_c(self, mask: Self::Mask) -> Self
self - self.trunc(). Read moreSource§fn fract_m(self, src: Self, mask: Self::Mask) -> Self
fn fract_m(self, src: Self, mask: Self::Mask) -> Self
self - self.trunc(). Read moreSource§fn fract_z(self, mask: Self::Mask) -> Self
fn fract_z(self, mask: Self::Mask) -> Self
self - self.trunc(). Read moreSource§fn signed_zero_c(self, mask: Self::Mask) -> Self
fn signed_zero_c(self, mask: Self::Mask) -> Self
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
fn signed_zero_m(self, src: Self, mask: Self::Mask) -> Self
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
fn signed_zero_z(self, mask: Self::Mask) -> Self
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
fn next_up_c(self, mask: Self::Mask) -> Self
next_up when mask is true, returns self where false.Source§fn next_up_m(self, src: Self, mask: Self::Mask) -> Self
fn next_up_m(self, src: Self, mask: Self::Mask) -> Self
next_up with src using mask.Source§fn next_up_z(self, mask: Self::Mask) -> Self
fn next_up_z(self, mask: Self::Mask) -> Self
next_up masked (zeroed where mask is false).Source§fn next_down_c(self, mask: Self::Mask) -> Self
fn next_down_c(self, mask: Self::Mask) -> Self
next_down when mask is true, returns self where false.Source§fn next_down_m(self, src: Self, mask: Self::Mask) -> Self
fn next_down_m(self, src: Self, mask: Self::Mask) -> Self
next_down with src using mask.Source§fn next_down_z(self, mask: Self::Mask) -> Self
fn next_down_z(self, mask: Self::Mask) -> Self
next_down masked (zeroed where mask is false).Source§fn mul_sign_c(self, mask: Self::Mask, rhs: Self) -> Self
fn mul_sign_c(self, mask: Self::Mask, rhs: Self) -> Self
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
fn mul_sign_m(self, src: Self, mask: Self::Mask, rhs: Self) -> Self
Source§fn mul_sign_z(self, mask: Self::Mask, rhs: Self) -> Self
fn mul_sign_z(self, mask: Self::Mask, rhs: Self) -> Self
self * sign.signum(), multiplying the sign bits.
Computes mul_sign masked (zeroed where mask is false).Source§fn one_minus_sq(self) -> Self
fn one_minus_sq(self) -> Self
$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 moreSource§fn with_bits<const N: usize, K>(
_values: [Self; N],
_kernel: K,
) -> Option<<K as AsFloatVectorWithBitsKernel<Self, N>>::Output>where
K: AsFloatVectorWithBitsKernel<Self, N>,
fn with_bits<const N: usize, K>(
_values: [Self; N],
_kernel: K,
) -> Option<<K as AsFloatVectorWithBitsKernel<Self, N>>::Output>where
K: AsFloatVectorWithBitsKernel<Self, N>,
Source§impl<V: RealFloatVector> GenericSelectable for Complex<V>
impl<V: RealFloatVector> GenericSelectable for Complex<V>
Source§type SelectableMask = <V as GenericSelectable>::SelectableMask
type SelectableMask = <V as GenericSelectable>::SelectableMask
Self.Source§fn select<M>(mask: M, t: Self, f: Self) -> Selfwhere
Self::SelectableMask: CastMask<M>,
fn select<M>(mask: M, t: Self, f: Self) -> Selfwhere
Self::SelectableMask: CastMask<M>,
t where mask is true, otherwise
from f.Source§impl<V: RealFloatVector> GenericVector for Complex<V>
impl<V: RealFloatVector> GenericVector for Complex<V>
Source§unsafe fn load_unaligned(ptr: *const Self::Element) -> Self
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]
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],
)
unsafe fn store_interleaved<const M: usize>( ptr: *mut Self::Element, values: [Self; M], )
The exact inverse of load_deinterleaved.
Source§const HAS_NATIVE_ALIGN: bool = V::HAS_NATIVE_ALIGN
const HAS_NATIVE_ALIGN: bool = V::HAS_NATIVE_ALIGN
align is a native cross-register instruction rather
than the generic shuffle-and-blend fallback, forwarded from
Register::HAS_NATIVE_ALIGN. Read moreSource§type Lanes = <V as GenericVector>::Lanes
type Lanes = <V as GenericVector>::Lanes
Source§type Unsigned = <V as GenericVector>::Unsigned
type Unsigned = <V as GenericVector>::Unsigned
Source§type Signed = <V as GenericVector>::Signed
type Signed = <V as GenericVector>::Signed
Source§type Mask = <V as GenericVector>::Mask
type Mask = <V as GenericVector>::Mask
Source§fn new<const N: usize>(value: [Self::Element; N]) -> Self
fn new<const N: usize>(value: [Self::Element; N]) -> Self
Source§fn into_array(self) -> GenericArray<Self::Element, Self::Lanes>
fn into_array(self) -> GenericArray<Self::Element, Self::Lanes>
GenericArray. Read moreSource§fn splat(value: Self::Element) -> Self
fn splat(value: Self::Element) -> Self
Source§fn single(value: Self::Element) -> Self
fn single(value: Self::Element) -> Self
Source§unsafe fn load(ptr: *const Self::Element) -> Self
unsafe fn load(ptr: *const Self::Element) -> Self
Source§unsafe fn load_streaming(ptr: *const Self::Element) -> Self
unsafe fn load_streaming(ptr: *const Self::Element) -> Self
Source§fn interleave_by<const GROUP: usize>(self, other: Self) -> (Self, Self)
fn interleave_by<const GROUP: usize>(self, other: Self) -> (Self, Self)
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 moreSource§fn deinterleave_by<const GROUP: usize>(self, other: Self) -> (Self, Self)
fn deinterleave_by<const GROUP: usize>(self, other: Self) -> (Self, Self)
interleave_by - group-granularity de-interleave.Source§fn interleave_radix<const N: usize>(inputs: [Self; N]) -> [Self; N]
fn interleave_radix<const N: usize>(inputs: [Self; N]) -> [Self; N]
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 moreSource§fn deinterleave_radix<const N: usize>(inputs: [Self; N]) -> [Self; N]
fn deinterleave_radix<const N: usize>(inputs: [Self; N]) -> [Self; N]
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]
fn deinterleave_radix_by<const N: usize, const GROUP: usize>( inputs: [Self; N], ) -> [Self; N]
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 moreSource§fn interleave_radix_by<const N: usize, const GROUP: usize>(
inputs: [Self; N],
) -> [Self; N]
fn interleave_radix_by<const N: usize, const GROUP: usize>( inputs: [Self; N], ) -> [Self; N]
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
unsafe fn load_m(src: Self, mask: Self::Mask, ptr: *const Self::Element) -> Self
Source§unsafe fn load_z(mask: Self::Mask, ptr: *const Self::Element) -> Self
unsafe fn load_z(mask: Self::Mask, ptr: *const Self::Element) -> Self
Source§unsafe fn store(self, ptr: *mut Self::Element)
unsafe fn store(self, ptr: *mut Self::Element)
Source§unsafe fn store_unaligned(self, ptr: *mut Self::Element)
unsafe fn store_unaligned(self, ptr: *mut Self::Element)
Source§unsafe fn store_streaming(self, ptr: *mut Self::Element)
unsafe fn store_streaming(self, ptr: *mut Self::Element)
Source§unsafe fn store_masked(self, mask: Self::Mask, ptr: *mut Self::Element)
unsafe fn store_masked(self, mask: Self::Mask, ptr: *mut Self::Element)
true.
For lanes where the mask is false, the store is suppressed without panicking. Read moreSource§unsafe fn lookup_unchecked(
values: &[Self::Element],
indices: Self::Unsigned,
) -> Self
unsafe fn lookup_unchecked( values: &[Self::Element], indices: Self::Unsigned, ) -> Self
Source§fn broadcast<const I: usize>(self) -> Self
fn broadcast<const I: usize>(self) -> Self
Source§fn broadcastv(self, idx: usize) -> Self
fn broadcastv(self, idx: usize) -> Self
Source§fn extract<const I: usize>(self) -> Self::Element
fn extract<const I: usize>(self) -> Self::Element
I. Read moreSource§fn extractv(self, idx: usize) -> Self::Element
fn extractv(self, idx: usize) -> Self::Element
idx. Read moreSource§fn insert<const I: usize>(self, value: Self::Element) -> Self
fn insert<const I: usize>(self, value: Self::Element) -> Self
I. Read moreSource§fn insertv(self, idx: usize, value: Self::Element) -> Self
fn insertv(self, idx: usize, value: Self::Element) -> Self
idx. Read moreSource§fn swap_bytes(self) -> Self
fn swap_bytes(self) -> Self
Source§fn zz(self, mask: Self::Mask) -> Self
fn zz(self, mask: Self::Mask) -> Self
Source§fn nz(self, mask: Self::Mask) -> Self
fn nz(self, mask: Self::Mask) -> Self
Source§fn compress(self, mask: Self::Mask) -> Self
fn compress(self, mask: Self::Mask) -> Self
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 moreSource§fn compress_z(self, mask: Self::Mask) -> Self
fn compress_z(self, mask: Self::Mask) -> Self
Source§fn compress_m(self, src: Self, mask: Self::Mask) -> Self
fn compress_m(self, src: Self, mask: Self::Mask) -> Self
Source§fn align<const OFFSET: usize>(self, other: Self) -> Self
fn align<const OFFSET: usize>(self, other: Self) -> Self
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 moreSource§fn map<F>(self, f: F) -> Self
fn map<F>(self, f: F) -> Self
Source§fn fold<F>(self, init: Self::Element, f: F) -> Self::Element
fn fold<F>(self, init: Self::Element, f: F) -> Self::Element
Source§fn reduce<F>(self, f: F) -> Self::Element
fn reduce<F>(self, f: F) -> Self::Element
Source§fn splat_m(src: Self, mask: Self::Mask, value: Self::Element) -> Self
fn splat_m(src: Self, mask: Self::Mask, value: Self::Element) -> Self
splat with src using mask.Source§fn splat_z(mask: Self::Mask, value: Self::Element) -> Self
fn splat_z(mask: Self::Mask, value: Self::Element) -> Self
splat masked (zeroed where mask is false).Source§fn broadcast_c<const I: usize>(self, mask: Self::Mask) -> Self
fn broadcast_c<const I: usize>(self, mask: Self::Mask) -> Self
broadcast when mask is true, returns self where false.Source§fn broadcast_m<const I: usize>(self, src: Self, mask: Self::Mask) -> Self
fn broadcast_m<const I: usize>(self, src: Self, mask: Self::Mask) -> Self
broadcast with src using mask.Source§fn broadcast_z<const I: usize>(self, mask: Self::Mask) -> Self
fn broadcast_z<const I: usize>(self, mask: Self::Mask) -> Self
broadcast masked (zeroed where mask is false).Source§fn broadcastv_c(self, mask: Self::Mask, idx: usize) -> Self
fn broadcastv_c(self, mask: Self::Mask, idx: usize) -> Self
Source§fn broadcastv_m(self, src: Self, mask: Self::Mask, idx: usize) -> Self
fn broadcastv_m(self, src: Self, mask: Self::Mask, idx: usize) -> Self
Source§fn broadcastv_z(self, mask: Self::Mask, idx: usize) -> Self
fn broadcastv_z(self, mask: Self::Mask, idx: usize) -> Self
Source§fn reverse_c(self, mask: Self::Mask) -> Self
fn reverse_c(self, mask: Self::Mask) -> Self
Source§fn reverse_m(self, src: Self, mask: Self::Mask) -> Self
fn reverse_m(self, src: Self, mask: Self::Mask) -> Self
Source§fn reverse_z(self, mask: Self::Mask) -> Self
fn reverse_z(self, mask: Self::Mask) -> Self
Source§fn swap_bytes_c(self, mask: Self::Mask) -> Self
fn swap_bytes_c(self, mask: Self::Mask) -> Self
Source§fn swap_bytes_m(self, src: Self, mask: Self::Mask) -> Self
fn swap_bytes_m(self, src: Self, mask: Self::Mask) -> Self
Source§fn swap_bytes_z(self, mask: Self::Mask) -> Self
fn swap_bytes_z(self, mask: Self::Mask) -> Self
Source§fn concat<INTO>(self, hi: Self) -> INTOwhere
INTO: ConcatVector<Self, Element = Self::Element>,
fn concat<INTO>(self, hi: Self) -> INTOwhere
INTO: ConcatVector<Self, Element = Self::Element>,
self as the lower half and hi as the upper half.Source§fn split<INTO>(self) -> (INTO, INTO)
fn split<INTO>(self) -> (INTO, INTO)
Source§fn extend<INTO>(self) -> INTOwhere
INTO: ExtendVector<Self, Element = Self::Element>,
fn extend<INTO>(self) -> INTOwhere
INTO: ExtendVector<Self, Element = Self::Element>,
Source§fn narrow<INTO>(self) -> INTO
fn narrow<INTO>(self) -> INTO
Source§fn align_slice(
slice: &[Self::Element],
) -> (&[Self::Element], &[Self], &[Self::Element])
fn align_slice( slice: &[Self::Element], ) -> (&[Self::Element], &[Self], &[Self::Element])
Source§fn align_slice_mut(
slice: &mut [Self::Element],
) -> (&mut [Self::Element], &mut [Self], &mut [Self::Element])
fn align_slice_mut( slice: &mut [Self::Element], ) -> (&mut [Self::Element], &mut [Self], &mut [Self::Element])
Source§fn from_slice(slice: &[Self::Element]) -> Self
fn from_slice(slice: &[Self::Element]) -> Self
Source§fn copy_to_slice(self, slice: &mut [Self::Element])
fn copy_to_slice(self, slice: &mut [Self::Element])
Source§fn iter_unaligned<'a>(
values: &'a [Self::Element],
) -> (Unaligned<'a, Self>, &'a [Self::Element])
fn iter_unaligned<'a>( values: &'a [Self::Element], ) -> (Unaligned<'a, Self>, &'a [Self::Element])
Source§fn iter_mut_unaligned<'a>(
values: &'a mut [Self::Element],
) -> (UnalignedMut<'a, Self>, &'a mut [Self::Element])
fn iter_mut_unaligned<'a>( values: &'a mut [Self::Element], ) -> (UnalignedMut<'a, Self>, &'a mut [Self::Element])
Source§fn stream_aligned_slice<'a>(
values: &'a [Self::Element],
) -> impl DoubleEndedIterator
fn stream_aligned_slice<'a>( values: &'a [Self::Element], ) -> impl DoubleEndedIterator
Source§fn stream_aligned_slice_mut<'a>(
values: &'a mut [Self::Element],
) -> impl DoubleEndedIterator
fn stream_aligned_slice_mut<'a>( values: &'a mut [Self::Element], ) -> impl DoubleEndedIterator
Source§fn gather<I>(slice: &[Self::Element], indices: I) -> Selfwhere
I: VectorIndices<Self>,
fn gather<I>(slice: &[Self::Element], indices: I) -> Selfwhere
I: VectorIndices<Self>,
Source§fn gather_or<I>(slice: &[Self::Element], indices: I, or: Self) -> Self
fn gather_or<I>(slice: &[Self::Element], indices: I, or: Self) -> Self
or if the index is out of bounds. Read moreSource§fn gather_or_zero<I>(slice: &[Self::Element], indices: I) -> Self
fn gather_or_zero<I>(slice: &[Self::Element], indices: I) -> Self
Source§fn gather_if<I>(
slice: &[Self::Element],
enable: Self::Mask,
indices: I,
or: Self,
) -> Selfwhere
I: VectorIndices<Self>,
Self::Mask: CastMask<<I as GenericVector>::Mask>,
Self::Element: Default,
fn gather_if<I>(
slice: &[Self::Element],
enable: Self::Mask,
indices: I,
or: Self,
) -> Selfwhere
I: VectorIndices<Self>,
Self::Mask: CastMask<<I as GenericVector>::Mask>,
Self::Element: Default,
or if the enable mask is
false OR if any index is out of bounds. Read moreSource§fn scatter<I>(self, slice: &mut [Self::Element], indices: I)
fn scatter<I>(self, slice: &mut [Self::Element], indices: I)
Source§fn scatter_if<I>(
self,
slice: &mut [Self::Element],
enable: Self::Mask,
indices: I,
)
fn scatter_if<I>( self, slice: &mut [Self::Element], enable: Self::Mask, indices: I, )
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]
unsafe fn load_deinterleaved_arrays<const M: usize, const C: usize>( ptr: *const Self::Element, ) -> [[Self; C]; M]
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 moreSource§unsafe fn store_interleaved_arrays<const M: usize, const C: usize>(
ptr: *mut Self::Element,
values: [[Self; C]; M],
)
unsafe fn store_interleaved_arrays<const M: usize, const C: usize>( ptr: *mut Self::Element, values: [[Self; C]; M], )
M records of C components and store them contiguously - the
exact inverse of
load_deinterleaved_arrays, with the
same lane-wise default. Read moreSource§unsafe fn load_deinterleaved_grouped<const M: usize, const TAIL: usize>(
ptr: *const Self::Element,
) -> [StreamGroup<Self, TAIL>; M]
unsafe fn load_deinterleaved_grouped<const M: usize, const TAIL: usize>( ptr: *const Self::Element, ) -> [StreamGroup<Self, TAIL>; M]
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 moreSource§unsafe fn store_interleaved_grouped<const M: usize, const TAIL: usize>(
ptr: *mut Self::Element,
values: [StreamGroup<Self, TAIL>; M],
)
unsafe fn store_interleaved_grouped<const M: usize, const TAIL: usize>( ptr: *mut Self::Element, values: [StreamGroup<Self, TAIL>; M], )
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 moreSource§fn lookup(values: &[Self::Element], indices: Self::Unsigned) -> Self
fn lookup(values: &[Self::Element], indices: Self::Unsigned) -> Self
Source§fn prefix_mask(n: usize) -> Self::Mask
fn prefix_mask(n: usize) -> Self::Mask
Source§fn suffix_mask(n: usize) -> Self::Mask
fn suffix_mask(n: usize) -> Self::Mask
Source§fn cast<INTO>(self) -> INTOwhere
INTO: CastVector<Self>,
fn cast<INTO>(self) -> INTOwhere
INTO: CastVector<Self>,
as operator on the underlying scalar elements for in-range, finite
inputs. Read moreSource§fn fast_cast<INTO>(self) -> INTOwhere
INTO: CastVector<Self>,
fn fast_cast<INTO>(self) -> INTOwhere
INTO: CastVector<Self>,
Source§fn into_bits<INTO>(self) -> INTOwhere
INTO: BitCastVector<Self>,
fn into_bits<INTO>(self) -> INTOwhere
INTO: BitCastVector<Self>,
Source§fn saturating_cast<INTO>(self) -> INTOwhere
INTO: CastVector<Self>,
fn saturating_cast<INTO>(self) -> INTOwhere
INTO: CastVector<Self>,
Source§impl<V: RealFloatVector> Interleave for Complex<V>
impl<V: RealFloatVector> Interleave for Complex<V>
Source§fn interleave(self, other: Self) -> (Self, Self)
fn interleave(self, other: Self) -> (Self, Self)
Source§fn deinterleave(self, other: Self) -> (Self, Self)
fn deinterleave(self, other: Self) -> (Self, Self)
interleave. Read moreSource§impl<V: RealValue, A, B> MulAddAssignExt<A, B> for Complex<V>where
Self: MulAddExt<A, B, Output = Self>,
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)
fn mul_add_assign(&mut self, a: A, b: B)
Source§fn mul_sub_assign(&mut self, a: A, b: B)
fn mul_sub_assign(&mut self, a: A, b: B)
Source§fn nmul_add_assign(&mut self, a: A, b: B)
fn nmul_add_assign(&mut self, a: A, b: B)
Source§fn nmul_sub_assign(&mut self, a: A, b: B)
fn nmul_sub_assign(&mut self, a: A, b: B)
Source§fn mul_adde_assign(&mut self, a: A, b: B)
fn mul_adde_assign(&mut self, a: A, b: B)
Source§fn mul_sube_assign(&mut self, a: A, b: B)
fn mul_sube_assign(&mut self, a: A, b: B)
Source§fn nmul_adde_assign(&mut self, a: A, b: B)
fn nmul_adde_assign(&mut self, a: A, b: B)
Source§fn nmul_sube_assign(&mut self, a: A, b: B)
fn nmul_sube_assign(&mut self, a: A, b: B)
Source§impl<V: RealFloatVector, A, B> MulAddAssignExtMasked<<V as GenericVector>::Mask, A, B> for Complex<V>
impl<V: RealFloatVector, A, B> MulAddAssignExtMasked<<V as GenericVector>::Mask, A, B> for Complex<V>
Source§fn mul_add_assign_c(&mut self, mask: V::Mask, a: A, b: B)
fn mul_add_assign_c(&mut self, mask: V::Mask, a: A, b: B)
Source§fn mul_add_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
fn mul_add_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
Source§fn mul_add_assign_z(&mut self, mask: V::Mask, a: A, b: B)
fn mul_add_assign_z(&mut self, mask: V::Mask, a: A, b: B)
Source§fn mul_sub_assign_c(&mut self, mask: V::Mask, a: A, b: B)
fn mul_sub_assign_c(&mut self, mask: V::Mask, a: A, b: B)
Source§fn mul_sub_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
fn mul_sub_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
Source§fn mul_sub_assign_z(&mut self, mask: V::Mask, a: A, b: B)
fn mul_sub_assign_z(&mut self, mask: V::Mask, a: A, b: B)
Source§fn nmul_add_assign_c(&mut self, mask: V::Mask, a: A, b: B)
fn nmul_add_assign_c(&mut self, mask: V::Mask, a: A, b: B)
Source§fn nmul_add_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
fn nmul_add_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
Source§fn nmul_add_assign_z(&mut self, mask: V::Mask, a: A, b: B)
fn nmul_add_assign_z(&mut self, mask: V::Mask, a: A, b: B)
Source§fn nmul_sub_assign_c(&mut self, mask: V::Mask, a: A, b: B)
fn nmul_sub_assign_c(&mut self, mask: V::Mask, a: A, b: B)
Source§fn nmul_sub_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
fn nmul_sub_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
Source§fn nmul_sub_assign_z(&mut self, mask: V::Mask, a: A, b: B)
fn nmul_sub_assign_z(&mut self, mask: V::Mask, a: A, b: B)
Source§fn mul_adde_assign_c(&mut self, mask: V::Mask, a: A, b: B)
fn mul_adde_assign_c(&mut self, mask: V::Mask, a: A, b: B)
Source§fn mul_adde_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
fn mul_adde_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
Source§fn mul_adde_assign_z(&mut self, mask: V::Mask, a: A, b: B)
fn mul_adde_assign_z(&mut self, mask: V::Mask, a: A, b: B)
Source§fn mul_sube_assign_c(&mut self, mask: V::Mask, a: A, b: B)
fn mul_sube_assign_c(&mut self, mask: V::Mask, a: A, b: B)
Source§fn mul_sube_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
fn mul_sube_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
Source§fn mul_sube_assign_z(&mut self, mask: V::Mask, a: A, b: B)
fn mul_sube_assign_z(&mut self, mask: V::Mask, a: A, b: B)
Source§fn nmul_adde_assign_c(&mut self, mask: V::Mask, a: A, b: B)
fn nmul_adde_assign_c(&mut self, mask: V::Mask, a: A, b: B)
Source§fn nmul_adde_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
fn nmul_adde_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
Source§fn nmul_adde_assign_z(&mut self, mask: V::Mask, a: A, b: B)
fn nmul_adde_assign_z(&mut self, mask: V::Mask, a: A, b: B)
Source§fn nmul_sube_assign_c(&mut self, mask: V::Mask, a: A, b: B)
fn nmul_sube_assign_c(&mut self, mask: V::Mask, a: A, b: B)
Source§fn nmul_sube_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
fn nmul_sube_assign_m(&mut self, src: Self, mask: V::Mask, a: A, b: B)
Source§fn nmul_sube_assign_z(&mut self, mask: V::Mask, a: A, b: B)
fn nmul_sube_assign_z(&mut self, mask: V::Mask, a: A, b: B)
Source§impl<V: RealValue> MulAddExt for Complex<V>
impl<V: RealValue> MulAddExt for Complex<V>
Source§const HAS_TRUE_FMA: bool = false
const HAS_TRUE_FMA: bool = false
Source§fn mul_sub(self, a: Self, b: Self) -> Self
fn mul_sub(self, a: Self, b: Self) -> Self
Source§fn nmul_add(self, a: Self, b: Self) -> Self
fn nmul_add(self, a: Self, b: Self) -> Self
Source§fn nmul_sub(self, a: Self, b: Self) -> Self
fn nmul_sub(self, a: Self, b: Self) -> Self
Source§fn mul_adde(self, a: Self, b: Self) -> Self
fn mul_adde(self, a: Self, b: Self) -> Self
Source§fn mul_sube(self, a: Self, b: Self) -> Self
fn mul_sube(self, a: Self, b: Self) -> Self
Source§impl<V: RealValue> MulAddExt<V> for Complex<V>
impl<V: RealValue> MulAddExt<V> for Complex<V>
Source§const HAS_TRUE_FMA: bool
const HAS_TRUE_FMA: bool
Source§fn mul_sub(self, a: V, b: Self) -> Self
fn mul_sub(self, a: V, b: Self) -> Self
Source§fn nmul_add(self, a: V, b: Self) -> Self
fn nmul_add(self, a: V, b: Self) -> Self
Source§fn nmul_sub(self, a: V, b: Self) -> Self
fn nmul_sub(self, a: V, b: Self) -> Self
Source§fn mul_adde(self, a: V, b: Self) -> Self
fn mul_adde(self, a: V, b: Self) -> Self
Source§fn mul_sube(self, a: V, b: Self) -> Self
fn mul_sube(self, a: V, b: Self) -> Self
Source§impl<V: RealFloatVector, A, B> MulAddExtMasked<<V as GenericVector>::Mask, A, B> for Complex<V>
impl<V: RealFloatVector, A, B> MulAddExtMasked<<V as GenericVector>::Mask, A, B> for Complex<V>
Source§fn mul_add_c(self, mask: V::Mask, a: A, b: B) -> Self
fn mul_add_c(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_add_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
fn mul_add_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_add_z(self, mask: V::Mask, a: A, b: B) -> Self
fn mul_add_z(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_sub_c(self, mask: V::Mask, a: A, b: B) -> Self
fn mul_sub_c(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_sub_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
fn mul_sub_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_sub_z(self, mask: V::Mask, a: A, b: B) -> Self
fn mul_sub_z(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_add_c(self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_add_c(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_add_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_add_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_add_z(self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_add_z(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_sub_c(self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_sub_c(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_sub_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_sub_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_sub_z(self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_sub_z(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_adde_c(self, mask: V::Mask, a: A, b: B) -> Self
fn mul_adde_c(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_adde_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
fn mul_adde_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_adde_z(self, mask: V::Mask, a: A, b: B) -> Self
fn mul_adde_z(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_sube_c(self, mask: V::Mask, a: A, b: B) -> Self
fn mul_sube_c(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_sube_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
fn mul_sube_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
Source§fn mul_sube_z(self, mask: V::Mask, a: A, b: B) -> Self
fn mul_sube_z(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_adde_c(self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_adde_c(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_adde_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_adde_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_adde_z(self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_adde_z(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_sube_c(self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_sube_c(self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_sube_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_sube_m(self, src: Self, mask: V::Mask, a: A, b: B) -> Self
Source§fn nmul_sube_z(self, mask: V::Mask, a: A, b: B) -> Self
fn nmul_sube_z(self, mask: V::Mask, a: A, b: B) -> Self
Source§impl<V: RealValue, T> MulAssign<T> for Complex<V>where
Self: Mul<T, Output = Self>,
impl<V: RealValue, T> MulAssign<T> for Complex<V>where
Self: Mul<T, Output = Self>,
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreSource§impl<V: RealFloatVector, Rhs> MulAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> MulAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§fn mul_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
fn mul_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
Source§fn mul_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
fn mul_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
Source§fn mul_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
fn mul_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
MulAssign masked (zeroed where mask is false).Source§impl<V: RealFloatVector, Rhs> MulMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> MulMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§impl<V: RealFloatVector> NegMasked<<V as GenericVector>::Mask> for Complex<V>
impl<V: RealFloatVector> NegMasked<<V as GenericVector>::Mask> for Complex<V>
Source§impl<V: RealFloatVector> NewVector<Complex<<V as GenericVector>::Element>, <V as GenericVector>::Lanes> for Complex<V>
impl<V: RealFloatVector> NewVector<Complex<<V as GenericVector>::Element>, <V as GenericVector>::Lanes> for Complex<V>
Source§impl<V: RealFloatVector> NumericVector for Complex<V>
impl<V: RealFloatVector> NumericVector for Complex<V>
Source§fn to_signed_integer(self) -> Self::Signed
fn to_signed_integer(self) -> Self::Signed
as semantics -
round toward zero, saturating at the bounds, NaN to zero. Read moreSource§fn from_signed_integer(v: Self::Signed) -> Self
fn from_signed_integer(v: Self::Signed) -> Self
as semantics. Read moreSource§fn to_unsigned_integer(self) -> Self::Unsigned
fn to_unsigned_integer(self) -> Self::Unsigned
as semantics.
See to_signed_integer.Source§fn from_unsigned_integer(v: Self::Unsigned) -> Self
fn from_unsigned_integer(v: Self::Unsigned) -> Self
as semantics.
See from_signed_integer.Source§fn is_zero(self) -> Self::Mask
fn is_zero(self) -> Self::Mask
Source§fn is_all_zero(self) -> bool
fn is_all_zero(self) -> bool
Source§fn bitonic_clean_by<O: SortOrder>(self) -> Self
fn bitonic_clean_by<O: SortOrder>(self) -> Self
O order - one that rises then
falls, or a rotation of one. Read moreSource§fn clamp(self, min: Self, max: Self) -> Self
fn clamp(self, min: Self, max: Self) -> Self
Source§fn min_element(self) -> Self::Element
fn min_element(self) -> Self::Element
Source§fn max_element(self) -> Self::Element
fn max_element(self) -> Self::Element
Source§fn min_max_element(self) -> (Self::Element, Self::Element)
fn min_max_element(self) -> (Self::Element, Self::Element)
Source§fn arg_minmax(self) -> (usize, usize)
fn arg_minmax(self) -> (usize, usize)
Source§fn sum_elements(self) -> Self::Element
fn sum_elements(self) -> Self::Element
Source§fn prefix_sum(self) -> Self
fn prefix_sum(self) -> Self
out[i] = self[0] + .. + self[i]. Read moreSource§fn reverse_prefix_sum(self) -> Self
fn reverse_prefix_sum(self) -> Self
out[i] = self[i] + .. + self[LANES-1].Source§fn prefix_min(self) -> Self
fn prefix_min(self) -> Self
out[i] = min(self[0], .., self[i]). Read moreSource§fn prefix_max(self) -> Self
fn prefix_max(self) -> Self
out[i] = max(self[0], .., self[i]). Read moreSource§fn reverse_prefix_min(self) -> Self
fn reverse_prefix_min(self) -> Self
out[i] = min(self[i], .., self[LANES-1]). Read moreSource§fn reverse_prefix_max(self) -> Self
fn reverse_prefix_max(self) -> Self
out[i] = max(self[i], .., self[LANES-1]). Read moreSource§fn prod_elements(self) -> Self::Element
fn prod_elements(self) -> Self::Element
Source§fn indexed() -> Self
fn indexed() -> Self
[0, 1, 2, ..., LANES-1]. Read moreSource§fn scale(self, factor: Self::Element) -> Self
fn scale(self, factor: Self::Element) -> Self
Source§fn scale_c(self, mask: Self::Mask, factor: Self::Element) -> Self
fn scale_c(self, mask: Self::Mask, factor: Self::Element) -> Self
Source§fn scale_m(self, src: Self, mask: Self::Mask, factor: Self::Element) -> Self
fn scale_m(self, src: Self, mask: Self::Mask, factor: Self::Element) -> Self
Source§fn scale_z(self, mask: Self::Mask, factor: Self::Element) -> Self
fn scale_z(self, mask: Self::Mask, factor: Self::Element) -> Self
Source§fn min_c(self, mask: Self::Mask, rhs: Self) -> Self
fn min_c(self, mask: Self::Mask, rhs: Self) -> Self
min when mask is true, returns self where false.Source§fn min_z(self, mask: Self::Mask, rhs: Self) -> Self
fn min_z(self, mask: Self::Mask, rhs: Self) -> Self
min masked (zeroed where mask is false).Source§fn max_c(self, mask: Self::Mask, rhs: Self) -> Self
fn max_c(self, mask: Self::Mask, rhs: Self) -> Self
max when mask is true, returns self where false.Source§fn max_z(self, mask: Self::Mask, rhs: Self) -> Self
fn max_z(self, mask: Self::Mask, rhs: Self) -> Self
max masked (zeroed where mask is false).Source§fn pairwise_sum(lo: Self, hi: Self) -> Self
fn pairwise_sum(lo: Self, hi: Self) -> Self
Source§fn relaxed_pairwise_sum(lo: Self, hi: Self) -> Self
fn relaxed_pairwise_sum(lo: Self, hi: Self) -> Self
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 moreSource§fn fast_to_signed_integer(self) -> Self::Signed
fn fast_to_signed_integer(self) -> Self::Signed
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
fn fast_to_unsigned_integer(self) -> Self::Unsigned
to_unsigned_integer, but may relax IEEE
corner cases. Defaults to the exact form.Source§fn sort(self) -> Self
fn sort(self) -> Self
sort_by::<Ascending>.Source§fn bitonic_clean(self) -> Self
fn bitonic_clean(self) -> Self
bitonic_clean_by::<Ascending>.Source§impl<V: PartialOrd> PartialOrd for Complex<V>
impl<V: PartialOrd> PartialOrd for Complex<V>
Source§impl<V: RealFloatVector> PartialOrdVector for Complex<V>
impl<V: RealFloatVector> PartialOrdVector for Complex<V>
Source§fn group_by_value(self, valid: Self::Mask) -> ValueGroups<Self> ⓘ
fn group_by_value(self, valid: Self::Mask) -> ValueGroups<Self> ⓘ
valid into groups of equal value. Read moreSource§impl<V: RealValue, T> RemAssign<T> for Complex<V>where
Self: Rem<T, Output = Self>,
impl<V: RealValue, T> RemAssign<T> for Complex<V>where
Self: Rem<T, Output = Self>,
Source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
%= operation. Read moreSource§impl<V: RealFloatVector, Rhs> RemAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> RemAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§fn rem_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
fn rem_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
Source§fn rem_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
fn rem_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
Source§fn rem_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
fn rem_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
RemAssign masked (zeroed where mask is false).Source§impl<V: RealFloatVector, Rhs> RemMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> RemMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§impl<E: RealValue + FloatElement> SignedElement for Complex<E>
impl<E: RealValue + FloatElement> SignedElement for Complex<E>
Source§impl<V: RealFloatVector> SignedVector for Complex<V>
impl<V: RealFloatVector> SignedVector for Complex<V>
Source§fn signum(self) -> Self
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 MIN_POSITIVE: Self
const MIN_POSITIVE: Self
Source§fn is_positive(self) -> Self::Mask
fn is_positive(self) -> Self::Mask
Source§fn is_negative(self) -> Self::Mask
fn is_negative(self) -> Self::Mask
Source§fn select_negative(self, if_neg: Self, if_pos: Self) -> Self
fn select_negative(self, if_neg: Self, if_pos: Self) -> Self
if_neg and if_pos.Source§fn copysign(self, sign: Self) -> Self
fn copysign(self, sign: Self) -> Self
Source§fn abs_c(self, mask: Self::Mask) -> Self
fn abs_c(self, mask: Self::Mask) -> Self
abs when mask is true, returns self where false.Source§fn abs_z(self, mask: Self::Mask) -> Self
fn abs_z(self, mask: Self::Mask) -> Self
abs masked (zeroed where mask is false).Source§fn copysign_c(self, mask: Self::Mask, rhs: Self) -> Self
fn copysign_c(self, mask: Self::Mask, rhs: Self) -> Self
copysign when mask is true, returns self where false.Source§fn copysign_m(self, src: Self, mask: Self::Mask, rhs: Self) -> Self
fn copysign_m(self, src: Self, mask: Self::Mask, rhs: Self) -> Self
copysign with src using mask.Source§fn copysign_z(self, mask: Self::Mask, rhs: Self) -> Self
fn copysign_z(self, mask: Self::Mask, rhs: Self) -> Self
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.
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§impl<V: RealFloatVector> SpecializedComplexMath<Complex<<V as GenericVector>::Element>> for Complex<V>
impl<V: RealFloatVector> SpecializedComplexMath<Complex<<V as GenericVector>::Element>> for Complex<V>
Source§impl<E, V: FloatVector<Element = E>, const N: usize> SpecializedComplexSpecialMath<Complex<Dual<E, N>>> for Complex<Dual<V, N>>
Available on crate features dual and special only.
impl<E, V: FloatVector<Element = E>, const N: usize> SpecializedComplexSpecialMath<Complex<Dual<E, N>>> for Complex<Dual<V, N>>
dual and special only.Source§fn complex_trigamma<P: Policy>(self) -> Self
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.
fn complex_tgamma<P: Policy>(self) -> Self
fn complex_lgamma<P: Policy>(self) -> Self
fn complex_digamma<P: Policy>(self) -> Self
fn complex_lambert_w<P: Policy>(self) -> (Self, Self)
Source§fn faddeeva_w<P: Policy>(self) -> Self
fn faddeeva_w<P: Policy>(self) -> Self
$w(z) = e^{-z^2}\operatorname{erfc}(-iz)$. Read moreSource§fn erfcx<P: Policy>(self) -> Self
fn erfcx<P: Policy>(self) -> Self
$\operatorname{erfcx}(z) = e^{z^2}\operatorname{erfc}(z) = w(iz)$. Read moreSource§fn voigt<P: Policy>(self) -> Self::Real
fn voigt<P: Policy>(self) -> Self::Real
$K(x, y) = \operatorname{Re} w(x + iy)$, the convolution of
a Gaussian and a Lorentzian in normalized coordinates, as a real value. Read moreSource§fn complex_beta<P: Policy>(self, b: Self) -> Self
fn complex_beta<P: Policy>(self, b: Self) -> Self
$B(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$ Read moreSource§impl<V: RealFloatVector<Element = f32>> SpecializedComplexSpecialMath<Complex<f32>> for Complex<V>
Available on crate feature special only.
impl<V: RealFloatVector<Element = f32>> SpecializedComplexSpecialMath<Complex<f32>> for Complex<V>
special only.fn complex_tgamma<P: Policy>(self) -> Self
fn complex_lgamma<P: Policy>(self) -> Self
fn complex_digamma<P: Policy>(self) -> Self
fn complex_trigamma<P: Policy>(self) -> Self
fn complex_lambert_w<P: Policy>(self) -> (Self, Self)
Source§fn faddeeva_w<P: Policy>(self) -> Self
fn faddeeva_w<P: Policy>(self) -> Self
$w(z) = e^{-z^2}\operatorname{erfc}(-iz)$. Read moreSource§fn erfcx<P: Policy>(self) -> Self
fn erfcx<P: Policy>(self) -> Self
$\operatorname{erfcx}(z) = e^{z^2}\operatorname{erfc}(z) = w(iz)$. Read moreSource§fn voigt<P: Policy>(self) -> Self::Real
fn voigt<P: Policy>(self) -> Self::Real
$K(x, y) = \operatorname{Re} w(x + iy)$, the convolution of
a Gaussian and a Lorentzian in normalized coordinates, as a real value. Read moreSource§fn complex_beta<P: Policy>(self, b: Self) -> Self
fn complex_beta<P: Policy>(self, b: Self) -> Self
$B(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$ Read moreSource§impl<V: RealFloatVector<Element = f64>> SpecializedComplexSpecialMath<Complex<f64>> for Complex<V>
Available on crate feature special only.
impl<V: RealFloatVector<Element = f64>> SpecializedComplexSpecialMath<Complex<f64>> for Complex<V>
special only.fn complex_tgamma<P: Policy>(self) -> Self
fn complex_lgamma<P: Policy>(self) -> Self
fn complex_digamma<P: Policy>(self) -> Self
fn complex_trigamma<P: Policy>(self) -> Self
fn complex_lambert_w<P: Policy>(self) -> (Self, Self)
Source§fn faddeeva_w<P: Policy>(self) -> Self
fn faddeeva_w<P: Policy>(self) -> Self
$w(z) = e^{-z^2}\operatorname{erfc}(-iz)$. Read moreSource§fn erfcx<P: Policy>(self) -> Self
fn erfcx<P: Policy>(self) -> Self
$\operatorname{erfcx}(z) = e^{z^2}\operatorname{erfc}(z) = w(iz)$. Read moreSource§fn voigt<P: Policy>(self) -> Self::Real
fn voigt<P: Policy>(self) -> Self::Real
$K(x, y) = \operatorname{Re} w(x + iy)$, the convolution of
a Gaussian and a Lorentzian in normalized coordinates, as a real value. Read moreSource§fn complex_beta<P: Policy>(self, b: Self) -> Self
fn complex_beta<P: Policy>(self, b: Self) -> Self
$B(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$ Read moreSource§impl<V: RealFloatVector> SpecializedCoreMath<Complex<<V as GenericVector>::Element>> for Complex<V>
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
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.
fn inverse_sqrt<P: Policy>(self) -> Self
fn poly<P, const N: usize>(self, coeffs: &[E; N]) -> Selfwhere
P: Policy,
fn poly_rev<P, const N: usize>(self, coeffs: &[E; N]) -> Selfwhere
P: Policy,
fn reciprocal<P>(self) -> Selfwhere
P: Policy,
fn approx_div<P>(self, rhs: Self) -> Selfwhere
P: Policy,
fn reciprocal_adde<P>(self, a: Self) -> Selfwhere
P: Policy,
fn powi<P>(self, e: i32) -> Selfwhere
P: Policy,
fn powic<P, const N: i32>(self) -> Selfwhere
P: Policy,
fn powiv<P>(self, e: Self::Signed) -> Selfwhere
P: Policy,
Source§impl<V: RealFloatVector> SpecializedSpatialMath<Complex<<V as GenericVector>::Element>> for Complex<V>
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
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
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 l2_norm_squared<P: Policy>(self) -> Self
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
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.
fn hypot<P>(self, y: Self) -> Selfwhere
P: Policy,
Source§impl<E, V: RealFloatVector<Element = E>> SpecializedSpecialMath<Complex<E>> for Complex<V>
Available on crate feature special only.
impl<E, V: RealFloatVector<Element = E>> SpecializedSpecialMath<Complex<E>> for Complex<V>
special only.Source§fn erf<P: Policy>(self) -> Self
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
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
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
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)
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>
type ExpIntDetails = Complex<V>
expint kernel. Almost always
Self, with an empty ExpIntDetails impl taking every default.fn tgamma<P: Policy>(self) -> Self
fn lgamma<P: Policy>(self) -> Self
fn digamma<P: Policy>(self) -> Self
fn beta<P: Policy>(a: Self, b: Self) -> Self
Source§fn expint<P, const N: usize>(self) -> Selfwhere
P: Policy,
fn expint<P, const N: usize>(self) -> Selfwhere
P: Policy,
E_N(x) for integer order N.Source§fn expint_primal<P, const N: usize>(self) -> (Self, Self)where
P: Policy,
fn expint_primal<P, const N: usize>(self) -> (Self, Self)where
P: Policy,
fn hermite<P, const N: usize>(x: Self) -> Selfwhere
P: Policy,
fn hermitev<P>(x: Self, n: Self::Unsigned) -> Selfwhere
P: Policy,
fn chebyshev<P, const K: usize, const N: usize>(
self,
coeffs: &[Self::Element; N],
) -> Selfwhere
P: Policy,
fn jacobi<P>(x: Self, alpha: Self, beta: Self, n: u32, m: u32) -> Selfwhere
P: Policy,
fn gaussian<P>(x: Self, a: Self, c: Self) -> Selfwhere
P: Policy,
fn legendre0<P, const N: u32>(x: Self, n: u32) -> Selfwhere
P: Policy,
fn legendre<P>(x: Self, n: u32, m: u32) -> Selfwhere
P: Policy,
Source§impl<V: RealFloatVector> SpecializedTranscendentalMath<Complex<<V as GenericVector>::Element>> for Complex<V>
impl<V: RealFloatVector> SpecializedTranscendentalMath<Complex<<V as GenericVector>::Element>> for Complex<V>
Source§fn sin_cos<P: Policy>(self) -> (Self, Self)
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)
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
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)
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
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
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
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 exp2<P: Policy>(self) -> Self
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
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
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
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
fn exp10_m1<P: Policy>(self) -> Self
$10^z - 1$. Through the real exp10_m1 above Average, as exp10 is.
Source§fn cbrt<P: Policy>(self) -> Self
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
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
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
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
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
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
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
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
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
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
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 acosh<P: Policy>(self) -> Self
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
fn atanh<P: Policy>(self) -> Self
atanh(z) = (ln(1 + z) - ln(1 - z)) / 2.
Branch cuts on (-inf, -1] and [1, inf).
fn sin<P>(self) -> Selfwhere
P: Policy,
fn cos<P>(self) -> Selfwhere
P: Policy,
fn sin_pi<P>(self) -> Selfwhere
P: Policy,
fn cos_pi<P>(self) -> Selfwhere
P: Policy,
fn tan_pi<P>(self) -> Selfwhere
P: Policy,
fn sinh<P>(self) -> Selfwhere
P: Policy,
fn cosh<P>(self) -> Selfwhere
P: Policy,
fn sqrt1pm1<P>(self) -> Selfwhere
P: Policy,
fn compound<P>(self, n: Self) -> Selfwhere
P: Policy,
fn powf_m1<P>(self, e: Self) -> Selfwhere
P: Policy,
fn haversin<P>(self) -> Selfwhere
P: Policy,
fn versin<P>(self) -> Selfwhere
P: Policy,
fn cos_m1<P>(self) -> Selfwhere
P: Policy,
fn log2_p1<P>(self) -> Selfwhere
P: Policy,
fn log10_p1<P>(self) -> Selfwhere
P: Policy,
fn log<P>(self, base: Self) -> Selfwhere
P: Policy,
Source§fn ln1m_expnx<P>(self) -> Selfwhere
P: Policy,
fn ln1m_expnx<P>(self) -> Selfwhere
P: Policy,
Source§impl<V: RealFloatVector> SplatVector<Complex<<V as GenericVector>::Element>> for Complex<V>
impl<V: RealFloatVector> SplatVector<Complex<<V as GenericVector>::Element>> for Complex<V>
Source§type Splat<T: SplatConst<Complex<V::Element>>> = Complex<V>
type Splat<T: SplatConst<Complex<V::Element>>> = Complex<V>
T, the type exposing the splatted vector
constant via VectorValue.Source§impl<V: RealFloatVector> SquareMasked<<V as GenericVector>::Mask> for Complex<V>
impl<V: RealFloatVector> SquareMasked<<V as GenericVector>::Mask> for Complex<V>
impl<V: PartialEq> StructuralPartialEq for Complex<V>
Source§impl<V: RealValue, T> SubAssign<T> for Complex<V>where
Self: Sub<T, Output = Self>,
impl<V: RealValue, T> SubAssign<T> for Complex<V>where
Self: Sub<T, Output = Self>,
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-= operation. Read moreSource§impl<V: RealFloatVector, Rhs> SubAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> SubAssignMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§fn sub_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
fn sub_assign_c(&mut self, mask: V::Mask, rhs: Rhs)
Source§fn sub_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
fn sub_assign_m(&mut self, src: Self, mask: V::Mask, rhs: Rhs)
Source§fn sub_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
fn sub_assign_z(&mut self, mask: V::Mask, rhs: Rhs)
SubAssign masked (zeroed where mask is false).Source§impl<V: RealFloatVector, Rhs> SubMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
impl<V: RealFloatVector, Rhs> SubMasked<<V as GenericVector>::Mask, Rhs> for Complex<V>
Source§impl<V: RealFloatVector> Swizzle<<V as GenericVector>::Lanes> for Complex<V>
impl<V: RealFloatVector> Swizzle<<V as GenericVector>::Lanes> for Complex<V>
Source§fn swizzle(self, other: Self, indices: GenericArray<u32, V::Lanes>) -> Self
fn swizzle(self, other: Self, indices: GenericArray<u32, V::Lanes>) -> Self
Source§fn permute(self, indices: GenericArray<u32, V::Lanes>) -> Self
fn permute(self, indices: GenericArray<u32, V::Lanes>) -> Self
fn swizzle_const<I: SwizzleIndices<V::Lanes>>(self, other: Self) -> Self
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>
impl<V: RealFloatVector, E: SplatConst<Complex<V::Element>>> VectorValue<E, Complex<V>> for Complex<V>
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§
impl<V, Mask, Rhs> AssignMaskedNumOps<Mask, Rhs> for Vwhere
V: AddAssignMasked<Mask, Rhs> + SubAssignMasked<Mask, Rhs> + MulAssignMasked<Mask, Rhs> + DivAssignMasked<Mask, Rhs> + RemAssignMasked<Mask, Rhs>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CompensatedGammaOps for Twhere
T: FloatVector + TranscendentalMathWithPolicy,
Source§impl<M> ComplexMath for Mwhere
M: ComplexMathWithPolicy,
impl<M> ComplexMath for Mwhere
M: ComplexMathWithPolicy,
Source§fn to_polar(self) -> (Self::Real, Self::Real)
fn to_polar(self) -> (Self::Real, Self::Real)
(r, theta), such that self == r * exp(i*theta).Source§fn from_polar(r: Self::Real, theta: Self::Real) -> Self
fn from_polar(r: Self::Real, theta: Self::Real) -> Self
r * exp(i*theta).Source§impl<E, V> ComplexMathWithPolicy for V
impl<E, V> ComplexMathWithPolicy for V
Source§fn norm_p<P>(self) -> <V as ComplexVector>::Realwhere
P: Policy,
fn norm_p<P>(self) -> <V as ComplexVector>::Realwhere
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>::Realwhere
P: Policy,
fn arg_p<P>(self) -> <V as ComplexVector>::Realwhere
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,
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,
) -> Vwhere
P: Policy,
fn from_polar_p<P>(
r: <V as ComplexVector>::Real,
theta: <V as ComplexVector>::Real,
) -> Vwhere
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) -> Vwhere
P: Policy,
fn powfr_p<P>(self, e: <V as ComplexVector>::Real) -> Vwhere
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) -> Vwhere
P: Policy,
fn expf_p<P>(self, base: <V as ComplexVector>::Real) -> Vwhere
P: Policy,
Raises a real base to the complex power self.
Source§fn logr_p<P>(self, base: <V as ComplexVector>::Real) -> Vwhere
P: Policy,
fn logr_p<P>(self, base: <V as ComplexVector>::Real) -> Vwhere
P: Policy,
The logarithm of self in an arbitrary real base.
The complex-base form is log.
Source§impl<M> ComplexSpecialMath for Mwhere
M: ComplexSpecialMathWithPolicy,
impl<M> ComplexSpecialMath for Mwhere
M: ComplexSpecialMathWithPolicy,
Source§fn faddeeva_w(self) -> Self
fn faddeeva_w(self) -> Self
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 moreSource§impl<E, V> ComplexSpecialMathWithPolicy for Vwhere
E: FloatElement,
V: FloatVector<Element = E> + ComplexVector + SpecializedComplexSpecialMath<E>,
impl<E, V> ComplexSpecialMathWithPolicy for Vwhere
E: FloatElement,
V: FloatVector<Element = E> + ComplexVector + SpecializedComplexSpecialMath<E>,
Source§fn faddeeva_w_p<P>(self) -> Vwhere
P: Policy,
Available on crate feature special only.
fn faddeeva_w_p<P>(self) -> Vwhere
P: Policy,
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§impl<M> CoreMath for Mwhere
M: CoreMathWithPolicy,
impl<M> CoreMath for Mwhere
M: CoreMathWithPolicy,
Source§fn poly<const N: usize>(self, coeffs: &[Self::Element; N]) -> Self
fn poly<const N: usize>(self, coeffs: &[Self::Element; N]) -> Self
self. Read moreSource§fn poly_rev<const N: usize>(self, coeffs: &[Self::Element; N]) -> Self
fn poly_rev<const N: usize>(self, coeffs: &[Self::Element; N]) -> Self
self, but with the coefficients in reverse order. Read moreSource§fn poly_rational<const N: usize, const D: usize>(
self,
numerator: &[Self::Element; N],
denominator: &[Self::Element; D],
) -> Self
fn poly_rational<const N: usize, const D: usize>( self, numerator: &[Self::Element; N], denominator: &[Self::Element; D], ) -> Self
self, given the numerator and denominator coefficients. Read moreSource§fn reciprocal(self) -> Self
fn reciprocal(self) -> Self
Source§fn approx_div(self, divisor: Self) -> Self
fn approx_div(self, divisor: Self) -> Self
Source§fn inverse_sqrt(self) -> Self
fn inverse_sqrt(self) -> Self
Source§impl<E, V> CoreMathWithPolicy for V
impl<E, V> CoreMathWithPolicy for V
Source§fn poly_p<P, const N: usize>(
self,
coeffs: &[<V as GenericVector>::Element; N],
) -> Vwhere
P: Policy,
fn poly_p<P, const N: usize>(
self,
coeffs: &[<V as GenericVector>::Element; N],
) -> Vwhere
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],
) -> Vwhere
P: Policy,
fn poly_rev_p<P, const N: usize>(
self,
coeffs: &[<V as GenericVector>::Element; N],
) -> Vwhere
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],
) -> Vwhere
P: Policy,
fn poly_rational_p<P, const N: usize, const D: usize>(
self,
numerator: &[<V as GenericVector>::Element; N],
denominator: &[<V as GenericVector>::Element; D],
) -> Vwhere
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) -> Vwhere
P: Policy,
fn reciprocal_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn approx_div_p<P>(self, divisor: V) -> Vwhere
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) -> Vwhere
P: Policy,
fn inverse_sqrt_p<P>(self) -> Vwhere
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§impl<V> GenericVector2 for V
impl<V> GenericVector2 for V
Source§impl<V> GenericVector3 for V
impl<V> GenericVector3 for V
Source§impl<V> GenericVector4 for V
impl<V> GenericVector4 for V
Source§impl<T> LowerBounded for Twhere
T: Bounded,
impl<T> LowerBounded for Twhere
T: Bounded,
impl<T, A, B> MaskInteroperable<A, B> for Twhere
T: GenericVector,
<T as GenericVector>::Mask: CastMask<<A as GenericVector>::Mask> + CastMask<<B as GenericVector>::Mask>,
A: GenericVector<Lanes = <T as GenericVector>::Lanes>,
<A as GenericVector>::Mask: CastMask<<T as GenericVector>::Mask> + CastMask<<B as GenericVector>::Mask>,
B: GenericVector<Lanes = <T as GenericVector>::Lanes>,
<B as GenericVector>::Mask: CastMask<<T as GenericVector>::Mask> + CastMask<<A as GenericVector>::Mask>,
impl<V, Mask, Rhs> MaskedNumOps<Mask, Rhs> for V
impl<T, Rhs> NumAssignOps<Rhs> for T
impl<T, Rhs, Output> NumOps<Rhs, Output> for T
impl<V, A, B> PartiallyInteroperable<A, B> for Vwhere
V: GenericVector + CastVector<V> + CastVector<A> + CastVector<B>,
<V as GenericVector>::Mask: CastMask<<A as GenericVector>::Mask> + CastMask<<B as GenericVector>::Mask>,
A: CastVector<V> + GenericVector<Lanes = <V as GenericVector>::Lanes>,
<A as GenericVector>::Mask: CastMask<<V as GenericVector>::Mask> + CastMask<<B as GenericVector>::Mask>,
B: CastVector<V> + GenericVector<Lanes = <V as GenericVector>::Lanes>,
<B as GenericVector>::Mask: CastMask<<V as GenericVector>::Mask> + CastMask<<A as GenericVector>::Mask>,
Source§impl<M> SpatialMath for Mwhere
M: SpatialMathWithPolicy,
impl<M> SpatialMath for Mwhere
M: SpatialMathWithPolicy,
Source§fn hypot_n<const N: usize>(values: [Self; N]) -> Self
fn hypot_n<const N: usize>(values: [Self; N]) -> Self
$\sqrt{x_1^2 + x_2^2 + \dots + x_N^2}$. Read moreSource§fn inv_hypot_n<const N: usize>(values: [Self; N]) -> Self
fn inv_hypot_n<const N: usize>(values: [Self; N]) -> Self
$1/\sqrt{x_1^2 + x_2^2 + \dots + x_N^2}$. Read moreSource§fn l2_norm_squared(self) -> Self
fn l2_norm_squared(self) -> Self
Source§impl<E, V> SpatialMathWithPolicy for Vwhere
E: FloatElement,
V: FloatVector<Element = E> + CoreMathWithPolicy + SpecializedSpatialMath<E>,
impl<E, V> SpatialMathWithPolicy for Vwhere
E: FloatElement,
V: FloatVector<Element = E> + CoreMathWithPolicy + SpecializedSpatialMath<E>,
Source§fn hypot_p<P>(self, other: V) -> Vwhere
P: Policy,
fn hypot_p<P>(self, other: V) -> Vwhere
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]) -> Vwhere
P: Policy,
fn hypot_n_p<P, const N: usize>(values: [V; N]) -> Vwhere
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]) -> Vwhere
P: Policy,
fn inv_hypot_n_p<P, const N: usize>(values: [V; N]) -> Vwhere
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) -> Vwhere
P: Policy,
fn l1_norm_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn l2_norm_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn l2_norm_squared_p<P>(self) -> Vwhere
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 Mwhere
M: SpecialMathWithPolicy,
impl<M> SpecialMath for Mwhere
M: SpecialMathWithPolicy,
Source§fn logistic_sigmoid(self) -> Self
fn logistic_sigmoid(self) -> Self
$\sigma(x) = \frac{1}{1 + e^{-x}}$. Read moreSource§fn softplus(self, k: Self, rcp_k: Self) -> Self
fn softplus(self, k: Self, rcp_k: Self) -> Self
$\frac{1}{k}\ln(1 + e^{kx})$. Read moreSource§fn tgamma(self) -> Self
fn tgamma(self) -> Self
$\Gamma(z)$) for any real input, for each value in a vector. Read moreSource§fn lgamma(self) -> Self
fn lgamma(self) -> Self
$\ln|\Gamma(x)|$) for any real input, for each value in a vector.Source§fn digamma(self) -> Self
fn digamma(self) -> Self
$\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 moreSource§fn jacobi(self, alpha: Self, beta: Self, n: u32, m: u32) -> Self
fn jacobi(self, alpha: Self, beta: Self, n: u32, m: u32) -> Self
Source§fn hermite<const N: usize>(self) -> Self
fn hermite<const N: usize>(self) -> Self
H_n(x) where x is self and N is the polynomial degree. Read moreSource§fn hermitev(self, n: Self::Unsigned) -> Self
fn hermitev(self, n: Self::Unsigned) -> Self
H_n(x) where x is self and n is a vector of unsigned integers representing the polynomial degree. Read moreSource§fn gaussian(self, a: Self, c: Self) -> Self
fn gaussian(self, a: Self, c: Self) -> Self
a and standard deviation c, defined as $a\, e^{-\frac{1}{2}(x/c)^2}$. Read moreSource§fn legendre(self, n: u32, m: u32) -> Self
fn legendre(self, n: u32, m: u32) -> Self
Source§fn expint<const N: usize>(self) -> Self
fn expint<const N: usize>(self) -> Self
E_n(x) for integer order n.Source§fn carlson<K>(kind: K) -> Selfwhere
K: CarlsonKind<Output = Self>,
fn carlson<K>(kind: K) -> Selfwhere
K: CarlsonKind<Output = Self>,
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 moreSource§fn ellint<K>(kind: K) -> Selfwhere
K: EllipticKind<Output = Self>,
fn ellint<K>(kind: K) -> Selfwhere
K: EllipticKind<Output = Self>,
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 moreSource§impl<E, V> SpecialMathWithPolicy for V
impl<E, V> SpecialMathWithPolicy for V
Source§fn erf_p<P>(self) -> Vwhere
P: Policy,
fn erf_p<P>(self) -> Vwhere
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 logistic_sigmoid_p<P>(self) -> Vwhere
P: Policy,
fn logistic_sigmoid_p<P>(self) -> Vwhere
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 fasterNotably, 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) -> Vwhere
P: Policy,
fn softplus_p<P>(self, k: V, rcp_k: V) -> Vwhere
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) -> Vwhere
P: Policy,
fn tgamma_p<P>(self) -> Vwhere
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$untilzis 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) -> Vwhere
P: Policy,
fn lgamma_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn digamma_p<P>(self) -> Vwhere
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 jacobi_p<P>(self, alpha: V, beta: V, n: u32, m: u32) -> Vwhere
P: Policy,
fn jacobi_p<P>(self, alpha: V, beta: V, n: u32, m: u32) -> Vwhere
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) -> Vwhere
P: Policy,
fn hermite_p<P, const N: usize>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn hermitev_p<P>(self, n: <V as GenericVector>::Unsigned) -> Vwhere
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],
) -> Vwhere
P: Policy,
fn chebyshev_p<P, const K: usize, const N: usize>(
self,
coeffs: &[<V as GenericVector>::Element; N],
) -> Vwhere
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):
K | Kind | P_1(x) | Notes |
|---|---|---|---|
1 | First (T_k) | x | Most common; minimax/approximation basis on [-1, 1]. |
2 | Second (U_k) | 2x | Related to $\sin((k+1)\theta)/\sin(\theta)$ under $x = \cos\theta$. |
3 | Third (V_k) | 2x - 1 | “Airfoil” polynomials; $\cos((k+\tfrac12)\theta)/\cos(\theta/2)$. |
4 | Fourth (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) -> Vwhere
P: Policy,
fn gaussian_p<P>(self, a: V, c: V) -> Vwhere
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) -> Vwhere
P: Policy,
fn legendre_p<P>(self, n: u32, m: u32) -> Vwhere
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,
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) -> Vwhere
P: Policy,
fn expint_p<P, const N: usize>(self) -> Vwhere
P: Policy,
Computes the generalized exponential integral E_n(x) for integer order n.
Source§fn carlson_p<P, K>(kind: K) -> Vwhere
P: Policy,
K: CarlsonKind<Output = V>,
fn carlson_p<P, K>(kind: K) -> Vwhere
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) -> Vwhere
P: Policy,
K: EllipticKind<Output = V>,
fn ellint_p<P, K>(kind: K) -> Vwhere
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
impl<V> Swizzle3 for V
fn xyz(self) -> V
fn xxx(self) -> V
fn xxy(self) -> V
fn xxz(self) -> V
fn xyx(self) -> V
fn xyy(self) -> V
fn xzx(self) -> V
fn xzy(self) -> V
fn xzz(self) -> V
fn yxx(self) -> V
fn yxy(self) -> V
fn yxz(self) -> V
fn yyx(self) -> V
fn yyy(self) -> V
fn yyz(self) -> V
fn yzx(self) -> V
fn yzy(self) -> V
fn yzz(self) -> V
fn zxx(self) -> V
fn zxy(self) -> V
fn zxz(self) -> V
fn zyx(self) -> V
fn zyy(self) -> V
fn zyz(self) -> V
fn zzx(self) -> V
fn zzy(self) -> V
fn zzz(self) -> V
Source§impl<V> Swizzle4 for V
impl<V> Swizzle4 for V
fn xyzw(self) -> V
fn xxxx(self) -> V
fn xxxy(self) -> V
fn xxxz(self) -> V
fn xxxw(self) -> V
fn xxyx(self) -> V
fn xxyy(self) -> V
fn xxyz(self) -> V
fn xxyw(self) -> V
fn xxzx(self) -> V
fn xxzy(self) -> V
fn xxzz(self) -> V
fn xxzw(self) -> V
fn xxwx(self) -> V
fn xxwy(self) -> V
fn xxwz(self) -> V
fn xxww(self) -> V
fn xyxx(self) -> V
fn xyxy(self) -> V
fn xyxz(self) -> V
fn xyxw(self) -> V
fn xyyx(self) -> V
fn xyyy(self) -> V
fn xyyz(self) -> V
fn xyyw(self) -> V
fn xyzx(self) -> V
fn xyzy(self) -> V
fn xyzz(self) -> V
fn xywx(self) -> V
fn xywy(self) -> V
fn xywz(self) -> V
fn xyww(self) -> V
fn xzxx(self) -> V
fn xzxy(self) -> V
fn xzxz(self) -> V
fn xzxw(self) -> V
fn xzyx(self) -> V
fn xzyy(self) -> V
fn xzyz(self) -> V
fn xzyw(self) -> V
fn xzzx(self) -> V
fn xzzy(self) -> V
fn xzzz(self) -> V
fn xzzw(self) -> V
fn xzwx(self) -> V
fn xzwy(self) -> V
fn xzwz(self) -> V
fn xzww(self) -> V
fn xwxx(self) -> V
fn xwxy(self) -> V
fn xwxz(self) -> V
fn xwxw(self) -> V
fn xwyx(self) -> V
fn xwyy(self) -> V
fn xwyz(self) -> V
fn xwyw(self) -> V
fn xwzx(self) -> V
fn xwzy(self) -> V
fn xwzz(self) -> V
fn xwzw(self) -> V
fn xwwx(self) -> V
fn xwwy(self) -> V
fn xwwz(self) -> V
fn xwww(self) -> V
fn yxxx(self) -> V
fn yxxy(self) -> V
fn yxxz(self) -> V
fn yxxw(self) -> V
fn yxyx(self) -> V
fn yxyy(self) -> V
fn yxyz(self) -> V
fn yxyw(self) -> V
fn yxzx(self) -> V
fn yxzy(self) -> V
fn yxzz(self) -> V
fn yxzw(self) -> V
fn yxwx(self) -> V
fn yxwy(self) -> V
fn yxwz(self) -> V
fn yxww(self) -> V
fn yyxx(self) -> V
fn yyxy(self) -> V
fn yyxz(self) -> V
fn yyxw(self) -> V
fn yyyx(self) -> V
fn yyyy(self) -> V
fn yyyz(self) -> V
fn yyyw(self) -> V
fn yyzx(self) -> V
fn yyzy(self) -> V
fn yyzz(self) -> V
fn yyzw(self) -> V
fn yywx(self) -> V
fn yywy(self) -> V
fn yywz(self) -> V
fn yyww(self) -> V
fn yzxx(self) -> V
fn yzxy(self) -> V
fn yzxz(self) -> V
fn yzxw(self) -> V
fn yzyx(self) -> V
fn yzyy(self) -> V
fn yzyz(self) -> V
fn yzyw(self) -> V
fn yzzx(self) -> V
fn yzzy(self) -> V
fn yzzz(self) -> V
fn yzzw(self) -> V
fn yzwx(self) -> V
fn yzwy(self) -> V
fn yzwz(self) -> V
fn yzww(self) -> V
fn ywxx(self) -> V
fn ywxy(self) -> V
fn ywxz(self) -> V
fn ywxw(self) -> V
fn ywyx(self) -> V
fn ywyy(self) -> V
fn ywyz(self) -> V
fn ywyw(self) -> V
fn ywzx(self) -> V
fn ywzy(self) -> V
fn ywzz(self) -> V
fn ywzw(self) -> V
fn ywwx(self) -> V
fn ywwy(self) -> V
fn ywwz(self) -> V
fn ywww(self) -> V
fn zxxx(self) -> V
fn zxxy(self) -> V
fn zxxz(self) -> V
fn zxxw(self) -> V
fn zxyx(self) -> V
fn zxyy(self) -> V
fn zxyz(self) -> V
fn zxyw(self) -> V
fn zxzx(self) -> V
fn zxzy(self) -> V
fn zxzz(self) -> V
fn zxzw(self) -> V
fn zxwx(self) -> V
fn zxwy(self) -> V
fn zxwz(self) -> V
fn zxww(self) -> V
fn zyxx(self) -> V
fn zyxy(self) -> V
fn zyxz(self) -> V
fn zyxw(self) -> V
fn zyyx(self) -> V
fn zyyy(self) -> V
fn zyyz(self) -> V
fn zyyw(self) -> V
fn zyzx(self) -> V
fn zyzy(self) -> V
fn zyzz(self) -> V
fn zyzw(self) -> V
fn zywx(self) -> V
fn zywy(self) -> V
fn zywz(self) -> V
fn zyww(self) -> V
fn zzxx(self) -> V
fn zzxy(self) -> V
fn zzxz(self) -> V
fn zzxw(self) -> V
fn zzyx(self) -> V
fn zzyy(self) -> V
fn zzyz(self) -> V
fn zzyw(self) -> V
fn zzzx(self) -> V
fn zzzy(self) -> V
fn zzzz(self) -> V
fn zzzw(self) -> V
fn zzwx(self) -> V
fn zzwy(self) -> V
fn zzwz(self) -> V
fn zzww(self) -> V
fn zwxx(self) -> V
fn zwxy(self) -> V
fn zwxz(self) -> V
fn zwxw(self) -> V
fn zwyx(self) -> V
fn zwyy(self) -> V
fn zwyz(self) -> V
fn zwyw(self) -> V
fn zwzx(self) -> V
fn zwzy(self) -> V
fn zwzz(self) -> V
fn zwzw(self) -> V
fn zwwx(self) -> V
fn zwwy(self) -> V
fn zwwz(self) -> V
fn zwww(self) -> V
fn wxxx(self) -> V
fn wxxy(self) -> V
fn wxxz(self) -> V
fn wxxw(self) -> V
fn wxyx(self) -> V
fn wxyy(self) -> V
fn wxyz(self) -> V
fn wxyw(self) -> V
fn wxzx(self) -> V
fn wxzy(self) -> V
fn wxzz(self) -> V
fn wxzw(self) -> V
fn wxwx(self) -> V
fn wxwy(self) -> V
fn wxwz(self) -> V
fn wxww(self) -> V
fn wyxx(self) -> V
fn wyxy(self) -> V
fn wyxz(self) -> V
fn wyxw(self) -> V
fn wyyx(self) -> V
fn wyyy(self) -> V
fn wyyz(self) -> V
fn wyyw(self) -> V
fn wyzx(self) -> V
fn wyzy(self) -> V
fn wyzz(self) -> V
fn wyzw(self) -> V
fn wywx(self) -> V
fn wywy(self) -> V
fn wywz(self) -> V
fn wyww(self) -> V
fn wzxx(self) -> V
fn wzxy(self) -> V
fn wzxz(self) -> V
fn wzxw(self) -> V
fn wzyx(self) -> V
fn wzyy(self) -> V
fn wzyz(self) -> V
fn wzyw(self) -> V
fn wzzx(self) -> V
fn wzzy(self) -> V
fn wzzz(self) -> V
fn wzzw(self) -> V
fn wzwx(self) -> V
fn wzwy(self) -> V
fn wzwz(self) -> V
fn wzww(self) -> V
fn wwxx(self) -> V
fn wwxy(self) -> V
fn wwxz(self) -> V
fn wwxw(self) -> V
fn wwyx(self) -> V
fn wwyy(self) -> V
fn wwyz(self) -> V
fn wwyw(self) -> V
fn wwzx(self) -> V
fn wwzy(self) -> V
fn wwzz(self) -> V
fn wwzw(self) -> V
fn wwwx(self) -> V
fn wwwy(self) -> V
fn wwwz(self) -> V
fn wwww(self) -> V
impl<V> SwizzleVector for V
Source§impl<M> TranscendentalMath for Mwhere
M: TranscendentalMathWithPolicy,
impl<M> TranscendentalMath for Mwhere
M: TranscendentalMathWithPolicy,
Source§fn sin_cos(self) -> (Self, Self)
fn sin_cos(self) -> (Self, Self)
sin and cos separately.Source§fn versin(self) -> Self
fn versin(self) -> Self
$1 - \cos(x)$ of self, evaluated as $2\sin^2(x/2)$ (accurate near zero).Source§fn haversin(self) -> Self
fn haversin(self) -> Self
$\tfrac{1 - \cos(x)}{2}$ of self, evaluated as $\sin^2(x/2)$ (accurate near zero). Read moreSource§fn sincos_pi(self) -> (Self, Self)
fn sincos_pi(self) -> (Self, Self)
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
fn sin_pi(self) -> Self
pi * x, with improved precision when the policy allows.Source§fn cos_pi(self) -> Self
fn cos_pi(self) -> Self
pi * x, with improved precision when the policy allows.Source§fn tan_pi(self) -> Self
fn tan_pi(self) -> Self
pi * x, with improved precision when the policy allows.Source§fn sinc_pi(self) -> Self
fn sinc_pi(self) -> Self
$\frac{\sin(\pi x)}{\pi x}$ with improved precision when the policy allows.Source§fn sinh_cosh(self) -> (Self, Self)
fn sinh_cosh(self) -> (Self, Self)
sinh and cosh separately.Source§fn exp_m1(self) -> Self
fn exp_m1(self) -> Self
exp(self) - 1 of self, which is more precise than calculating exp(self) - 1 directly.Source§fn exp2_m1(self) -> Self
fn exp2_m1(self) -> Self
2^(self) - 1, which is more precise than calculating exp2(self) - 1 directly.Source§fn exp10_m1(self) -> Self
fn exp10_m1(self) -> Self
10^(self) - 1, which is more precise than calculating exp10(self) - 1 directly.Source§fn sqrt1pm1(self) -> Self
fn sqrt1pm1(self) -> Self
$\sqrt{1 + x} - 1$ of self, which is more precise than sqrt(1 + x) - 1 directly near zero. Read moreSource§fn log2_p1(self) -> Self
fn log2_p1(self) -> Self
$\log_2(1 + x)$ of self, which is more precise than log2(1 + x) directly near zero.Source§fn log10_p1(self) -> Self
fn log10_p1(self) -> Self
$\log_{10}(1 + x)$ of self, which is more precise than log10(1 + x) directly near zero.Source§fn log(self, base: Self) -> Self
fn log(self, base: Self) -> Self
self with respect to the given base.Source§fn ln1m_expnx(self) -> Self
fn ln1m_expnx(self) -> Self
$\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
fn ln1m_expnx_ext(self, lnx: Self) -> Self
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 moreSource§impl<E, V> TranscendentalMathWithPolicy for Vwhere
E: FloatElement,
V: FloatVector<Element = E> + CoreMathWithPolicy + SpecializedTranscendentalMath<E>,
impl<E, V> TranscendentalMathWithPolicy for Vwhere
E: FloatElement,
V: FloatVector<Element = E> + CoreMathWithPolicy + SpecializedTranscendentalMath<E>,
Source§fn sin_cos_p<P>(self) -> (V, V)where
P: Policy,
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 cos_m1_p<P>(self) -> Vwhere
P: Policy,
fn cos_m1_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn versin_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn haversin_p<P>(self) -> Vwhere
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,
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) -> Vwhere
P: Policy,
fn sin_pi_p<P>(self) -> Vwhere
P: Policy,
Trigonometric sine of pi * x, with improved precision when the policy allows.
Source§fn cos_pi_p<P>(self) -> Vwhere
P: Policy,
fn cos_pi_p<P>(self) -> Vwhere
P: Policy,
Trigonometric cosine of pi * x, with improved precision when the policy allows.
Source§fn tan_pi_p<P>(self) -> Vwhere
P: Policy,
fn tan_pi_p<P>(self) -> Vwhere
P: Policy,
Trigonometric tangent of pi * x, with improved precision when the policy allows.
Source§fn sinc_p<P>(self) -> Vwhere
P: Policy,
fn sinc_p<P>(self) -> Vwhere
P: Policy,
Computes sin(x) / x with improved precision when the policy allows.
Source§fn sinc_pi_p<P>(self) -> Vwhere
P: Policy,
fn sinc_pi_p<P>(self) -> Vwhere
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,
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 exph_p<P>(self) -> Vwhere
P: Policy,
fn exph_p<P>(self) -> Vwhere
P: Policy,
The Half exponential function, returns 0.5 * e^(self).
Source§fn exp_m1_p<P>(self) -> Vwhere
P: Policy,
fn exp_m1_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn exp2_m1_p<P>(self) -> Vwhere
P: Policy,
Returns 2^(self) - 1, which is more precise than calculating exp2(self) - 1 directly.
Source§fn exp10_m1_p<P>(self) -> Vwhere
P: Policy,
fn exp10_m1_p<P>(self) -> Vwhere
P: Policy,
Returns 10^(self) - 1, which is more precise than calculating exp10(self) - 1 directly.
Source§fn sqrt1pm1_p<P>(self) -> Vwhere
P: Policy,
fn sqrt1pm1_p<P>(self) -> Vwhere
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_m1_p<P>(self, e: V) -> Vwhere
P: Policy,
fn powf_m1_p<P>(self, e: V) -> Vwhere
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) -> Vwhere
P: Policy,
fn compound_p<P>(self, n: V) -> Vwhere
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 nth_root_p<P, const N: usize>(self) -> Vwhere
P: Policy,
fn nth_root_p<P, const N: usize>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn ln_p<P>(self) -> Vwhere
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 log2_p1_p<P>(self) -> Vwhere
P: Policy,
fn log2_p1_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn log10_p1_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn log_p<P>(self, base: V) -> Vwhere
P: Policy,
Returns the logarithm of self with respect to the given base.
Source§fn log_n_p<P, const N: usize>(self) -> Vwhere
P: Policy,
fn log_n_p<P, const N: usize>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn ln1m_expnx_p<P>(self) -> Vwhere
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) -> Vwhere
P: Policy,
fn ln1m_expnx_ext_p<P>(self, lnx: V) -> Vwhere
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.