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§
sourcetype Real: Float + FloatConst
type Real: Float + FloatConst
The type used to represent the real coefficients of this complex number.
Required Methods§
sourcefn is_infinite(self) -> bool
fn is_infinite(self) -> bool
Returns true
if this value is positive infinity or negative infinity and
false otherwise.
sourcefn is_normal(self) -> bool
fn is_normal(self) -> bool
Returns true
if the number is neither zero, infinite,
subnormal, or NaN
.
sourcefn recip(self) -> Self
fn recip(self) -> Self
Take the reciprocal (inverse) of a number, 1/x
. See also Complex::finv.
sourcefn log(self, base: Self::Real) -> Self
fn log(self, base: Self::Real) -> Self
Returns the logarithm of the number with respect to an arbitrary base.
sourcefn asin(self) -> Self
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].
sourcefn acos(self) -> Self
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].
sourcefn atan(self) -> Self
fn atan(self) -> Self
Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2];
sourcefn abs(self) -> Self::Real
fn abs(self) -> Self::Real
Returns the absolute value of the number. See also Complex::norm
sourcefn l1_norm(&self) -> Self::Real
fn l1_norm(&self) -> Self::Real
Returns the L1 norm |re| + |im|
– the Manhattan distance from the origin.