Skip to main content

SpecializedComplexMath

Trait SpecializedComplexMath 

Source
pub trait SpecializedComplexMath<E>: ComplexVector<Element = E> {
    // Required methods
    fn norm<P: Policy>(self) -> Self::Real;
    fn arg<P: Policy>(self) -> Self::Real;
    fn from_polar<P: Policy>(r: Self::Real, theta: Self::Real) -> Self;
    fn powfr<P: Policy>(self, e: Self::Real) -> Self;
    fn expf<P: Policy>(self, base: Self::Real) -> Self;
    fn logr<P: Policy>(self, base: Self::Real) -> Self;
    fn finv<P: Policy>(self) -> Self;

    // Provided methods
    fn to_polar<P: Policy>(self) -> (Self::Real, Self::Real) { ... }
    fn fdiv<P: Policy>(self, rhs: Self) -> Self { ... }
}
Expand description

Element-parameterized implementations behind ComplexMath.

The complex counterpart of thermite::math::specialized: implementing this for a complex vector type gives it ComplexMath and ComplexMathWithPolicy, as implementing SpecializedTranscendentalMath gives it TranscendentalMath.

Bound on ComplexMath; this trait is for implementors.

Required Methods§

Source

fn norm<P: Policy>(self) -> Self::Real

The modulus (magnitude) |z|.

Source

fn arg<P: Policy>(self) -> Self::Real

The principal argument arg(z), in (-pi, pi].

Source

fn from_polar<P: Policy>(r: Self::Real, theta: Self::Real) -> Self

Builds a complex number from a polar representation r * exp(i*theta).

Source

fn powfr<P: Policy>(self, e: Self::Real) -> Self

Raises self to a real power.

Source

fn expf<P: Policy>(self, base: Self::Real) -> Self

Raises a real base to the complex power self.

Source

fn logr<P: Policy>(self, base: Self::Real) -> Self

The logarithm of self in an arbitrary real base.

Source

fn finv<P: Policy>(self) -> Self

1/self, scaling by the modulus and not its square.

Survives the magnitudes where inv would have norm_sqr() overflow to infinity or underflow to zero.

Provided Methods§

Source

fn to_polar<P: Policy>(self) -> (Self::Real, Self::Real)

Polar form (r, theta), such that self == r * exp(i*theta).

Source

fn fdiv<P: Policy>(self, rhs: Self) -> Self

self/rhs, scaling by the modulus and not its square.

Survives the magnitudes where / would have rhs.norm_sqr() overflow to infinity or underflow to zero.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§