Trait num::complex::ComplexFloat

source ·
pub trait ComplexFloat:
    Num
    + NumCast
    + Copy
    + Neg<Output = Self>
    + Seal {
    type Real: Float + FloatConst;

Show 35 methods // Required methods fn is_nan(self) -> bool; fn is_infinite(self) -> bool; fn is_finite(self) -> bool; fn is_normal(self) -> bool; fn recip(self) -> Self; fn powi(self, exp: i32) -> Self; fn powf(self, exp: Self::Real) -> Self; fn powc(self, exp: Complex<Self::Real>) -> Complex<Self::Real>; fn sqrt(self) -> Self; fn exp(self) -> Self; fn exp2(self) -> Self; fn expf(self, base: Self::Real) -> Self; fn ln(self) -> Self; fn log(self, base: Self::Real) -> Self; fn log2(self) -> Self; fn log10(self) -> Self; fn cbrt(self) -> Self; fn sin(self) -> Self; fn cos(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 re(self) -> Self::Real; fn im(self) -> Self::Real; fn abs(self) -> Self::Real; fn l1_norm(&self) -> Self::Real; fn arg(self) -> Self::Real; fn conj(self) -> Self;
}
Expand description

Generic trait for floating point complex numbers.

This trait defines methods which are common to complex floating point numbers and regular floating point numbers.

This trait is sealed to prevent it from being implemented by anything other than floating point scalars and Complex floats.

Required Associated Types§

source

type Real: Float + FloatConst

The type used to represent the real coefficients of this complex number.

Required Methods§

source

fn is_nan(self) -> bool

Returns true if this value is NaN and false otherwise.

source

fn is_infinite(self) -> bool

Returns true if this value is positive infinity or negative infinity and false otherwise.

source

fn is_finite(self) -> bool

Returns true if this number is neither infinite nor NaN.

source

fn is_normal(self) -> bool

Returns true if the number is neither zero, infinite, subnormal, or NaN.

source

fn recip(self) -> Self

Take the reciprocal (inverse) of a number, 1/x. See also Complex::finv.

source

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

Raises self to a signed integer power.

source

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

Raises self to a real power.

source

fn powc(self, exp: Complex<Self::Real>) -> Complex<Self::Real>

Raises self to a complex power.

source

fn sqrt(self) -> Self

Take the square root of a number.

source

fn exp(self) -> Self

Returns e^(self), (the exponential function).

source

fn exp2(self) -> Self

Returns 2^(self).

source

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

Returns base^(self).

source

fn ln(self) -> Self

Returns the natural logarithm of the number.

source

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

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

source

fn log2(self) -> Self

Returns the base 2 logarithm of the number.

source

fn log10(self) -> Self

Returns the base 10 logarithm of the number.

source

fn cbrt(self) -> Self

Take the cubic root of a number.

source

fn sin(self) -> Self

Computes the sine of a number (in radians).

source

fn cos(self) -> Self

Computes the cosine of a number (in radians).

source

fn tan(self) -> Self

Computes the tangent of a number (in radians).

source

fn asin(self) -> Self

Computes the arcsine of a number. Return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1].

source

fn acos(self) -> Self

Computes the arccosine of a number. Return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1].

source

fn atan(self) -> Self

Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2];

source

fn sinh(self) -> Self

Hyperbolic sine function.

source

fn cosh(self) -> Self

Hyperbolic cosine function.

source

fn tanh(self) -> Self

Hyperbolic tangent function.

source

fn asinh(self) -> Self

Inverse hyperbolic sine function.

source

fn acosh(self) -> Self

Inverse hyperbolic cosine function.

source

fn atanh(self) -> Self

Inverse hyperbolic tangent function.

source

fn re(self) -> Self::Real

Returns the real part of the number.

source

fn im(self) -> Self::Real

Returns the imaginary part of the number.

source

fn abs(self) -> Self::Real

Returns the absolute value of the number. See also Complex::norm

source

fn l1_norm(&self) -> Self::Real

Returns the L1 norm |re| + |im| – the Manhattan distance from the origin.

source

fn arg(self) -> Self::Real

Computes the argument of the number.

source

fn conj(self) -> Self

Computes the complex conjugate of the number.

Formula: a+bi -> a-bi

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> ComplexFloat for Complex<T>
where T: Float + FloatConst,

source§

type Real = T

source§

impl<T> ComplexFloat for T
where T: Float + FloatConst,

source§

type Real = T