Trait ComplexField
pub trait ComplexField:
Entity
+ Conjugate<Canonical = Self>
+ Neg<Output = Self>
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ AddAssign
+ SubAssign
+ MulAssign {
type Real: RealField;
type Simd: SimdCtx;
type ScalarSimd: SimdCtx;
type PortableSimd: SimdCtx;
Show 54 methods
// Required methods
fn faer_from_f64(value: f64) -> Self;
fn faer_add(self, rhs: Self) -> Self;
fn faer_sub(self, rhs: Self) -> Self;
fn faer_mul(self, rhs: Self) -> Self;
fn faer_neg(self) -> Self;
fn faer_inv(self) -> Self;
fn faer_conj(self) -> Self;
fn faer_sqrt(self) -> Self;
fn faer_scale_real(self, rhs: Self::Real) -> Self;
fn faer_scale_power_of_two(self, rhs: Self::Real) -> Self;
fn faer_score(self) -> Self::Real;
fn faer_abs(self) -> Self::Real;
fn faer_abs2(self) -> Self::Real;
fn faer_nan() -> Self;
fn faer_from_real(real: Self::Real) -> Self;
fn faer_real(self) -> Self::Real;
fn faer_imag(self) -> Self::Real;
fn faer_zero() -> Self;
fn faer_one() -> Self;
fn faer_align_offset<S>(
simd: S,
ptr: *const Self::Unit,
len: usize,
) -> Offset<Self::SimdMask<S>>
where S: Simd;
fn faer_slice_as_aligned_simd<S>(
simd: S,
slice: &[Self::Unit],
offset: Offset<Self::SimdMask<S>>,
) -> (Self::PrefixUnit<'_, S>, &[Self::SimdUnit<S>], Self::SuffixUnit<'_, S>)
where S: Simd;
fn faer_slice_as_aligned_simd_mut<S>(
simd: S,
slice: &mut [Self::Unit],
offset: Offset<Self::SimdMask<S>>,
) -> (Self::PrefixMutUnit<'_, S>, &mut [Self::SimdUnit<S>], Self::SuffixMutUnit<'_, S>)
where S: Simd;
fn faer_slice_as_simd<S>(
slice: &[Self::Unit],
) -> (&[Self::SimdUnit<S>], &[Self::Unit])
where S: Simd;
fn faer_slice_as_simd_mut<S>(
slice: &mut [Self::Unit],
) -> (&mut [Self::SimdUnit<S>], &mut [Self::Unit])
where S: Simd;
fn faer_partial_load_unit<S>(
simd: S,
slice: &[Self::Unit],
) -> Self::SimdUnit<S>
where S: Simd;
fn faer_partial_store_unit<S>(
simd: S,
slice: &mut [Self::Unit],
values: Self::SimdUnit<S>,
)
where S: Simd;
fn faer_partial_load_last_unit<S>(
simd: S,
slice: &[Self::Unit],
) -> Self::SimdUnit<S>
where S: Simd;
fn faer_partial_store_last_unit<S>(
simd: S,
slice: &mut [Self::Unit],
values: Self::SimdUnit<S>,
)
where S: Simd;
fn faer_simd_splat_unit<S>(simd: S, unit: Self::Unit) -> Self::SimdUnit<S>
where S: Simd;
fn faer_simd_scalar_mul<S>(simd: S, lhs: Self, rhs: Self) -> Self
where S: Simd;
fn faer_simd_scalar_conj_mul<S>(simd: S, lhs: Self, rhs: Self) -> Self
where S: Simd;
fn faer_simd_scalar_mul_adde<S>(
simd: S,
lhs: Self,
rhs: Self,
acc: Self,
) -> Self
where S: Simd;
fn faer_simd_scalar_conj_mul_adde<S>(
simd: S,
lhs: Self,
rhs: Self,
acc: Self,
) -> Self
where S: Simd;
fn faer_simd_neg<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_conj<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_rotate_left<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
amount: usize,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_add<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_sub<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_mul<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_scale_real<S>(
simd: S,
lhs: <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_conj_mul<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_mul_adde<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
acc: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_conj_mul_adde<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
acc: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd;
fn faer_simd_abs2_adde<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
acc: <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>,
) -> <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>
where S: Simd;
fn faer_simd_abs2<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>
where S: Simd;
fn faer_simd_score<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>
where S: Simd;
// Provided methods
fn faer_is_nan(&self) -> bool { ... }
fn faer_is_finite(&self) -> bool { ... }
fn faer_partial_load<S>(
simd: S,
slice: <Self::Group as ForType>::FaerOf<&[Self::Unit]>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd { ... }
fn faer_partial_store<S>(
simd: S,
slice: <Self::Group as ForType>::FaerOf<&mut [Self::Unit]>,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
)
where S: Simd { ... }
fn faer_partial_load_last<S>(
simd: S,
slice: <Self::Group as ForType>::FaerOf<&[Self::Unit]>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd { ... }
fn faer_partial_store_last<S>(
simd: S,
slice: <Self::Group as ForType>::FaerOf<&mut [Self::Unit]>,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
)
where S: Simd { ... }
fn faer_simd_splat<S>(
simd: S,
value: Self,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>
where S: Simd { ... }
fn faer_simd_reduce_add<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> Self
where S: Simd { ... }
}
Expand description
Unstable trait containing the operations that a number type needs to implement.
Required Associated Types§
Required Methods§
fn faer_from_f64(value: f64) -> Self
fn faer_from_f64(value: f64) -> Self
Converts value
from f64
to Self
.
The conversion may be lossy when converting to a type with less precision.
fn faer_add(self, rhs: Self) -> Self
fn faer_add(self, rhs: Self) -> Self
Returns self + rhs
.
fn faer_sub(self, rhs: Self) -> Self
fn faer_sub(self, rhs: Self) -> Self
Returns self - rhs
.
fn faer_mul(self, rhs: Self) -> Self
fn faer_mul(self, rhs: Self) -> Self
Returns self * rhs
.
fn faer_neg(self) -> Self
fn faer_neg(self) -> Self
Returns -self
.
fn faer_inv(self) -> Self
fn faer_inv(self) -> Self
Returns 1.0/self
.
fn faer_conj(self) -> Self
fn faer_conj(self) -> Self
Returns conjugate(self)
.
fn faer_sqrt(self) -> Self
fn faer_sqrt(self) -> Self
Returns the square root of self
.
fn faer_scale_real(self, rhs: Self::Real) -> Self
fn faer_scale_real(self, rhs: Self::Real) -> Self
Returns the input, scaled by rhs
.
fn faer_scale_power_of_two(self, rhs: Self::Real) -> Self
fn faer_scale_power_of_two(self, rhs: Self::Real) -> Self
Returns the input, scaled by rhs
.
fn faer_score(self) -> Self::Real
fn faer_score(self) -> Self::Real
Returns either the norm or squared norm of the number.
An implementation may choose either, so long as it chooses consistently.
fn faer_nan() -> Self
fn faer_nan() -> Self
Returns a NaN value.
fn faer_from_real(real: Self::Real) -> Self
fn faer_from_real(real: Self::Real) -> Self
Returns a complex number whose real part is equal to real
, and a zero imaginary part.
fn faer_zero() -> Self
fn faer_zero() -> Self
Returns 0.0
.
fn faer_one() -> Self
fn faer_one() -> Self
Returns 1.0
.
fn faer_align_offset<S>(
simd: S,
ptr: *const Self::Unit,
len: usize,
) -> Offset<Self::SimdMask<S>>where
S: Simd,
fn faer_slice_as_aligned_simd<S>(
simd: S,
slice: &[Self::Unit],
offset: Offset<Self::SimdMask<S>>,
) -> (Self::PrefixUnit<'_, S>, &[Self::SimdUnit<S>], Self::SuffixUnit<'_, S>)where
S: Simd,
fn faer_slice_as_aligned_simd_mut<S>(
simd: S,
slice: &mut [Self::Unit],
offset: Offset<Self::SimdMask<S>>,
) -> (Self::PrefixMutUnit<'_, S>, &mut [Self::SimdUnit<S>], Self::SuffixMutUnit<'_, S>)where
S: Simd,
fn faer_slice_as_simd<S>(
slice: &[Self::Unit],
) -> (&[Self::SimdUnit<S>], &[Self::Unit])where
S: Simd,
fn faer_slice_as_simd_mut<S>(
slice: &mut [Self::Unit],
) -> (&mut [Self::SimdUnit<S>], &mut [Self::Unit])where
S: Simd,
fn faer_partial_load_unit<S>(simd: S, slice: &[Self::Unit]) -> Self::SimdUnit<S>where
S: Simd,
fn faer_partial_store_unit<S>(
simd: S,
slice: &mut [Self::Unit],
values: Self::SimdUnit<S>,
)where
S: Simd,
fn faer_partial_load_last_unit<S>(
simd: S,
slice: &[Self::Unit],
) -> Self::SimdUnit<S>where
S: Simd,
fn faer_partial_store_last_unit<S>(
simd: S,
slice: &mut [Self::Unit],
values: Self::SimdUnit<S>,
)where
S: Simd,
fn faer_simd_splat_unit<S>(simd: S, unit: Self::Unit) -> Self::SimdUnit<S>where
S: Simd,
fn faer_simd_scalar_mul<S>(simd: S, lhs: Self, rhs: Self) -> Selfwhere
S: Simd,
fn faer_simd_scalar_conj_mul<S>(simd: S, lhs: Self, rhs: Self) -> Selfwhere
S: Simd,
fn faer_simd_scalar_mul_adde<S>(
simd: S,
lhs: Self,
rhs: Self,
acc: Self,
) -> Selfwhere
S: Simd,
fn faer_simd_scalar_conj_mul_adde<S>(
simd: S,
lhs: Self,
rhs: Self,
acc: Self,
) -> Selfwhere
S: Simd,
fn faer_simd_neg<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_conj<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_rotate_left<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
amount: usize,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_add<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_sub<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_mul<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_scale_real<S>(
simd: S,
lhs: <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_conj_mul<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_mul_adde<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
acc: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_conj_mul_adde<S>(
simd: S,
lhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
rhs: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
acc: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_abs2_adde<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
acc: <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>,
) -> <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>where
S: Simd,
fn faer_simd_abs2<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>where
S: Simd,
fn faer_simd_score<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> <<Self::Real as Entity>::Group as ForCopyType>::FaerOfCopy<<Self::Real as Entity>::SimdUnit<S>>where
S: Simd,
Provided Methods§
fn faer_is_nan(&self) -> bool
fn faer_is_nan(&self) -> bool
Returns true if self
is a NaN value, or false otherwise.
fn faer_is_finite(&self) -> bool
fn faer_is_finite(&self) -> bool
Returns true if self
is a NaN value, or false otherwise.
fn faer_partial_load<S>(
simd: S,
slice: <Self::Group as ForType>::FaerOf<&[Self::Unit]>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_partial_store<S>(
simd: S,
slice: <Self::Group as ForType>::FaerOf<&mut [Self::Unit]>,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
)where
S: Simd,
fn faer_partial_load_last<S>(
simd: S,
slice: <Self::Group as ForType>::FaerOf<&[Self::Unit]>,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_partial_store_last<S>(
simd: S,
slice: <Self::Group as ForType>::FaerOf<&mut [Self::Unit]>,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
)where
S: Simd,
fn faer_simd_splat<S>(
simd: S,
value: Self,
) -> <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>where
S: Simd,
fn faer_simd_reduce_add<S>(
simd: S,
values: <Self::Group as ForCopyType>::FaerOfCopy<Self::SimdUnit<S>>,
) -> Selfwhere
S: Simd,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.