FunctionsComplexType

Trait FunctionsComplexType 

Source
pub trait FunctionsComplexType<T: NumKernel>:
    FunctionsGeneralType<T>
    + PartialEq
    + MulComplexLeft<T> {
    // Required methods
    fn arg_(self) -> T::RealType;
    fn new_(real_part: T::RealType, imag_part: T::RealType) -> Self;
    fn real_(&self) -> T::RealType;
    fn imag_(&self) -> T::RealType;
    fn set_real_(&mut self, real_part: T::RealType);
    fn set_imag_(&mut self, imag_part: T::RealType);
    fn add_real_(&mut self, c: &T::RealType);
    fn add_imag_(&mut self, c: &T::RealType);
    fn multiply_real_(&mut self, c: &T::RealType);
    fn multiply_imag_(&mut self, c: &T::RealType);
    fn conj_(self) -> Self;
    fn try_from_f64_(
        real_part: f64,
        imag_part: f64,
    ) -> Result<Self, TryFromf64Errors>;
}
Expand description

This trait represents the functions that can be applied on complex numbers.

Required Methods§

Source

fn arg_(self) -> T::RealType

Computes the principal Arg of self.

Source

fn new_(real_part: T::RealType, imag_part: T::RealType) -> Self

Creates a complex number of type T::ComplexType from its real and imaginary parts.

Source

fn real_(&self) -> T::RealType

Get the real part of the complex number.

Source

fn imag_(&self) -> T::RealType

Get the imaginary part of the complex number.

Source

fn set_real_(&mut self, real_part: T::RealType)

Set the value of the real part.

Source

fn set_imag_(&mut self, imag_part: T::RealType)

Set the value of the imaginary part.

Source

fn add_real_(&mut self, c: &T::RealType)

Add the value of the the real coefficient c to real part of self.

Source

fn add_imag_(&mut self, c: &T::RealType)

Add the value of the the real coefficient c to imaginary part of self.

Source

fn multiply_real_(&mut self, c: &T::RealType)

Multiply the value of the real part by the real coefficient c.

Source

fn multiply_imag_(&mut self, c: &T::RealType)

Multiply the value of the imaginary part by the real coefficient c.

Source

fn conj_(self) -> Self

Computes the complex conjugate.

Source

fn try_from_f64_( real_part: f64, imag_part: f64, ) -> Result<Self, TryFromf64Errors>

Try to build a Self from real and imaginary parts as f64 values. The returned value is Ok if the input real_part and imag_part are finite and can be exactly represented by T::RealType, otherwise the returned value is TryFromf64Errors.

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 FunctionsComplexType<Native64> for Complex<f64>

Implement the FunctionsComplexType trait for the Complex<f64> type.

Source§

fn arg_(self) -> f64

Computes the principal Arg of self.

Source§

fn new_(real_part: f64, imag_part: f64) -> Self

Creates a complex number of type T::ComplexType from its real and imaginary parts.

§Panics

In debug mode a panic! will be emitted if the real_part or the imag_part is not finite.

Source§

fn real_(&self) -> f64

Get the real part of the complex number.

Source§

fn imag_(&self) -> f64

Get the imaginary part of the complex number.

Source§

fn set_real_(&mut self, real_part: f64)

Set the value of the real part.

§Panics

In debug mode a panic! will be emitted if real_part is not finite.

Source§

fn set_imag_(&mut self, imag_part: f64)

Set the value of the imaginary part.

§Panics

In debug mode a panic! will be emitted if imaginary_part is not finite.

Source§

fn add_real_(&mut self, c: &f64)

Add the value of the the real coefficient c to real part of self.

Source§

fn add_imag_(&mut self, c: &f64)

Add the value of the the real coefficient c to imaginary part of self.

Source§

fn multiply_real_(&mut self, c: &f64)

Multiply the value of the real part by the real coefficient c.

Source§

fn multiply_imag_(&mut self, c: &f64)

Multiply the value of the imaginary part by the real coefficient c.

Source§

fn conj_(self) -> Self

Computes the complex conjugate.

Source§

fn try_from_f64_( real_part: f64, imag_part: f64, ) -> Result<Self, TryFromf64Errors>

Try to build a Self from real and imaginary parts as f64 values. The returned value is Ok if the input real_part and imag_part are finite and can be exactly represented by T::RealType, otherwise the returned value is TryFromf64Errors.

Implementors§