pub trait ComplexMathWithPolicy: ComplexVector {
// Required methods
fn norm_p<P: Policy>(self) -> Self::Real;
fn arg_p<P: Policy>(self) -> Self::Real;
fn to_polar_p<P: Policy>(self) -> (Self::Real, Self::Real);
fn from_polar_p<P: Policy>(r: Self::Real, theta: Self::Real) -> Self;
fn powfr_p<P: Policy>(self, e: Self::Real) -> Self;
fn expf_p<P: Policy>(self, base: Self::Real) -> Self;
fn logr_p<P: Policy>(self, base: Self::Real) -> Self;
fn finv_p<P: Policy>(self) -> Self;
fn fdiv_p<P: Policy>(self, rhs: Self) -> Self;
}Expand description
Complex math functions with customizable policies.
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.
Each function takes a Policy as its first generic argument. For the
default-policy versions (same names, no _p suffix), see ComplexMath.
Implemented automatically for every type implementing SpecializedComplexMath.
Required Methods§
Sourcefn norm_p<P: Policy>(self) -> Self::Real
fn norm_p<P: Policy>(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 arg_p<P: Policy>(self) -> Self::Real
fn arg_p<P: Policy>(self) -> Self::Real
The principal argument arg(z), in (-pi, pi], as a real value.
Sourcefn to_polar_p<P: Policy>(self) -> (Self::Real, Self::Real)
fn to_polar_p<P: Policy>(self) -> (Self::Real, Self::Real)
Converts to polar form (r, theta), such that self == r * exp(i*theta).
Sourcefn from_polar_p<P: Policy>(r: Self::Real, theta: Self::Real) -> Self
fn from_polar_p<P: Policy>(r: Self::Real, theta: Self::Real) -> Self
Builds a complex number from a polar representation r * exp(i*theta).
Sourcefn powfr_p<P: Policy>(self, e: Self::Real) -> Self
fn powfr_p<P: Policy>(self, e: Self::Real) -> Self
Raises self to a real power.
The complex-exponent form is powf.
Sourcefn expf_p<P: Policy>(self, base: Self::Real) -> Self
fn expf_p<P: Policy>(self, base: Self::Real) -> Self
Raises a real base to the complex power self.
Sourcefn logr_p<P: Policy>(self, base: Self::Real) -> Self
fn logr_p<P: Policy>(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".