pub trait ComplexNumber: ScientificNumber {
type RealPart: RealNumber;
Show 13 methods
// Required methods
fn re(&self) -> Self::RealPart;
fn im(&self) -> Self::RealPart;
fn from_parts(re: Self::RealPart, im: Self::RealPart) -> Self;
fn conj(self) -> Self;
fn abs(self) -> Self::RealPart;
fn arg(self) -> Self::RealPart;
fn to_polar(self) -> (Self::RealPart, Self::RealPart);
fn from_polar(r: Self::RealPart, theta: Self::RealPart) -> Self;
fn exp(self) -> Self;
fn ln(self) -> Self;
fn powc(self, exp: Self) -> Self;
fn powf(self, exp: Self::RealPart) -> Self;
fn sqrt(self) -> Self;
}Expand description
A trait for complex number types
Required Associated Types§
Sourcetype RealPart: RealNumber
type RealPart: RealNumber
The real part of the complex number
Required Methods§
Sourcefn from_parts(re: Self::RealPart, im: Self::RealPart) -> Self
fn from_parts(re: Self::RealPart, im: Self::RealPart) -> Self
Create a new complex number from real and imaginary parts
Sourcefn to_polar(self) -> (Self::RealPart, Self::RealPart)
fn to_polar(self) -> (Self::RealPart, Self::RealPart)
Returns the complex number in exponential form (r, theta)
Sourcefn from_polar(r: Self::RealPart, theta: Self::RealPart) -> Self
fn from_polar(r: Self::RealPart, theta: Self::RealPart) -> Self
Creates a complex number from polar coordinates
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".