simba::scalar

Trait ComplexField

Source
pub trait ComplexField:
    SubsetOf<Self>
    + SupersetOf<f32>
    + SupersetOf<f64>
    + FromPrimitive
    + Field<Element = Self, SimdBool = bool>
    + Neg<Output = Self>
    + 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§

Source

fn from_real(re: Self::RealField) -> Self

Builds a pure-real complex number from the given value.

Source

fn real(self) -> Self::RealField

The real part of this complex number.

Source

fn imaginary(self) -> Self::RealField

The imaginary part of this complex number.

Source

fn modulus(self) -> Self::RealField

The modulus of this complex number.

Source

fn modulus_squared(self) -> Self::RealField

The squared modulus of this complex number.

Source

fn argument(self) -> Self::RealField

The argument of this complex number.

Source

fn norm1(self) -> Self::RealField

The sum of the absolute value of this complex number’s real and imaginary part.

Source

fn scale(self, factor: Self::RealField) -> Self

Multiplies this complex number by factor.

Source

fn unscale(self, factor: Self::RealField) -> Self

Divides this complex number by factor.

Source

fn floor(self) -> Self

Source

fn ceil(self) -> Self

Source

fn round(self) -> Self

Source

fn trunc(self) -> Self

Source

fn fract(self) -> Self

Source

fn mul_add(self, a: Self, b: Self) -> Self

Source

fn abs(self) -> Self::RealField

The absolute value of this complex number: self / self.signum().

This is equivalent to self.modulus().

Source

fn hypot(self, other: Self) -> Self::RealField

Computes (self.conjugate() * self + other.conjugate() * other).sqrt()

Source

fn recip(self) -> Self

Source

fn conjugate(self) -> Self

Source

fn sin(self) -> Self

Source

fn cos(self) -> Self

Source

fn sin_cos(self) -> (Self, Self)

Source

fn tan(self) -> Self

Source

fn asin(self) -> Self

Source

fn acos(self) -> Self

Source

fn atan(self) -> Self

Source

fn sinh(self) -> Self

Source

fn cosh(self) -> Self

Source

fn tanh(self) -> Self

Source

fn asinh(self) -> Self

Source

fn acosh(self) -> Self

Source

fn atanh(self) -> Self

Source

fn log(self, base: Self::RealField) -> Self

Source

fn log2(self) -> Self

Source

fn log10(self) -> Self

Source

fn ln(self) -> Self

Source

fn ln_1p(self) -> Self

Source

fn sqrt(self) -> Self

Source

fn exp(self) -> Self

Source

fn exp2(self) -> Self

Source

fn exp_m1(self) -> Self

Source

fn powi(self, n: i32) -> Self

Source

fn powf(self, n: Self::RealField) -> Self

Source

fn powc(self, n: Self) -> Self

Source

fn cbrt(self) -> Self

Source

fn is_finite(&self) -> bool

Source

fn try_sqrt(self) -> Option<Self>

Provided Methods§

Source

fn to_polar(self) -> (Self::RealField, Self::RealField)

The polar form of this complex number: (modulus, arg)

Source

fn to_exp(self) -> (Self::RealField, Self)

The exponential form of this complex number: (modulus, e^{i arg})

Source

fn signum(self) -> Self

The exponential part of this complex number: self / self.modulus()

Source

fn sinh_cosh(self) -> (Self, Self)

Source

fn sinc(self) -> Self

Cardinal sine

Source

fn sinhc(self) -> Self

Source

fn cosc(self) -> Self

Cardinal cos

Source

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.

Implementations on Foreign Types§

Source§

impl ComplexField for f32

Source§

type RealField = f32

Source§

fn from_real(re: Self::RealField) -> Self

Source§

fn real(self) -> Self::RealField

Source§

fn imaginary(self) -> Self::RealField

Source§

fn norm1(self) -> Self::RealField

Source§

fn modulus(self) -> Self::RealField

Source§

fn modulus_squared(self) -> Self::RealField

Source§

fn argument(self) -> Self::RealField

Source§

fn to_exp(self) -> (Self, Self)

Source§

fn recip(self) -> Self

Source§

fn conjugate(self) -> Self

Source§

fn scale(self, factor: Self::RealField) -> Self

Source§

