Trait complexfloat::ComplexFloat
[−]
[src]
pub trait ComplexFloat: Add<Output=Self> + Add<Self::Real, Output=Self> + Sub<Output=Self> + Sub<Self::Real, Output=Self> + Div<Output=Self> + Div<Self::Real, Output=Self> + Mul<Output=Self> + Mul<Self::Real, Output=Self> + Copy + Zero + One + PartialEq + Display + Debug + From<Self::Real> + 'static + Send + Sync where Self::Real: FloatMore {
type Real;
fn is_complex() -> bool;
fn real(&self) -> Self::Real;
fn imag(&self) -> Self::Real;
fn from_real_imag(x: Self::Real, y: Self::Real) -> Self;
fn norm(&self) -> Self::Real;
fn conj(&self) -> Self;
fn arg(&self) -> Self::Real;
fn powf(&self, Self::Real) -> Self;
fn pow(&self, Self) -> Self;
fn sqrt(&self) -> Self;
fn exp(&self) -> Self;
fn ln(&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 is_nan(&self) -> bool;
fn is_finite(&self) -> bool;
fn is_infinite(&self) -> bool;
fn is_normal(&self) -> bool;
}
A trait for f32, f64, Complex<f32>, Complex<f64>
together.
The associated type Real
points to the float type (either f32
or f64
).
The idea behind this trait is to treat f32, f64
as representing the
real subset of the complex numbers.
The rule should be that if let x: f32
, then x
and Complex::new(x, 0.)
behave the same way under the methods of this trait.
Associated Types
type Real
Type of the real and imaginary parts (a floating point type).
Required Methods
fn is_complex() -> bool
fn real(&self) -> Self::Real
fn imag(&self) -> Self::Real
fn from_real_imag(x: Self::Real, y: Self::Real) -> Self
Create ComplexFloat from real part x and imaginary part y.
y is ignored if not applicable.
fn norm(&self) -> Self::Real
Return the norm of the number, which is it magnitue as a complex number