pub trait ComplexMath: ComplexMathWithPolicy {
// Provided methods
fn norm(self) -> Self::Real { ... }
fn arg(self) -> Self::Real { ... }
fn to_polar(self) -> (Self::Real, Self::Real) { ... }
fn from_polar(r: Self::Real, theta: Self::Real) -> Self { ... }
fn powfr(self, e: Self::Real) -> Self { ... }
fn expf(self, base: Self::Real) -> Self { ... }
fn logr(self, base: Self::Real) -> Self { ... }
fn finv(self) -> Self { ... }
fn fdiv(self, rhs: Self) -> Self { ... }
}Expand description
Complex math functions using the default policy.
Operations whose result is real (modulus, argument, polar form) or whose
argument is (a real power, base, or logarithm base), which the Self -> Self
core families cannot express.
The purely complex operations (exp, ln, sin, sqrt, powf, …) fit
the core families and come from
TranscendentalMath as they do for
any other vector.
Every method here has a counterpart in ComplexMathWithPolicy with a _p
suffix that takes an explicit Policy.
Implementors of ComplexMathWithPolicy implement this automatically.
Provided Methods§
Sourcefn norm(self) -> Self::Real
fn norm(self) -> Self::Real
The modulus $|z|$, as a real value.
Uses hypot, so it does not overflow for large components the way
sqrt(norm_sqr()) would.
Sourcefn to_polar(self) -> (Self::Real, Self::Real)
fn to_polar(self) -> (Self::Real, Self::Real)
Converts to polar form (r, theta), such that self == r * exp(i*theta).
Sourcefn from_polar(r: Self::Real, theta: Self::Real) -> Self
fn from_polar(r: Self::Real, theta: Self::Real) -> Self
Builds a complex number from a polar representation r * exp(i*theta).
Sourcefn powfr(self, e: Self::Real) -> Self
fn powfr(self, e: Self::Real) -> Self
Raises self to a real power.
The complex-exponent form is powf.
Sourcefn logr(self, base: Self::Real) -> Self
fn logr(self, base: Self::Real) -> Self
The logarithm of self in an arbitrary real base.
The complex-base form is log.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".