fn unscale(self, factor: Self::RealField) -> Self

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn fract(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn mul_add(self, a: Self, b: Self) -> Self

Source§

fn powi(self, n: i32) -> Self

Source§

fn powf(self, n: Self) -> Self

Source§

fn powc(self, n: Self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn try_sqrt(self) -> Option<Self>

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn exp_m1(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn log(self, base: Self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn hypot(self, other: Self) -> Self::RealField

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn sin_cos(self) -> (Self, Self)

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn asinh(self) -> Self

Source§

fn acosh(self) -> Self

Source§

fn atanh(self) -> Self

Source§

fn is_finite(&self) -> bool

Source§

impl ComplexField for f64

Source§

type RealField = f64

Source§

fn from_real(re: Self::RealField) -> Self

Source§

fn real(self) -> Self::RealField

Source§

fn imaginary(self) -> Self::RealField

Source§

fn norm1(self) -> Self::RealField

Source§

fn modulus(self) -> Self::RealField

Source§

fn modulus_squared(self) -> Self::RealField

Source§

fn argument(self) -> Self::RealField

Source§

fn to_exp(self) -> (Self, Self)

Source§

fn recip(self) -> Self

Source§

fn conjugate(self) -> Self

Source§

fn scale(self, factor: Self::RealField) -> Self

Source§

fn unscale(self, factor: Self::RealField) -> Self

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn fract(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn mul_add(self, a: Self, b: Self) -> Self

Source§

fn powi(self, n: i32) -> Self

Source§

fn powf(self, n: Self) -> Self

Source§

fn powc(self, n: Self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn try_sqrt(self) -> Option<Self>

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn exp_m1(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn log(self, base: Self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn hypot(self, other: Self) -> Self::RealField

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn acos(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn sin_cos(self) -> (Self, Self)

Source§

fn sinh(self) -> Self

Source§

fn cosh(self) -> Self

Source§

fn tanh(self) -> Self

Source§

fn asinh(self) -> Self

Source§

fn acosh(self) -> Self

Source§

fn atanh(self) -> Self

Source§

fn is_finite(&self) -> bool

Source§

impl<N: RealField + PartialOrd> ComplexField for Complex<N>

Source§

fn exp(self) -> Self

Computes e^(self), where e is the base of the natural logarithm.

Source§

fn ln(self) -> Self

Computes the principal value of natural logarithm of self.

This function has one branch cut:

  • (-∞, 0], continuous from above.

The branch satisfies -π ≤ arg(ln(z)) ≤ π.

Source§

fn sqrt(self) -> Self

Computes the principal value of the square root of self.

This function has one branch cut:

  • (-∞, 0), continuous from above.

The branch satisfies -π/2 ≤ arg(sqrt(z)) ≤ π/2.

Source§

fn powf(self, exp: Self::RealField) -> Self

Raises self to a floating point power.

Source§

fn log(self, base: N) -> Self

Returns the logarithm of self with respect to an arbitrary base.

Source§

fn powc(self, exp: Self) -> Self

Raises self to a complex power.

Source§

fn sin(self) -> Self

Computes the sine of self.

Source§

fn cos(self) -> Self

Computes the cosine of self.

Source§

fn tan(self) -> Self

Computes the tangent of self.

Source§

fn asin(self) -> Self

Computes the principal value of the inverse sine of self.

This function has two branch cuts:

  • (-∞, -1), continuous from above.
  • (1, ∞), continuous from below.

The branch satisfies -π/2 ≤ Re(asin(z)) ≤ π/2.

Source§

fn acos(self) -> Self

Computes the principal value of the inverse cosine of self.

This function has two branch cuts:

  • (-∞, -1), continuous from above.
  • (1, ∞), continuous from below.

The branch satisfies 0 ≤ Re(acos(z)) ≤ π.

Source§

fn atan(self) -> Self

Computes the principal value of the inverse tangent of self.

This function has two branch cuts:

  • (-∞i, -i], continuous from the left.
  • [i, ∞i), continuous from the right.

The branch satisfies -π/2 ≤ Re(atan(z)) ≤ π/2.

Source§

fn sinh(self) -> Self

Computes the hyperbolic sine of self.

Source§

fn cosh(self) -> Self

Computes the hyperbolic cosine of self.

Source§

fn tanh(self) -> Self

Computes the hyperbolic tangent of self.

Source§

fn asinh(self) -> Self

Computes the principal value of inverse hyperbolic sine of self.

This function has two branch cuts:

  • (-∞i, -i), continuous from the left.
  • (i, ∞i), continuous from the right.

The branch satisfies -π/2 ≤ Im(asinh(z)) ≤ π/2.

Source§

fn acosh(self) -> Self

Computes the principal value of inverse hyperbolic cosine of self.

This function has one branch cut:

  • (-∞, 1), continuous from above.

The branch satisfies -π ≤ Im(acosh(z)) ≤ π and 0 ≤ Re(acosh(z)) < ∞.

Source§

fn atanh(self) -> Self

Computes the principal value of inverse hyperbolic tangent of self.

This function has two branch cuts:

  • (-∞, -1], continuous from above.
  • [1, ∞), continuous from below.

The branch satisfies -π/2 ≤ Im(atanh(z)) ≤ π/2.

Source§

type RealField = N

Source§

fn from_real(re: Self::RealField) -> Self

Source§

fn real(self) -> Self::RealField

Source§

fn imaginary(self) -> Self::RealField

Source§

fn argument(self) -> Self::RealField

Source§

fn modulus(self) -> Self::RealField

Source§

fn modulus_squared(self) -> Self::RealField

Source§

fn norm1(self) -> Self::RealField

Source§

fn recip(self) -> Self

Source§

fn conjugate(self) -> Self

Source§

fn scale(self, factor: Self::RealField) -> Self

Source§

fn unscale(self, factor: Self::RealField) -> Self

Source§

fn floor(self) -> Self

Source§

fn ceil(self) -> Self

Source§

fn round(self) -> Self

Source§

fn trunc(self) -> Self

Source§

fn fract(self) -> Self

Source§

fn mul_add(self, a: Self, b: Self) -> Self

Source§

fn abs(self) -> Self::RealField

Source§

fn exp2(self) -> Self

Source§

fn exp_m1(self) -> Self

Source§

fn ln_1p(self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn powi(self, n: i32) -> Self

Source§

fn is_finite(&self) -> bool

Source§

fn try_sqrt(self) -> Option<Self>

Source§

fn hypot(self, b: Self) -> Self::RealField

Source§

fn sin_cos(self) -> (Self, Self)

Source§

fn sinh_cosh(self) -> (Self, Self)

Implementors§