ComplexScalarGetParts

Trait ComplexScalarGetParts 

Source
pub trait ComplexScalarGetParts: ComplexScalarConstructors {
    // Required methods
    fn real_part(&self) -> Self::RealType;
    fn imag_part(&self) -> Self::RealType;
    fn raw_real_part(&self) -> &<Self::RealType as RealScalar>::RawReal;
    fn raw_imag_part(&self) -> &<Self::RealType as RealScalar>::RawReal;

    // Provided methods
    fn is_pure_real(&self) -> bool { ... }
    fn is_pure_imaginary(&self) -> bool { ... }
}
Expand description

Trait for accessing the real and imaginary components of a complex scalar.

Required Methods§

Source

fn real_part(&self) -> Self::RealType

Get the real part of the complex number.

Source

fn imag_part(&self) -> Self::RealType

Get the imaginary part of the complex number.

Source

fn raw_real_part(&self) -> &<Self::RealType as RealScalar>::RawReal

Returns a reference to the raw real part of the complex number.

Source

fn raw_imag_part(&self) -> &<Self::RealType as RealScalar>::RawReal

Returns a reference to the raw imaginary part of the complex number.

Provided Methods§

Source

fn is_pure_real(&self) -> bool

Returns true if the complex number is purely real (i.e., has no imaginary part).

Note: the complex number zero is considered purely real.

Source

fn is_pure_imaginary(&self) -> bool

Returns true if the complex number is purely imaginary (i.e., has zero real part and non-zero imaginary part).

Note: the complex number zero is considered purely real.

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 ComplexScalarGetParts for Complex<f64>

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

Source§

fn real_part(&self) -> f64

Get the real part of the complex number.

Source§

fn imag_part(&self) -> f64

Get the imaginary part of the complex number.

Source§

fn raw_real_part(&self) -> &f64

Returns a reference to the raw real part of the complex number.

Source§

fn raw_imag_part(&self) -> &f64

Returns a reference to the raw imaginary part of the complex number.

Implementors§