ComplexScalarConstructors

Trait ComplexScalarConstructors 

Source
pub trait ComplexScalarConstructors: FpScalar<InnerType = Self::RawComplex> {
    type RawComplex: RawComplexTrait<RawReal = <Self::RealType as RealScalar>::RawReal>;

    // Required method
    fn try_new_complex(
        real: <Self::RawComplex as RawComplexTrait>::RawReal,
        imag: <Self::RawComplex as RawComplexTrait>::RawReal,
    ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>;

    // Provided methods
    fn new_complex(real: Self::RealType, imag: Self::RealType) -> Self { ... }
    fn try_new_pure_real(
        real_part: <Self::RawComplex as RawComplexTrait>::RawReal,
    ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors> { ... }
    fn try_new_pure_imaginary(
        imag_part: <Self::RawComplex as RawComplexTrait>::RawReal,
    ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors> { ... }
    fn new_pure_real(real_part: Self::RealType) -> Self { ... }
    fn new_pure_imaginary(imag_part: Self::RealType) -> Self { ... }
}
Expand description

Trait for constructing complex scalar types from their raw components.

Required Associated Types§

Source

type RawComplex: RawComplexTrait<RawReal = <Self::RealType as RealScalar>::RawReal>

The raw underlying complex type (e.g., num::Complex<f64> or rug::Complex).

Required Methods§

Source

fn try_new_complex( real: <Self::RawComplex as RawComplexTrait>::RawReal, imag: <Self::RawComplex as RawComplexTrait>::RawReal, ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>

Tries to create a new complex scalar from its raw real and imaginary parts.

Provided Methods§

Source

fn new_complex(real: Self::RealType, imag: Self::RealType) -> Self

Creates a new complex scalar from its (validated) real and imaginary parts.

Source

fn try_new_pure_real( real_part: <Self::RawComplex as RawComplexTrait>::RawReal, ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>

Tries to create a new complex scalar from a raw real part, with a zero imaginary part.

Source

fn try_new_pure_imaginary( imag_part: <Self::RawComplex as RawComplexTrait>::RawReal, ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>

Tries to create a new complex scalar from a raw imaginary part, with a zero real part.

Source

fn new_pure_real(real_part: Self::RealType) -> Self

Source

fn new_pure_imaginary(imag_part: Self::RealType) -> Self

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

Implementors§