pub trait ComplexField:
SubsetOf<Self>
+ SupersetOf<f32>
+ SupersetOf<f64>
+ FromPrimitive
+ Field<Element = Self, SimdBool = bool, Output = Self>
+ Neg
+ Clone
+ Send
+ Sync
+ Any
+ 'static
+ Debug
+ Display {
type RealField: RealField;
Show 55 methods
// Required methods
fn from_real(re: Self::RealField) -> Self;
fn real(self) -> Self::RealField;
fn imaginary(self) -> Self::RealField;
fn modulus(self) -> Self::RealField;
fn modulus_squared(self) -> Self::RealField;
fn argument(self) -> Self::RealField;
fn norm1(self) -> Self::RealField;
fn scale(self, factor: Self::RealField) -> Self;
fn unscale(self, factor: Self::RealField) -> Self;
fn floor(self) -> Self;
fn ceil(self) -> Self;
fn round(self) -> Self;
fn trunc(self) -> Self;
fn fract(self) -> Self;
fn mul_add(self, a: Self, b: Self) -> Self;
fn abs(self) -> Self::RealField;
fn hypot(self, other: Self) -> Self::RealField;
fn recip(self) -> Self;
fn conjugate(self) -> Self;
fn sin(self) -> Self;
fn cos(self) -> Self;
fn sin_cos(self) -> (Self, Self);
fn tan(self) -> Self;
fn asin(self) -> Self;
fn acos(self) -> Self;
fn atan(self) -> Self;
fn sinh(self) -> Self;
fn cosh(self) -> Self;
fn tanh(self) -> Self;
fn asinh(self) -> Self;
fn acosh(self) -> Self;
fn atanh(self) -> Self;
fn log(self, base: Self::RealField) -> Self;
fn log2(self) -> Self;
fn log10(self) -> Self;
fn ln(self) -> Self;
fn ln_1p(self) -> Self;
fn sqrt(self) -> Self;
fn exp(self) -> Self;
fn exp2(self) -> Self;
fn exp_m1(self) -> Self;
fn powi(self, n: i32) -> Self;
fn powf(self, n: Self::RealField) -> Self;
fn powc(self, n: Self) -> Self;
fn cbrt(self) -> Self;
fn is_finite(&self) -> bool;
fn try_sqrt(self) -> Option<Self>;
// Provided methods
fn to_polar(self) -> (Self::RealField, Self::RealField) { ... }
fn to_exp(self) -> (Self::RealField, Self) { ... }
fn signum(self) -> Self { ... }
fn sinh_cosh(self) -> (Self, Self) { ... }
fn sinc(self) -> Self { ... }
fn sinhc(self) -> Self { ... }
fn cosc(self) -> Self { ... }
fn coshc(self) -> Self { ... }
}
Expand description
Trait shared by all complex fields and its subfields (like real numbers).
Complex numbers are equipped with functions that are commonly used on complex numbers and reals. The results of those functions only have to be approximately equal to the actual theoretical values.
Required Associated Types§
Required Methods§
Sourcefn from_real(re: Self::RealField) -> Self
fn from_real(re: Self::RealField) -> Self
Builds a pure-real complex number from the given value.
Sourcefn modulus_squared(self) -> Self::RealField
fn modulus_squared(self) -> Self::RealField
The squared modulus of this complex number.
Sourcefn norm1(self) -> Self::RealField
fn norm1(self) -> Self::RealField
The sum of the absolute value of this complex number’s real and imaginary part.
fn floor(self) -> Self
fn ceil(self) -> Self
fn round(self) -> Self
fn trunc(self) -> Self
fn fract(self) -> Self
fn mul_add(self, a: Self, b: Self) -> Self
Sourcefn abs(self) -> Self::RealField
fn abs(self) -> Self::RealField
The absolute value of this complex number: self / self.signum()
.
This is equivalent to self.modulus()
.
Sourcefn hypot(self, other: Self) -> Self::RealField
fn hypot(self, other: Self) -> Self::RealField
Computes (self.conjugate() * self + other.conjugate() * other).sqrt()
fn recip(self) -> Self
fn conjugate(self) -> Self
fn sin(self) -> Self
fn cos(self) -> Self
fn sin_cos(self) -> (Self, Self)
fn tan(self) -> Self
fn asin(self) -> Self
fn acos(self) -> Self
fn atan(self) -> Self
fn sinh(self) -> Self
fn cosh(self) -> Self
fn tanh(self) -> Self
fn asinh(self) -> Self
fn acosh(self) -> Self
fn atanh(self) -> Self
fn log(self, base: Self::RealField) -> Self
fn log2(self) -> Self
fn log10(self) -> Self
fn ln(self) -> Self
fn ln_1p(self) -> Self
fn sqrt(self) -> Self
fn exp(self) -> Self
fn exp2(self) -> Self
fn exp_m1(self) -> Self
fn powi(self, n: i32) -> Self
fn powf(self, n: Self::RealField) -> Self
fn powc(self, n: Self) -> Self
fn cbrt(self) -> Self
fn is_finite(&self) -> bool
fn try_sqrt(self) -> Option<Self>
Provided Methods§
Sourcefn to_polar(self) -> (Self::RealField, Self::RealField)
fn to_polar(self) -> (Self::RealField, Self::RealField)
The polar form of this complex number: (modulus, arg)
Sourcefn to_exp(self) -> (Self::RealField, Self)
fn to_exp(self) -> (Self::RealField, Self)
The exponential form of this complex number: (modulus, e^{i arg})
fn sinh_cosh(self) -> (Self, Self)
fn sinhc(self) -> Self
fn coshc(self) -> Self
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.